protected void ShowText() { if (m_TextElement != null && m_TextElement.hierarchy.parent == null) { VisualElement textParent = this; if (GraphView != null) { textParent = GraphView; } textParent.Add(m_TextElement); if (textParent != this) { if (m_TextAttacher == null) { m_TextAttacher = new Attacher(m_TextElement, m_IconElement, SpriteAlignment.TopRight); } else { m_TextAttacher.Reattach(); } } m_TextAttacher.Distance = 0; m_TextElement.ResetPositionProperties(); ComputeTextSize(); } }
private static void HandleFieldLayout(Node target, Direction direction, VisualElement nodeContainer, Type type, Type portType, FieldInfo fieldInfo, BindableElement element, string path) { var port = CreatePort(direction, type, fieldInfo, path, portType); nodeContainer.Add(port); if (element != null) { var container = CreateContainer(element, direction == Direction.Input ? Direction.Output : Direction.Input, type, portType, path); port.RegisterCallback <PortUpdateEvent>(OnPortUpdateContainer); element.style.minWidth = 50; target.Add(container); Attacher attacher = new Attacher(container, port, direction == Direction.Input ? SpriteAlignment.LeftCenter : SpriteAlignment.RightCenter); attacher.Reattach(); port.userData = attacher; container.userData = attacher; port.RegisterCallback <DetachFromPanelEvent>(OnDetachFromPanel); container.RegisterCallback <DetachFromPanelEvent>(OnDetachFromPanel); } }