2016-09-22 16:22:34 -07:00
|
|
|
|
/**
|
|
|
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
2016-10-19 11:01:24 -07:00
|
|
|
|
using System.Text;
|
2016-09-22 16:22:34 -07:00
|
|
|
|
|
2016-12-02 11:18:16 -08:00
|
|
|
|
namespace Facebook.Yoga
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-12-02 11:18:16 -08:00
|
|
|
|
public partial class YogaNode : IEnumerable<YogaNode>
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-12-23 08:29:31 -08:00
|
|
|
|
private Native.YGNodeHandle _ygNode;
|
2016-10-07 11:07:51 -07:00
|
|
|
|
private WeakReference _parent;
|
2016-12-02 11:18:16 -08:00
|
|
|
|
private List<YogaNode> _children;
|
2016-09-22 16:22:34 -07:00
|
|
|
|
private MeasureFunction _measureFunction;
|
2016-12-03 04:40:18 -08:00
|
|
|
|
private YogaMeasureFunc _ygMeasureFunc;
|
2017-01-07 09:06:06 -08:00
|
|
|
|
private BaselineFunction _baselineFunction;
|
|
|
|
|
private YogaBaselineFunc _ygBaselineFunc;
|
2016-09-22 16:22:34 -07:00
|
|
|
|
private object _data;
|
|
|
|
|
|
2016-12-02 11:18:16 -08:00
|
|
|
|
public YogaNode()
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-12-02 11:18:16 -08:00
|
|
|
|
YogaLogger.Initialize();
|
2016-10-06 06:04:56 -07:00
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
|
_ygNode = Native.YGNodeNew();
|
2016-12-23 08:29:31 -08:00
|
|
|
|
if (_ygNode.IsInvalid)
|
2016-10-06 06:04:56 -07:00
|
|
|
|
{
|
2016-10-24 10:35:41 -07:00
|
|
|
|
throw new InvalidOperationException("Failed to allocate native memory");
|
2016-10-06 06:04:56 -07:00
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-24 10:35:41 -07:00
|
|
|
|
public void Reset()
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-10-26 07:24:44 -07:00
|
|
|
|
_measureFunction = null;
|
2017-01-07 09:06:06 -08:00
|
|
|
|
_baselineFunction = null;
|
2016-10-26 07:24:44 -07:00
|
|
|
|
_data = null;
|
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeReset(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsDirty
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeIsDirty(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void MarkDirty()
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeMarkDirty(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool HasNewLayout
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeGetHasNewLayout(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void MarkHasNewLayout()
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeSetHasNewLayout(_ygNode, true);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 11:18:16 -08:00
|
|
|
|
public YogaNode Parent
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-02 11:18:16 -08:00
|
|
|
|
return _parent != null ? _parent.Target as YogaNode : null;
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsMeasureDefined
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _measureFunction != null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-07 09:06:06 -08:00
|
|
|
|
public bool IsBaselineDefined
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _baselineFunction != null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 11:18:16 -08:00
|
|
|
|
public void CopyStyle(YogaNode srcNode)
|
2016-11-17 09:10:47 -08:00
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeCopyStyle(_ygNode, srcNode._ygNode);
|
2016-11-17 09:10:47 -08:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public YogaDirection StyleDirection
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetDirection(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
2016-10-26 06:51:39 -07:00
|
|
|
|
|
2016-09-22 16:22:34 -07:00
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetDirection(_ygNode, value);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public YogaFlexDirection FlexDirection
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetFlexDirection(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetFlexDirection(_ygNode, value);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public YogaJustify JustifyContent
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetJustifyContent(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetJustifyContent(_ygNode, value);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public YogaAlign AlignItems
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetAlignItems(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetAlignItems(_ygNode, value);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public YogaAlign AlignSelf
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetAlignSelf(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetAlignSelf(_ygNode, value);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public YogaAlign AlignContent
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetAlignContent(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetAlignContent(_ygNode, value);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public YogaPositionType PositionType
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetPositionType(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetPositionType(_ygNode, value);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public YogaWrap Wrap
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetFlexWrap(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetFlexWrap(_ygNode, value);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float Flex
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetFlex(_ygNode, value);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float FlexGrow
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetFlexGrow(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetFlexGrow(_ygNode, value);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float FlexShrink
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetFlexShrink(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetFlexShrink(_ygNode, value);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public YogaValue FlexBasis
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetFlexBasis(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
if (value.Unit == YogaUnit.Percent)
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetFlexBasisPercent(_ygNode, value.Value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetFlexBasis(_ygNode, value.Value);
|
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-08 07:58:31 -08:00
|
|
|
|
[Obsolete("use Margin properties")]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public YogaValue GetMargin(YogaEdge edge)
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetMargin(_ygNode, edge);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-08 07:58:31 -08:00
|
|
|
|
[Obsolete("use Margin properties")]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public void SetMargin(YogaEdge edge, YogaValue value)
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
if (value.Unit == YogaUnit.Percent)
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetMarginPercent(_ygNode, edge, value.Value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetMargin(_ygNode, edge, value.Value);
|
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-08 07:58:31 -08:00
|
|
|
|
[Obsolete("use Padding properties")]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public YogaValue GetPadding(YogaEdge edge)
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetPadding(_ygNode, edge);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-08 07:58:31 -08:00
|
|
|
|
[Obsolete("use Padding properties")]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public void SetPadding(YogaEdge edge, YogaValue value)
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
if (value.Unit == YogaUnit.Percent)
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetPaddingPercent(_ygNode, edge, value.Value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetPadding(_ygNode, edge, value.Value);
|
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-08 07:58:31 -08:00
|
|
|
|
[Obsolete("use BorderWidth properties")]
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public float GetBorder(YogaEdge edge)
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetBorder(_ygNode, edge);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-08 07:58:31 -08:00
|
|
|
|
[Obsolete("use BorderWidth properties")]
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public void SetBorder(YogaEdge edge, float border)
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetBorder(_ygNode, edge, border);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-08 07:58:31 -08:00
|
|
|
|
[Obsolete("use Position properties")]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public YogaValue GetPosition(YogaEdge edge)
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetPosition(_ygNode, edge);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-08 07:58:31 -08:00
|
|
|
|
[Obsolete("use Position properties")]
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public void SetPosition(YogaEdge edge, YogaValue value)
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
if (value.Unit == YogaUnit.Percent)
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetPositionPercent(_ygNode, edge, value.Value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetPosition(_ygNode, edge, value.Value);
|
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-08 07:58:31 -08:00
|
|
|
|
[Obsolete("use LayoutPadding properties")]
|
2017-01-05 12:48:11 -08:00
|
|
|
|
public float GetLayoutPadding(YogaEdge edge)
|
|
|
|
|
{
|
|
|
|
|
return Native.YGNodeLayoutGetPadding(_ygNode, edge);
|
|
|
|
|
}
|
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public YogaValue Width
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetWidth(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
if (value.Unit == YogaUnit.Percent)
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetWidthPercent(_ygNode, value.Value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetWidth(_ygNode, value.Value);
|
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public YogaValue Height
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetHeight(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
if (value.Unit == YogaUnit.Percent)
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetHeightPercent(_ygNode, value.Value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetHeight(_ygNode, value.Value);
|
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public YogaValue MaxWidth
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetMaxWidth(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
if (value.Unit == YogaUnit.Percent)
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetMaxWidthPercent(_ygNode, value.Value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetMaxWidth(_ygNode, value.Value);
|
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public YogaValue MaxHeight
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetMaxHeight(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
if (value.Unit == YogaUnit.Percent)
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetMaxHeightPercent(_ygNode, value.Value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetMaxHeight(_ygNode, value.Value);
|
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public YogaValue MinWidth
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetMinWidth(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
if (value.Unit == YogaUnit.Percent)
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetMinWidthPercent(_ygNode, value.Value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetMinWidth(_ygNode, value.Value);
|
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
public YogaValue MinHeight
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetMinHeight(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
if (value.Unit == YogaUnit.Percent)
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetMinHeightPercent(_ygNode, value.Value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Native.YGNodeStyleSetMinHeight(_ygNode, value.Value);
|
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 11:18:16 -08:00
|
|
|
|
public float StyleAspectRatio
|
2016-11-21 10:12:26 -08:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetAspectRatio(_ygNode);
|
2016-11-21 10:12:26 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetAspectRatio(_ygNode, value);
|
2016-11-21 10:12:26 -08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-22 16:22:34 -07:00
|
|
|
|
public float LayoutX
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeLayoutGetLeft(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float LayoutY
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeLayoutGetTop(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float LayoutWidth
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeLayoutGetWidth(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float LayoutHeight
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeLayoutGetHeight(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public YogaDirection LayoutDirection
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeLayoutGetDirection(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public YogaOverflow Overflow
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeStyleGetOverflow(_ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleSetOverflow(_ygNode, value);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Data
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_data = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 11:18:16 -08:00
|
|
|
|
public YogaNode this[int index]
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _children[index];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Count
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2016-10-26 06:51:39 -07:00
|
|
|
|
return _children != null ? _children.Count : 0;
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void MarkLayoutSeen()
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeSetHasNewLayout(_ygNode, false);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ValuesEqual(float f1, float f2)
|
|
|
|
|
{
|
|
|
|
|
if (float.IsNaN(f1) || float.IsNaN(f2))
|
|
|
|
|
{
|
|
|
|
|
return float.IsNaN(f1) && float.IsNaN(f2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Math.Abs(f2 - f1) < float.Epsilon;
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 11:18:16 -08:00
|
|
|
|
public void Insert(int index, YogaNode node)
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-10-26 06:51:39 -07:00
|
|
|
|
if (_children == null)
|
|
|
|
|
{
|
2016-12-02 11:18:16 -08:00
|
|
|
|
_children = new List<YogaNode>(4);
|
2016-10-26 06:51:39 -07:00
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
_children.Insert(index, node);
|
2016-10-07 11:07:51 -07:00
|
|
|
|
node._parent = new WeakReference(this);
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeInsertChild(_ygNode, node._ygNode, (uint)index);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveAt(int index)
|
|
|
|
|
{
|
|
|
|
|
var child = _children[index];
|
|
|
|
|
child._parent = null;
|
|
|
|
|
_children.RemoveAt(index);
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeRemoveChild(_ygNode, child._ygNode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-25 07:38:06 -07:00
|
|
|
|
public void Clear()
|
|
|
|
|
{
|
2016-10-26 06:51:39 -07:00
|
|
|
|
if (_children != null)
|
2016-10-25 07:38:06 -07:00
|
|
|
|
{
|
2016-10-26 06:51:39 -07:00
|
|
|
|
while (_children.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
RemoveAt(_children.Count-1);
|
|
|
|
|
}
|
2016-10-25 07:38:06 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 11:18:16 -08:00
|
|
|
|
public int IndexOf(YogaNode node)
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-10-26 06:51:39 -07:00
|
|
|
|
return _children != null ? _children.IndexOf(node) : -1;
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetMeasureFunction(MeasureFunction measureFunction)
|
|
|
|
|
{
|
|
|
|
|
_measureFunction = measureFunction;
|
2016-12-03 04:40:18 -08:00
|
|
|
|
_ygMeasureFunc = measureFunction != null ? MeasureInternal : (YogaMeasureFunc)null;
|
|
|
|
|
Native.YGNodeSetMeasureFunc(_ygNode, _ygMeasureFunc);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-07 09:06:06 -08:00
|
|
|
|
public void SetBaselineFunction(BaselineFunction baselineFunction)
|
|
|
|
|
{
|
|
|
|
|
_baselineFunction = baselineFunction;
|
|
|
|
|
_ygBaselineFunc = baselineFunction != null ? BaselineInternal : (YogaBaselineFunc)null;
|
|
|
|
|
Native.YGNodeSetBaselineFunc(_ygNode, _ygBaselineFunc);
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-27 04:34:52 -07:00
|
|
|
|
public void CalculateLayout()
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeCalculateLayout(
|
|
|
|
|
_ygNode,
|
2016-12-02 05:47:43 -08:00
|
|
|
|
YogaConstants.Undefined,
|
|
|
|
|
YogaConstants.Undefined,
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodeStyleGetDirection(_ygNode));
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 11:18:16 -08:00
|
|
|
|
private YogaSize MeasureInternal(
|
2016-10-27 10:52:11 -07:00
|
|
|
|
IntPtr node,
|
2016-09-22 16:22:34 -07:00
|
|
|
|
float width,
|
2016-12-02 05:47:43 -08:00
|
|
|
|
YogaMeasureMode widthMode,
|
2016-09-22 16:22:34 -07:00
|
|
|
|
float height,
|
2016-12-02 05:47:43 -08:00
|
|
|
|
YogaMeasureMode heightMode)
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-10-13 07:52:46 -07:00
|
|
|
|
if (_measureFunction == null)
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException("Measure function is not defined.");
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-24 02:40:25 -08:00
|
|
|
|
return _measureFunction(this, width, widthMode, height, heightMode);
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-07 09:06:06 -08:00
|
|
|
|
private float BaselineInternal(IntPtr node, float width, float height)
|
|
|
|
|
{
|
|
|
|
|
if (_baselineFunction == null)
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException("Baseline function is not defined.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _baselineFunction(this, width, height);
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public string Print(YogaPrintOptions options =
|
|
|
|
|
YogaPrintOptions.Layout|YogaPrintOptions.Style|YogaPrintOptions.Children)
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-10-19 11:01:24 -07:00
|
|
|
|
StringBuilder sb = new StringBuilder();
|
2016-12-02 11:18:16 -08:00
|
|
|
|
YogaLogger.Func orig = YogaLogger.Logger;
|
|
|
|
|
YogaLogger.Logger = (level, message) => {sb.Append(message);};
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGNodePrint(_ygNode, options);
|
2016-12-02 11:18:16 -08:00
|
|
|
|
YogaLogger.Logger = orig;
|
2016-10-19 11:01:24 -07:00
|
|
|
|
return sb.ToString();
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 11:18:16 -08:00
|
|
|
|
public IEnumerator<YogaNode> GetEnumerator()
|
2016-09-22 16:22:34 -07:00
|
|
|
|
{
|
2016-12-02 11:18:16 -08:00
|
|
|
|
return _children != null ? ((IEnumerable<YogaNode>)_children).GetEnumerator() :
|
|
|
|
|
System.Linq.Enumerable.Empty<YogaNode>().GetEnumerator();
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
|
|
|
{
|
2016-12-02 11:18:16 -08:00
|
|
|
|
return _children != null ? ((IEnumerable<YogaNode>)_children).GetEnumerator() :
|
|
|
|
|
System.Linq.Enumerable.Empty<YogaNode>().GetEnumerator();
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
2016-10-07 11:07:50 -07:00
|
|
|
|
|
|
|
|
|
public static int GetInstanceCount()
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGNodeGetInstanceCount();
|
2016-10-07 11:07:50 -07:00
|
|
|
|
}
|
2016-11-14 03:27:33 -08:00
|
|
|
|
|
2016-11-23 11:12:51 -08:00
|
|
|
|
public static void SetExperimentalFeatureEnabled(
|
2016-12-02 05:47:43 -08:00
|
|
|
|
YogaExperimentalFeature feature,
|
2016-11-14 03:27:33 -08:00
|
|
|
|
bool enabled)
|
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
Native.YGSetExperimentalFeatureEnabled(feature, enabled);
|
2016-11-14 03:27:33 -08:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
|
public static bool IsExperimentalFeatureEnabled(YogaExperimentalFeature feature)
|
2016-11-14 03:27:33 -08:00
|
|
|
|
{
|
2016-12-03 04:40:18 -08:00
|
|
|
|
return Native.YGIsExperimentalFeatureEnabled(feature);
|
2016-11-14 03:27:33 -08:00
|
|
|
|
}
|
2016-09-22 16:22:34 -07:00
|
|
|
|
}
|
2016-10-07 11:07:48 -07:00
|
|
|
|
}
|