public HandleAddedToContainer ( FContainer, container ) : void | ||
container | FContainer, | |
리턴 | void |
public void AddChild(FNode node) { int nodeIndex = node.index; if (nodeIndex == -1) //add it if it's not a child { node.HandleAddedToContainer(this); _childNodes.Add(node); if (_isOnStage) { node.stage = _stage; node.HandleAddedToStage(); } } else if (nodeIndex != _childNodes.Count - 1) //if node is already a child, put it at the top of the children if it's not already { _childNodes.RemoveAt(nodeIndex); HandleChildIndex(nodeIndex); node.HandleAddedToContainer(this); _childNodes.Add(node); if (_isOnStage) { _stage.HandleFacetsChanged(); } } }
public void AddChildAtIndex(FNode node, int newIndex) { int nodeIndex = _childNodes.IndexOf(node); if (newIndex > _childNodes.Count) //if it's past the end, make it at the end { newIndex = _childNodes.Count; } if (nodeIndex == newIndex) { return; //if it's already at the right index, just leave it there } if (nodeIndex == -1) //add it if it's not a child { node.HandleAddedToContainer(this); _childNodes.Insert(newIndex, node); if (_isOnStage) { node.stage = _stage; node.HandleAddedToStage(); } } else //if node is already a child, move it to the desired index { _childNodes.RemoveAt(nodeIndex); if (nodeIndex < newIndex) { _childNodes.Insert(newIndex - 1, node); //gotta subtract 1 to account for it moving in the order } else { _childNodes.Insert(newIndex, node); } if (_isOnStage) { _stage.HandleFacetsChanged(); } } }
public void AddChild(FNode node) { int nodeIndex = _childNodes.IndexOf(node); if(nodeIndex == -1) //add it if it's not a child { node.HandleAddedToContainer(this); _childNodes.Add(node); if(_isOnStage) { node.HandleAddedToStage(); } } else if(nodeIndex != _childNodes.Count-1) //if node is already a child, put it at the top of the children if it's not already { _childNodes.RemoveAt(nodeIndex); _childNodes.Add(node); if(_isOnStage) _stage.HandleQuadsChanged(); } }
public void AddChildAtIndex(FNode node, int newIndex) { int nodeIndex = _childNodes.IndexOf(node); if(newIndex > _childNodes.Count) //if it's past the end, make it at the end { newIndex = _childNodes.Count; } if(nodeIndex == newIndex) return; //if it's already at the right index, just leave it there if(nodeIndex == -1) //add it if it's not a child { node.HandleAddedToContainer(this); _childNodes.Insert(newIndex, node); if(_isOnStage) { node.HandleAddedToStage(); } } else //if node is already a child, move it to the desired index { _childNodes.RemoveAt(nodeIndex); if(nodeIndex < newIndex) { _childNodes.Insert(newIndex-1, node); //gotta subtract 1 to account for it moving in the order } else { _childNodes.Insert(newIndex, node); } if(_isOnStage) _stage.HandleQuadsChanged(); } }