// // Reset resets a node public static void Reset(ref Node node) { Flex.assertWithNode(node, node.Children.Count == 0, "Cannot reset a node which still has children attached"); Flex.assertWithNode(node, node.Parent == null, "Cannot reset a node still attached to a parent"); node.Children.Clear(); var config = node.config; node = CreateDefaultNode(); if (config.UseWebDefaults) { node.nodeStyle.FlexDirection = FlexDirection.Row; node.nodeStyle.AlignContent = Align.Stretch; } node.config = config; }
// LayoutGetMargin gets margin public float LayoutGetMargin(Edge edge) { Flex.assertWithNode(this, edge < Edge.End, "Cannot get layout properties of multi-edge shorthands"); if (edge == Edge.Left) { if (this.nodeLayout.Direction == Direction.RTL) { return(this.nodeLayout.Margin[(int)Edge.End]); } return(this.nodeLayout.Margin[(int)Edge.Start]); } if (edge == Edge.Right) { if (this.nodeLayout.Direction == Direction.RTL) { return(this.nodeLayout.Margin[(int)Edge.Start]); } return(this.nodeLayout.Margin[(int)Edge.End]); } return(this.nodeLayout.Margin[(int)edge]); }