diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9ba22613..0b1da955 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,7 @@
> - Added AllowZoomingWhilePanning, AllowZoomingWhileSelecting, AllowZoomingWhileCutting and AllowZoomingWhilePushingItems to EditorState
> - Added EnableToggledSelectingMode, EnableToggledPanningMode, EnableToggledPushingItemsMode and EnableToggledCuttingMode to EditorState
> - Added MinimapState.EnableToggledPanningMode
+> - Added Unbind to InputGestureRef and EditorGestures.SelectionGestures
> - Bugfixes:
> - Fixed an issue where the ItemContainer was selected by releasing the mouse button on it, even when the mouse was not captured
> - Fixed an issue where the ItemContainer could open its context menu even when it was not selected
diff --git a/Examples/Nodify.Calculator/MainWindow.xaml.cs b/Examples/Nodify.Calculator/MainWindow.xaml.cs
index 1d476fb0..243d4a15 100644
--- a/Examples/Nodify.Calculator/MainWindow.xaml.cs
+++ b/Examples/Nodify.Calculator/MainWindow.xaml.cs
@@ -9,7 +9,7 @@ public MainWindow()
{
InitializeComponent();
- EditorGestures.Mappings.Editor.Cutting.Value = MultiGesture.None;
+ EditorGestures.Mappings.Editor.Cutting.Unbind();
}
}
}
diff --git a/Examples/Nodify.Playground/EditorInputMode.cs b/Examples/Nodify.Playground/EditorInputMode.cs
index 02e59049..3218fa5d 100644
--- a/Examples/Nodify.Playground/EditorInputMode.cs
+++ b/Examples/Nodify.Playground/EditorInputMode.cs
@@ -26,25 +26,25 @@ public static void Apply(this EditorGestures mappings, EditorInputMode inputMode
switch (inputMode)
{
case EditorInputMode.PanOnly:
- mappings.Editor.Selection.Apply(EditorGestures.SelectionGestures.None);
- mappings.Editor.Cutting.Value = MultiGesture.None;
- mappings.ItemContainer.Selection.Apply(EditorGestures.SelectionGestures.None);
- mappings.ItemContainer.Drag.Value = MultiGesture.None;
- mappings.Connector.Connect.Value = MultiGesture.None;
+ mappings.Editor.Selection.Unbind();
+ mappings.Editor.Cutting.Unbind();
+ mappings.ItemContainer.Selection.Unbind();
+ mappings.ItemContainer.Drag.Unbind();
+ mappings.Connector.Connect.Unbind();
break;
case EditorInputMode.SelectOnly:
- mappings.Editor.Pan.Value = MultiGesture.None;
- mappings.Editor.Cutting.Value = MultiGesture.None;
- mappings.ItemContainer.Drag.Value = MultiGesture.None;
- mappings.Connector.Connect.Value = MultiGesture.None;
+ mappings.Editor.Pan.Unbind();
+ mappings.Editor.Cutting.Unbind();
+ mappings.ItemContainer.Drag.Unbind();
+ mappings.Connector.Connect.Unbind();
break;
case EditorInputMode.CutOnly:
mappings.Editor.Cutting.Value = new Interactivity.MouseGesture(MouseAction.LeftClick);
- mappings.Editor.Selection.Apply(EditorGestures.SelectionGestures.None);
- mappings.Editor.Pan.Value = MultiGesture.None;
- mappings.ItemContainer.Selection.Apply(EditorGestures.SelectionGestures.None);
- mappings.ItemContainer.Drag.Value = MultiGesture.None;
- mappings.Connector.Connect.Value = MultiGesture.None;
+ mappings.Editor.Selection.Unbind();
+ mappings.Editor.Pan.Unbind();
+ mappings.ItemContainer.Selection.Unbind();
+ mappings.ItemContainer.Drag.Unbind();
+ mappings.Connector.Connect.Unbind();
break;
case EditorInputMode.Default:
break;
diff --git a/Examples/Nodify.Shapes/Canvas/Gestures/UnboundGestureMappings.cs b/Examples/Nodify.Shapes/Canvas/Gestures/UnboundGestureMappings.cs
index 26057189..fca105ec 100644
--- a/Examples/Nodify.Shapes/Canvas/Gestures/UnboundGestureMappings.cs
+++ b/Examples/Nodify.Shapes/Canvas/Gestures/UnboundGestureMappings.cs
@@ -8,10 +8,10 @@ public class UnboundGestureMappings : EditorGestures
public UnboundGestureMappings()
{
- Editor.Selection.Apply(SelectionGestures.None);
- ItemContainer.Selection.Apply(SelectionGestures.None);
- Connection.Disconnect.Value = MultiGesture.None;
- Connector.Connect.Value = MultiGesture.None;
+ Editor.Selection.Unbind();
+ ItemContainer.Selection.Unbind();
+ Connection.Disconnect.Unbind();
+ Connector.Connect.Unbind();
}
}
}
diff --git a/Examples/Nodify.StateMachine/MainWindow.xaml.cs b/Examples/Nodify.StateMachine/MainWindow.xaml.cs
index 66ff5706..25ce241a 100644
--- a/Examples/Nodify.StateMachine/MainWindow.xaml.cs
+++ b/Examples/Nodify.StateMachine/MainWindow.xaml.cs
@@ -14,7 +14,7 @@ public MainWindow()
ConnectorState.EnableToggledConnectingMode = true;
NodifyEditor.EnableCuttingLinePreview = true;
- EditorGestures.Mappings.Connection.Disconnect.Value = MultiGesture.None;
+ EditorGestures.Mappings.Connection.Disconnect.Unbind();
EditorGestures.Mappings.Editor.ZoomModifierKey = ModifierKeys.Control;
EditorGestures.Mappings.Editor.PanWithMouseWheel = true;
}
diff --git a/Nodify/Interactivity/Gestures/EditorGestures.cs b/Nodify/Interactivity/Gestures/EditorGestures.cs
index eeaf35f7..5d112a22 100644
--- a/Nodify/Interactivity/Gestures/EditorGestures.cs
+++ b/Nodify/Interactivity/Gestures/EditorGestures.cs
@@ -96,6 +96,12 @@ public void Apply(SelectionGestures gestures)
Select.Value = gestures.Select.Value;
Cancel.Value = gestures.Cancel.Value;
}
+
+ ///
+ /// Unbinds the all the gestures used for selection.
+ ///
+ public void Unbind()
+ => Apply(None);
}
/// Gestures for the item containers.
diff --git a/Nodify/Interactivity/Gestures/InputGestureRef.cs b/Nodify/Interactivity/Gestures/InputGestureRef.cs
index ffe5227d..faf21e2c 100644
--- a/Nodify/Interactivity/Gestures/InputGestureRef.cs
+++ b/Nodify/Interactivity/Gestures/InputGestureRef.cs
@@ -29,5 +29,11 @@ public static implicit operator InputGestureRef(KeyGesture gesture)
public static implicit operator InputGestureRef(MultiGesture gesture)
=> new InputGestureRef { Value = gesture };
+
+ ///
+ /// Unbinds the current gesture.
+ ///
+ public void Unbind()
+ => Value = MultiGesture.None;
}
}