void UpdatePortInputs() { foreach (var port in inputContainer.OfType <NodePort>()) { if (!m_PortInputContainer.OfType <PortInputView>().Any(a => Equals(a.slot, port.slot))) { var portInputView = new PortInputView(port.slot) { style = { positionType = PositionType.Absolute } }; m_PortInputContainer.Add(portInputView); port.RegisterCallback <GeometryChangedEvent>(evt => UpdatePortInput((NodePort)evt.target)); } } }
void UpdatePortInputs() { foreach (var port in inputContainer.Children().OfType <NodePort>()) { if (port.slot.isConnected) { continue; } var portInputView = m_PortInputContainer.Children().OfType <PortInputView>().FirstOrDefault(a => Equals(a.slot, port.slot)); if (portInputView == null) { portInputView = new PortInputView(port.slot) { style = { position = Position.Absolute } }; m_PortInputContainer.Add(portInputView); SetPortInputPosition(port, portInputView); } port.RegisterCallback <GeometryChangedEvent>(UpdatePortInput); } }
void SetPortInputPosition(NodePort port, PortInputView inputView) { inputView.style.top = port.layout.y; inputView.parent.style.height = inputContainer.layout.height; }