private void AddElementInternal(GraphElement element) { if (element == null) { throw new ArgumentException("Cannot add null element"); } if (containedElements.Contains(element)) { throw new ArgumentException("The specified element is already contained in this scope."); } string reasonWhyNotAccepted = "Cannot add the specified element to this scope."; if (!AcceptsElement(element, ref reasonWhyNotAccepted)) { throw new ArgumentException(reasonWhyNotAccepted); } // Removes the element from its current scope Scope currentScope = element.GetContainingScope(); if (currentScope != null) { currentScope.RemoveElement(element); } m_ContainedElements.Add(element); element.SetContainingScope(this); // To update the scope geometry whenever the added element's geometry changes element.RegisterCallback <GeometryChangedEvent>(OnSubElementGeometryChanged); ScheduleUpdateGeometryFromContent(); }
private void OnChildAdded(GraphElement element) { element.AddToClassList("stack-child-element"); element.ResetPositionProperties(); element.RegisterCallback <DetachFromPanelEvent>(OnChildDetachedFromPanel); UpdatePlaceholderVisibility(); }
private void OnChildAdded(GraphElement element) { element.AddToClassList("stack-child-element"); // these capabilities should be set correctly on contruction of stackable nodes (in client/dependent code), // -- Since the module didn't have a way of identifying stackable nodes previously, we can provide some identity here. // TODO: Remove this once deps have an opportunity to use the flags. element.capabilities &= ~(Capabilities.Snappable | Capabilities.Stackable | Capabilities.Groupable); element.ResetPositionProperties(); element.RegisterCallback <DetachFromPanelEvent>(OnChildDetachedFromPanel); UpdatePlaceholderVisibility(); }