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; } }
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); }
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); }
public void CopyFrom(YogaLayout other) { Position.CopyFrom(other.Position); Dimensions.CopyFrom(other.Dimensions); Margin.CopyFrom(other.Margin); Border.CopyFrom(other.Border); Padding.CopyFrom(other.Padding); Direction = other.Direction; ComputedFlexBasisGeneration = other.ComputedFlexBasisGeneration; ComputedFlexBasis = other.ComputedFlexBasis; HadOverflow = other.HadOverflow; GenerationCount = other.GenerationCount; LastOwnerDirection = other.LastOwnerDirection; NextCachedMeasurementsIndex = other.NextCachedMeasurementsIndex; Array.Copy(other.CachedMeasurements, CachedMeasurements, CachedMeasurements.Length); MeasuredDimensions.CopyFrom(other.MeasuredDimensions); CachedLayout.CopyFrom(other.CachedLayout); DidUseLegacyFlag = other.DidUseLegacyFlag; DoesLegacyStretchFlagAffectsLayout = other.DoesLegacyStretchFlagAffectsLayout; }