示例#1
0
        public YogaNode(
            YogaPrint print,
            bool hasNewLayout,
            YogaNodeType nodeType,
            YogaMeasure measure,
            YogaBaseline baseline,
            YogaDirtied dirtied,
            YogaStyle style,
            YogaLayout layout,
            int lineIndex,
            YogaNode owner,
            List <YogaNode> children,
            YogaNode nextChild,
            YogaConfig config,
            bool isDirty,
            YogaValue[] resolvedDimensions)
        {
            _print              = print;
            _hasNewLayout       = hasNewLayout;
            _nodeType           = nodeType;
            _measure            = measure;
            _baseline           = baseline;
            _dirtied            = dirtied;
            _style              = style;
            _layout             = layout;
            _lineIndex          = lineIndex;
            _owner              = owner;
            _children           = new List <YogaNode>(children);
            _nextChild          = nextChild;
            _config             = config;
            _isDirty            = isDirty;
            _resolvedDimensions = YogaArray.From(resolvedDimensions);

            Interlocked.Increment(ref _instanceCount);
        }
        public void Reset()
        {
            if (_children.Count > 0)
            {
                throw new InvalidOperationException("Cannot reset a node which still has children attached");
            }

            if (_owner != null)
            {
                throw new InvalidOperationException("Cannot reset a node still attached to a owner");
            }

            Clear();

            _print              = null;
            _hasNewLayout       = true;
            _nodeType           = YogaNodeType.Default;
            _measure            = null;
            _baseline           = null;
            _dirtied            = null;
            _style              = new YogaStyle();
            _layout             = new YogaLayout();
            _lineIndex          = 0;
            _owner              = null;
            _children           = new List <YogaNode>();
            _nextChild          = null;
            _isDirty            = false;
            _resolvedDimensions = new YogaArray <YogaValue>(new YogaValue[] { YogaValue.Undefined, YogaValue.Undefined });

            if (_config.UseWebDefaults)
            {
                Style.FlexDirection = YogaFlexDirection.Row;
                Style.AlignContent  = YogaAlign.Stretch;
            }
        }
示例#3
0
 public void CopyFrom(YogaStyle other)
 {
     Direction      = other.Direction;
     FlexDirection  = other.FlexDirection;
     JustifyContent = other.JustifyContent;
     AlignContent   = other.AlignContent;
     AlignItems     = other.AlignItems;
     AlignSelf      = other.AlignSelf;
     PositionType   = other.PositionType;
     FlexWrap       = other.FlexWrap;
     Overflow       = other.Overflow;
     Display        = other.Display;
     Flex           = other.Flex;
     FlexGrow       = other.FlexGrow;
     FlexShrink     = other.FlexShrink;
     FlexBasis      = other.FlexBasis;
     Margin.CopyFrom(other.Margin);
     Position.CopyFrom(other.Position);
     Padding.CopyFrom(other.Padding);
     Border.CopyFrom(other.Border);
     Dimensions.CopyFrom(other.Dimensions);
     MinDimensions.CopyFrom(other.MinDimensions);
     MaxDimensions.CopyFrom(other.MaxDimensions);
     AspectRatio = other.AspectRatio;
 }
示例#4
0
        public YogaNode(YogaNode node)
        {
            _print              = node._print;
            _hasNewLayout       = node._hasNewLayout;
            _nodeType           = node._nodeType;
            _measure            = node._measure;
            _baseline           = node._baseline;
            _dirtied            = node._dirtied;
            _style              = node._style;
            _layout             = node._layout;
            _lineIndex          = node._lineIndex;
            _owner              = node._owner;
            _children           = new List <YogaNode>(node._children);
            _nextChild          = node._nextChild;
            _config             = node._config;
            _isDirty            = node._isDirty;
            _resolvedDimensions = YogaArray.From(node._resolvedDimensions);

            Interlocked.Increment(ref _instanceCount);
        }
示例#5
0
        private YogaArray <YogaValue> _resolvedDimensions; // [2]

        public YogaNode()
        {
            _print              = null;
            _hasNewLayout       = true;
            _nodeType           = YogaNodeType.Default;
            _measure            = null;
            _baseline           = null;
            _dirtied            = null;
            _style              = new YogaStyle();
            _layout             = new YogaLayout();
            _lineIndex          = 0;
            _owner              = null;
            _children           = new List <YogaNode>();
            _nextChild          = null;
            _config             = new YogaConfig();
            _isDirty            = false;
            _resolvedDimensions = new YogaArray <YogaValue>(new YogaValue[] { YogaValue.Undefined, YogaValue.Undefined });

            Interlocked.Increment(ref _instanceCount);
        }