Skip to content

Commit ba20d13

Browse files
authored
Merge pull request #207 from miroiu/fix/206-select-all-gesture
Add EditorGestures.Editor.SelectAll
2 parents 6109f49 + 962c8b3 commit ba20d13

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
> - Breaking Changes:
66
> - Features:
7+
> - Added EditorGestures.Editor.SelectAll
78
> - Bugfixes:
9+
> - Fixed an issue where the EditorCommands.SelectAll gesture could not be customized
810
911
#### **Version 7.0.1**
1012

Examples/Nodify.Shapes/Canvas/Gestures/UnboundGestureMappings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class UnboundGestureMappings : EditorGestures
99
public UnboundGestureMappings()
1010
{
1111
Editor.Selection.Unbind();
12+
Editor.SelectAll.Unbind();
1213
ItemContainer.Selection.Unbind();
1314
Connection.Disconnect.Unbind();
1415
Connector.Connect.Unbind();

Nodify/Editor/EditorCommands.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ public static class EditorCommands
3030
/// <summary>
3131
/// Select all <see cref="ItemContainer"/>s in the <see cref="NodifyEditor"/>.
3232
/// </summary>
33-
public static RoutedUICommand SelectAll { get; } = ApplicationCommands.SelectAll;
33+
public static RoutedUICommand SelectAll { get; } = new RoutedUICommand(ApplicationCommands.SelectAll.Text, nameof(SelectAll), typeof(EditorCommands), new InputGestureCollection
34+
{
35+
EditorGestures.Mappings.Editor.SelectAll
36+
});
3437

3538
/// <summary>
3639
/// Moves the <see cref="NodifyEditor.ViewportLocation"/> to the specified location.

Nodify/Interactivity/Gestures/EditorGestures.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ public class NodifyEditorGestures
150150
public NodifyEditorGestures()
151151
{
152152
Selection = new SelectionGestures();
153+
SelectAll = (KeyGesture)ApplicationCommands.SelectAll.InputGestures[0];
153154
Cutting = new MouseGesture(MouseAction.LeftClick, ModifierKeys.Alt | ModifierKeys.Shift, true);
154155
PushItems = new MouseGesture(MouseAction.LeftClick, ModifierKeys.Control | ModifierKeys.Shift, true);
155156
Pan = new AnyGesture(new MouseGesture(MouseAction.RightClick), new MouseGesture(MouseAction.MiddleClick));
@@ -167,6 +168,9 @@ public NodifyEditorGestures()
167168
/// <summary>Gesture used to start selecting using a <see cref="SelectionGestures"/> strategy.</summary>
168169
public SelectionGestures Selection { get; }
169170

171+
/// <summary>Gesture used to select all <see cref="Nodify.ItemContainer"/>s in the editor.</summary>
172+
public InputGestureRef SelectAll { get; }
173+
170174
/// <summary>Gesture used to start cutting connections.</summary>
171175
public InputGestureRef Cutting { get; }
172176

@@ -219,6 +223,7 @@ public NodifyEditorGestures()
219223
public void Apply(NodifyEditorGestures gestures)
220224
{
221225
Selection.Apply(gestures.Selection);
226+
SelectAll.Value = gestures.SelectAll.Value;
222227
Cutting.Value = gestures.Cutting.Value;
223228
PushItems.Value = gestures.PushItems.Value;
224229
Pan.Value = gestures.Pan.Value;

0 commit comments

Comments
 (0)