diff --git a/Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseNodeView.cs b/Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseNodeView.cs index 5f3dfdad..8f6cf7cd 100644 --- a/Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseNodeView.cs +++ b/Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseNodeView.cs @@ -266,7 +266,6 @@ void OnGeometryChanged(GeometryChangedEvent evt) } } - // Workaround for bug in GraphView that makes the node selection border way too big VisualElement selectionBorder, nodeBorder; internal void EnableSyncSelectionBorderHeight() { @@ -275,12 +274,11 @@ internal void EnableSyncSelectionBorderHeight() selectionBorder = this.Q("selection-border"); nodeBorder = this.Q("node-border"); - schedule.Execute(() => { + nodeBorder.RegisterCallback(e => { selectionBorder.style.height = nodeBorder.localBound.height; - }).Every(17); + }); } - } - + } void CreateSettingButton() { settingButton = new Button(ToggleSettings){name = "settings-button"}; @@ -826,6 +824,10 @@ protected VisualElement AddControlField(string fieldName, string label = null, b Regex s_ReplaceNodeIndexPropertyPath = new Regex(@"(^nodes.Array.data\[)(\d+)(\])"); internal void SyncSerializedPropertyPathes() { + if (owner.serializedGraph == null) + return; + + // Find the actual index of this node in the graph's node list int nodeIndex = owner.graph.nodes.FindIndex(n => n == nodeTarget); // If the node is not found, then it means that it has been deleted from serialized data. @@ -835,6 +837,8 @@ internal void SyncSerializedPropertyPathes() var nodeIndexString = nodeIndex.ToString(); foreach (var propertyField in this.Query().ToList()) { + if (propertyField.bindingPath == null) + continue; propertyField.Unbind(); // The property path look like this: nodes.Array.data[x].fieldName // And we want to update the value of x with the new node index: @@ -863,8 +867,17 @@ protected VisualElement AddControlField(FieldInfo field, string label = null, bo #endif if (typeof(IList).IsAssignableFrom(field.FieldType)) + { EnableSyncSelectionBorderHeight(); - + element.RegisterCallback(e => { + if (e.button == 0) + e.StopPropagation(); + }); + element.RegisterCallback(e => { + if (e.pressedButtons == 1) + e.StopPropagation(); + }); + } element.RegisterValueChangeCallback(e => { UpdateFieldVisibility(field.Name, field.GetValue(nodeTarget)); valueChangedCallback?.Invoke(); @@ -1176,4 +1189,4 @@ void UpdatePortsForField(string fieldName) #endregion } -} \ No newline at end of file +}