@eclipse-glsp/client 2.4.0-next.409 → 2.4.0-next.413
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/base/default.module.d.ts.map +1 -1
- package/lib/base/default.module.js +3 -0
- package/lib/base/default.module.js.map +1 -1
- package/lib/{features/accessibility/key-shortcut/accessible-key-shortcut.d.ts → base/shortcuts/available-shortcuts-extension.d.ts} +7 -29
- package/lib/base/shortcuts/available-shortcuts-extension.d.ts.map +1 -0
- package/lib/{features/accessibility/key-shortcut/accessible-key-shortcut.js → base/shortcuts/available-shortcuts-extension.js} +20 -36
- package/lib/base/shortcuts/available-shortcuts-extension.js.map +1 -0
- package/lib/{features/accessibility/key-shortcut/accessible-key-shortcut-tool.d.ts → base/shortcuts/available-shortcuts-tool.d.ts} +4 -6
- package/lib/base/shortcuts/available-shortcuts-tool.d.ts.map +1 -0
- package/lib/{features/accessibility/key-shortcut/accessible-key-shortcut-tool.js → base/shortcuts/available-shortcuts-tool.js} +14 -24
- package/lib/base/shortcuts/available-shortcuts-tool.js.map +1 -0
- package/lib/base/shortcuts/shortcuts-manager.d.ts +39 -0
- package/lib/base/shortcuts/shortcuts-manager.d.ts.map +1 -0
- package/lib/base/shortcuts/shortcuts-manager.js +55 -0
- package/lib/base/shortcuts/shortcuts-manager.js.map +1 -0
- package/lib/{features/accessibility/move-zoom/move-zoom-module.d.ts → base/shortcuts/shortcuts-module.d.ts} +7 -5
- package/lib/base/shortcuts/shortcuts-module.d.ts.map +1 -0
- package/lib/{features/accessibility/resize-key-tool/resize-key-module.js → base/shortcuts/shortcuts-module.js} +12 -14
- package/lib/base/shortcuts/shortcuts-module.js.map +1 -0
- package/lib/base/ui-extension/ui-extension.d.ts +3 -1
- package/lib/base/ui-extension/ui-extension.d.ts.map +1 -1
- package/lib/base/ui-extension/ui-extension.js +8 -0
- package/lib/base/ui-extension/ui-extension.js.map +1 -1
- package/lib/default-modules.d.ts +1 -1
- package/lib/default-modules.d.ts.map +1 -1
- package/lib/default-modules.js +3 -1
- package/lib/default-modules.js.map +1 -1
- package/lib/features/accessibility/accessibility-module.d.ts.map +1 -1
- package/lib/features/accessibility/accessibility-module.js +0 -6
- package/lib/features/accessibility/accessibility-module.js.map +1 -1
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.d.ts +8 -10
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.d.ts.map +1 -1
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js +20 -44
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js.map +1 -1
- package/lib/features/accessibility/global-keylistener-tool.d.ts +6 -8
- package/lib/features/accessibility/global-keylistener-tool.d.ts.map +1 -1
- package/lib/features/accessibility/global-keylistener-tool.js +10 -25
- package/lib/features/accessibility/global-keylistener-tool.js.map +1 -1
- package/lib/features/accessibility/search/search-tool.d.ts +7 -10
- package/lib/features/accessibility/search/search-tool.d.ts.map +1 -1
- package/lib/features/accessibility/search/search-tool.js +9 -20
- package/lib/features/accessibility/search/search-tool.js.map +1 -1
- package/lib/features/accessibility/view-key-tools/{zoom-key-tool.d.ts → grid-cell-zoom-key-tool.d.ts} +13 -21
- package/lib/features/accessibility/view-key-tools/grid-cell-zoom-key-tool.d.ts.map +1 -0
- package/lib/features/accessibility/view-key-tools/{zoom-key-tool.js → grid-cell-zoom-key-tool.js} +31 -82
- package/lib/features/accessibility/view-key-tools/grid-cell-zoom-key-tool.js.map +1 -0
- package/lib/features/accessibility/view-key-tools/view-key-tools-module.d.ts.map +1 -1
- package/lib/features/accessibility/view-key-tools/view-key-tools-module.js +7 -7
- package/lib/features/accessibility/view-key-tools/view-key-tools-module.js.map +1 -1
- package/lib/features/bounds/bounds-module.d.ts.map +1 -1
- package/lib/features/bounds/bounds-module.js +4 -0
- package/lib/features/bounds/bounds-module.js.map +1 -1
- package/lib/features/change-bounds/move-element-action.d.ts +52 -0
- package/lib/features/change-bounds/move-element-action.d.ts.map +1 -0
- package/lib/features/change-bounds/move-element-action.js +32 -0
- package/lib/features/change-bounds/move-element-action.js.map +1 -0
- package/lib/features/change-bounds/move-element-handler.d.ts +42 -0
- package/lib/features/change-bounds/move-element-handler.d.ts.map +1 -0
- package/lib/features/{accessibility/move-zoom/move-handler.js → change-bounds/move-element-handler.js} +12 -72
- package/lib/features/change-bounds/move-element-handler.js.map +1 -0
- package/lib/features/change-bounds/move-element-key-listener.d.ts +31 -0
- package/lib/features/change-bounds/move-element-key-listener.d.ts.map +1 -0
- package/lib/features/change-bounds/move-element-key-listener.js +71 -0
- package/lib/features/change-bounds/move-element-key-listener.js.map +1 -0
- package/lib/features/change-bounds/resize/resize-default-tool.d.ts +34 -0
- package/lib/features/change-bounds/resize/resize-default-tool.d.ts.map +1 -0
- package/lib/features/change-bounds/resize/resize-default-tool.js +89 -0
- package/lib/features/change-bounds/resize/resize-default-tool.js.map +1 -0
- package/lib/features/{accessibility/resize-key-tool/resize-key-handler.d.ts → change-bounds/resize/resize-handler.d.ts} +3 -7
- package/lib/features/change-bounds/resize/resize-handler.d.ts.map +1 -0
- package/lib/features/{accessibility/resize-key-tool/resize-key-handler.js → change-bounds/resize/resize-handler.js} +16 -24
- package/lib/features/change-bounds/resize/resize-handler.js.map +1 -0
- package/lib/features/{accessibility/resize-key-tool/resize-key-module.d.ts → change-bounds/resize/resize-module.d.ts} +9 -4
- package/lib/features/change-bounds/resize/resize-module.d.ts.map +1 -0
- package/lib/features/change-bounds/resize/resize-module.js +42 -0
- package/lib/features/change-bounds/resize/resize-module.js.map +1 -0
- package/lib/features/change-bounds/resize/resize-tool.d.ts +37 -0
- package/lib/features/change-bounds/resize/resize-tool.d.ts.map +1 -0
- package/lib/features/change-bounds/resize/resize-tool.js +123 -0
- package/lib/features/change-bounds/resize/resize-tool.js.map +1 -0
- package/lib/features/grid/grid-manager.js +1 -0
- package/lib/features/grid/grid-manager.js.map +1 -1
- package/lib/features/grid/grid-module.d.ts.map +1 -1
- package/lib/features/grid/grid-module.js +2 -1
- package/lib/features/grid/grid-module.js.map +1 -1
- package/lib/features/grid/grid-snapper.d.ts.map +1 -1
- package/lib/features/grid/grid-snapper.js +3 -2
- package/lib/features/grid/grid-snapper.js.map +1 -1
- package/lib/features/grid/grid.d.ts +3 -0
- package/lib/features/grid/grid.d.ts.map +1 -1
- package/lib/features/grid/grid.js +5 -0
- package/lib/features/grid/grid.js.map +1 -1
- package/lib/features/helper-lines/helper-line-manager.js +1 -0
- package/lib/features/helper-lines/helper-line-manager.js.map +1 -1
- package/lib/features/tools/base-tools.d.ts +8 -3
- package/lib/features/tools/base-tools.d.ts.map +1 -1
- package/lib/features/tools/base-tools.js +21 -12
- package/lib/features/tools/base-tools.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts +8 -2
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.js +23 -0
- package/lib/features/tools/change-bounds/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/edge-creation/edge-creation-tool.js +1 -0
- package/lib/features/tools/edge-creation/edge-creation-tool.js.map +1 -1
- package/lib/features/tools/node-creation/node-creation-views.js +1 -0
- package/lib/features/tools/node-creation/node-creation-views.js.map +1 -1
- package/lib/features/viewport/viewport-handler.d.ts +20 -1
- package/lib/features/viewport/viewport-handler.d.ts.map +1 -1
- package/lib/features/viewport/viewport-handler.js +100 -1
- package/lib/features/viewport/viewport-handler.js.map +1 -1
- package/lib/features/viewport/viewport-key-listener.d.ts +36 -0
- package/lib/features/viewport/viewport-key-listener.d.ts.map +1 -0
- package/lib/features/viewport/viewport-key-listener.js +144 -0
- package/lib/features/viewport/viewport-key-listener.js.map +1 -0
- package/lib/features/viewport/viewport-modules.d.ts.map +1 -1
- package/lib/features/viewport/viewport-modules.js +11 -0
- package/lib/features/viewport/viewport-modules.js.map +1 -1
- package/lib/features/viewport/viewport-tool.d.ts +32 -0
- package/lib/features/viewport/viewport-tool.d.ts.map +1 -0
- package/lib/features/viewport/viewport-tool.js +67 -0
- package/lib/features/viewport/viewport-tool.js.map +1 -0
- package/lib/features/viewport/zoom-viewport-action.d.ts +50 -0
- package/lib/features/viewport/zoom-viewport-action.d.ts.map +1 -0
- package/lib/features/viewport/zoom-viewport-action.js +36 -0
- package/lib/features/viewport/zoom-viewport-action.js.map +1 -0
- package/lib/index.d.ts +13 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +13 -11
- package/lib/index.js.map +1 -1
- package/lib/standalone-modules.d.ts +1 -1
- package/lib/standalone-modules.d.ts.map +1 -1
- package/lib/standalone-modules.js +4 -0
- package/lib/standalone-modules.js.map +1 -1
- package/lib/utils/viewpoint-util.js +2 -2
- package/lib/utils/viewpoint-util.js.map +1 -1
- package/package.json +3 -3
- package/src/base/default.module.ts +4 -0
- package/src/{features/accessibility/key-shortcut/accessible-key-shortcut.ts → base/shortcuts/available-shortcuts-extension.ts} +13 -46
- package/src/{features/accessibility/key-shortcut/accessible-key-shortcut-tool.ts → base/shortcuts/available-shortcuts-tool.ts} +9 -15
- package/src/base/shortcuts/shortcuts-manager.ts +64 -0
- package/src/{features/accessibility/resize-key-tool/resize-key-module.ts → base/shortcuts/shortcuts-module.ts} +12 -14
- package/src/base/ui-extension/ui-extension.ts +8 -1
- package/src/default-modules.ts +3 -1
- package/src/features/accessibility/accessibility-module.ts +0 -6
- package/src/features/accessibility/element-navigation/diagram-navigation-tool.ts +26 -50
- package/src/features/accessibility/global-keylistener-tool.ts +11 -28
- package/src/features/accessibility/search/search-tool.ts +15 -33
- package/src/features/accessibility/view-key-tools/{zoom-key-tool.ts → grid-cell-zoom-key-tool.ts} +27 -82
- package/src/features/accessibility/view-key-tools/view-key-tools-module.ts +7 -7
- package/src/features/bounds/bounds-module.ts +6 -0
- package/src/features/change-bounds/move-element-action.ts +55 -0
- package/src/features/{accessibility/move-zoom/move-handler.ts → change-bounds/move-element-handler.ts} +18 -113
- package/src/features/change-bounds/move-element-key-listener.ts +74 -0
- package/src/features/change-bounds/resize/resize-default-tool.ts +75 -0
- package/src/features/{accessibility/resize-key-tool/resize-key-handler.ts → change-bounds/resize/resize-handler.ts} +10 -19
- package/src/features/change-bounds/resize/resize-module.ts +48 -0
- package/src/features/change-bounds/resize/resize-tool.ts +114 -0
- package/src/features/grid/grid-module.ts +2 -1
- package/src/features/grid/grid-snapper.ts +2 -2
- package/src/features/grid/grid.ts +3 -0
- package/src/features/tools/base-tools.ts +12 -6
- package/src/features/tools/change-bounds/change-bounds-tool.ts +25 -1
- package/src/features/viewport/viewport-handler.ts +121 -1
- package/src/features/viewport/viewport-key-listener.ts +121 -0
- package/src/features/viewport/viewport-modules.ts +15 -1
- package/src/features/viewport/viewport-tool.ts +54 -0
- package/src/features/viewport/zoom-viewport-action.ts +54 -0
- package/src/index.ts +13 -11
- package/src/standalone-modules.ts +4 -0
- package/src/utils/viewpoint-util.ts +2 -2
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut-tool.d.ts.map +0 -1
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut-tool.js.map +0 -1
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut.d.ts.map +0 -1
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut.js.map +0 -1
- package/lib/features/accessibility/key-shortcut/shortcut-help-module.d.ts +0 -26
- package/lib/features/accessibility/key-shortcut/shortcut-help-module.d.ts.map +0 -1
- package/lib/features/accessibility/key-shortcut/shortcut-help-module.js +0 -37
- package/lib/features/accessibility/key-shortcut/shortcut-help-module.js.map +0 -1
- package/lib/features/accessibility/move-zoom/move-handler.d.ts +0 -97
- package/lib/features/accessibility/move-zoom/move-handler.d.ts.map +0 -1
- package/lib/features/accessibility/move-zoom/move-handler.js.map +0 -1
- package/lib/features/accessibility/move-zoom/move-zoom-module.d.ts.map +0 -1
- package/lib/features/accessibility/move-zoom/move-zoom-module.js +0 -40
- package/lib/features/accessibility/move-zoom/move-zoom-module.js.map +0 -1
- package/lib/features/accessibility/move-zoom/zoom-handler.d.ts +0 -73
- package/lib/features/accessibility/move-zoom/zoom-handler.d.ts.map +0 -1
- package/lib/features/accessibility/move-zoom/zoom-handler.js +0 -157
- package/lib/features/accessibility/move-zoom/zoom-handler.js.map +0 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-handler.d.ts.map +0 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-handler.js.map +0 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-module.d.ts.map +0 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-module.js.map +0 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-tool.d.ts +0 -47
- package/lib/features/accessibility/resize-key-tool/resize-key-tool.d.ts.map +0 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-tool.js +0 -154
- package/lib/features/accessibility/resize-key-tool/resize-key-tool.js.map +0 -1
- package/lib/features/accessibility/view-key-tools/movement-key-tool.d.ts +0 -53
- package/lib/features/accessibility/view-key-tools/movement-key-tool.d.ts.map +0 -1
- package/lib/features/accessibility/view-key-tools/movement-key-tool.js +0 -156
- package/lib/features/accessibility/view-key-tools/movement-key-tool.js.map +0 -1
- package/lib/features/accessibility/view-key-tools/zoom-key-tool.d.ts.map +0 -1
- package/lib/features/accessibility/view-key-tools/zoom-key-tool.js.map +0 -1
- package/src/features/accessibility/key-shortcut/shortcut-help-module.ts +0 -42
- package/src/features/accessibility/move-zoom/move-zoom-module.ts +0 -44
- package/src/features/accessibility/move-zoom/zoom-handler.ts +0 -182
- package/src/features/accessibility/resize-key-tool/resize-key-tool.ts +0 -139
- package/src/features/accessibility/view-key-tools/movement-key-tool.ts +0 -135
|
@@ -18,9 +18,7 @@ import {
|
|
|
18
18
|
Action,
|
|
19
19
|
GModelElement,
|
|
20
20
|
GModelRoot,
|
|
21
|
-
IActionDispatcher,
|
|
22
21
|
KeyListener,
|
|
23
|
-
KeyTool,
|
|
24
22
|
SelectAction,
|
|
25
23
|
Selectable,
|
|
26
24
|
TYPES,
|
|
@@ -32,40 +30,41 @@ import {
|
|
|
32
30
|
toArray
|
|
33
31
|
} from '@eclipse-glsp/sprotty';
|
|
34
32
|
import { inject, injectable } from 'inversify';
|
|
35
|
-
import {
|
|
33
|
+
import { AvailableShortcutsTool } from '../../../base/shortcuts/available-shortcuts-tool';
|
|
34
|
+
import type { IShortcutManager } from '../../../base/shortcuts/shortcuts-manager';
|
|
35
|
+
import { EnableDefaultToolsAction, EnableToolsAction } from '../../../base/tool-manager/tool';
|
|
36
36
|
import { GEdge } from '../../../model';
|
|
37
37
|
import { SelectableBoundsAware } from '../../../utils/gmodel-util';
|
|
38
|
+
import { BaseTool } from '../../tools/base-tools';
|
|
38
39
|
import { RepositionAction } from '../../viewport/reposition';
|
|
39
|
-
import { SetAccessibleKeyShortcutAction } from '../key-shortcut/accessible-key-shortcut';
|
|
40
|
-
import { AccessibleKeyShortcutTool } from '../key-shortcut/accessible-key-shortcut-tool';
|
|
41
40
|
import { SearchAutocompletePaletteTool } from '../search/search-tool';
|
|
42
41
|
import * as messages from '../toast/messages.json';
|
|
43
42
|
import { ShowToastMessageAction } from '../toast/toast-handler';
|
|
44
43
|
import { ElementNavigator } from './element-navigator';
|
|
45
44
|
|
|
46
45
|
@injectable()
|
|
47
|
-
export class ElementNavigatorTool
|
|
46
|
+
export class ElementNavigatorTool extends BaseTool {
|
|
48
47
|
static ID = 'glsp.diagram-navigation';
|
|
48
|
+
static TOKEN = Symbol.for(ElementNavigatorTool.ID);
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
get id(): string {
|
|
51
|
+
return ElementNavigatorTool.ID;
|
|
52
|
+
}
|
|
51
53
|
|
|
52
|
-
protected
|
|
53
|
-
@inject(KeyTool) protected readonly keytool: KeyTool;
|
|
54
|
+
@inject(TYPES.IShortcutManager) protected readonly shortcutManager: IShortcutManager;
|
|
54
55
|
@inject(TYPES.IElementNavigator) readonly elementNavigator: ElementNavigator;
|
|
55
56
|
@inject(TYPES.ILocalElementNavigator) readonly localElementNavigator: ElementNavigator;
|
|
56
|
-
@inject(TYPES.IActionDispatcher) readonly actionDispatcher: IActionDispatcher;
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
return ElementNavigatorTool.ID;
|
|
60
|
-
}
|
|
58
|
+
protected elementNavigatorKeyListener: ElementNavigatorKeyListener = new ElementNavigatorKeyListener(this);
|
|
61
59
|
|
|
62
60
|
enable(): void {
|
|
63
|
-
this.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
this.toDisposeOnDisable.push(
|
|
62
|
+
this.keyTool.registerListener(this.elementNavigatorKeyListener),
|
|
63
|
+
this.shortcutManager.register(ElementNavigatorTool.TOKEN, [
|
|
64
|
+
{ shortcuts: ['ALT', 'N'], description: 'Activate local navigation mode', group: 'Navigation', position: 0 },
|
|
65
|
+
{ shortcuts: ['N'], description: 'Activate global navigation mode', group: 'Navigation', position: 1 }
|
|
66
|
+
])
|
|
67
|
+
);
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
70
|
|
|
@@ -85,29 +84,6 @@ export class ElementNavigatorKeyListener extends KeyListener {
|
|
|
85
84
|
super();
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
registerShortcutKey(): void {
|
|
89
|
-
this.tool.actionDispatcher.dispatchOnceModelInitialized(
|
|
90
|
-
SetAccessibleKeyShortcutAction.create({
|
|
91
|
-
token: this.token,
|
|
92
|
-
keys: [
|
|
93
|
-
{ shortcuts: ['N'], description: 'Activate default navigation', group: 'Navigation', position: 0 },
|
|
94
|
-
{
|
|
95
|
-
shortcuts: ['ALT', 'N'],
|
|
96
|
-
description: 'Activate position based navigation',
|
|
97
|
-
group: 'Navigation',
|
|
98
|
-
position: 1
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
shortcuts: ['⬅ ⬆ ➡ ⬇'],
|
|
102
|
-
description: 'Navigate by relation or neighbors according to navigation mode',
|
|
103
|
-
group: 'Navigation',
|
|
104
|
-
position: 2
|
|
105
|
-
}
|
|
106
|
-
]
|
|
107
|
-
})
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
87
|
override keyDown(element: GModelElement, event: KeyboardEvent): Action[] {
|
|
112
88
|
this.resetOnEscape(event, element);
|
|
113
89
|
|
|
@@ -130,7 +106,7 @@ export class ElementNavigatorKeyListener extends KeyListener {
|
|
|
130
106
|
this.clean();
|
|
131
107
|
|
|
132
108
|
if (this.mode === NavigationMode.POSITION) {
|
|
133
|
-
this.tool.
|
|
109
|
+
this.tool.dispatchActions([
|
|
134
110
|
EnableDefaultToolsAction.create(),
|
|
135
111
|
ShowToastMessageAction.createWithTimeout({
|
|
136
112
|
id: Symbol.for(ElementNavigatorKeyListener.name),
|
|
@@ -138,7 +114,7 @@ export class ElementNavigatorKeyListener extends KeyListener {
|
|
|
138
114
|
})
|
|
139
115
|
]);
|
|
140
116
|
} else if (this.mode === NavigationMode.DEFAULT) {
|
|
141
|
-
this.tool.
|
|
117
|
+
this.tool.dispatchActions([
|
|
142
118
|
EnableDefaultToolsAction.create(),
|
|
143
119
|
ShowToastMessageAction.createWithTimeout({
|
|
144
120
|
id: Symbol.for(ElementNavigatorKeyListener.name),
|
|
@@ -155,8 +131,8 @@ export class ElementNavigatorKeyListener extends KeyListener {
|
|
|
155
131
|
if (this.matchesActivatePositionNavigation(event)) {
|
|
156
132
|
if (this.mode !== NavigationMode.POSITION) {
|
|
157
133
|
this.clean();
|
|
158
|
-
this.tool.
|
|
159
|
-
EnableToolsAction.create([ElementNavigatorTool.ID, SearchAutocompletePaletteTool.ID,
|
|
134
|
+
this.tool.dispatchActions([
|
|
135
|
+
EnableToolsAction.create([ElementNavigatorTool.ID, SearchAutocompletePaletteTool.ID, AvailableShortcutsTool.ID]),
|
|
160
136
|
ShowToastMessageAction.create({
|
|
161
137
|
id: Symbol.for(ElementNavigatorKeyListener.name),
|
|
162
138
|
message: messages.navigation.local_navigation_mode_activated
|
|
@@ -179,7 +155,7 @@ export class ElementNavigatorKeyListener extends KeyListener {
|
|
|
179
155
|
this.navigator?.clean?.(element.root);
|
|
180
156
|
this.clean();
|
|
181
157
|
this.mode = NavigationMode.NONE;
|
|
182
|
-
this.tool.
|
|
158
|
+
this.tool.dispatchActions([
|
|
183
159
|
EnableDefaultToolsAction.create(),
|
|
184
160
|
ShowToastMessageAction.createWithTimeout({
|
|
185
161
|
id: Symbol.for(ElementNavigatorKeyListener.name),
|
|
@@ -193,8 +169,8 @@ export class ElementNavigatorKeyListener extends KeyListener {
|
|
|
193
169
|
if (this.mode !== NavigationMode.DEFAULT) {
|
|
194
170
|
this.clean();
|
|
195
171
|
|
|
196
|
-
this.tool.
|
|
197
|
-
EnableToolsAction.create([ElementNavigatorTool.ID, SearchAutocompletePaletteTool.ID,
|
|
172
|
+
this.tool.dispatchActions([
|
|
173
|
+
EnableToolsAction.create([ElementNavigatorTool.ID, SearchAutocompletePaletteTool.ID, AvailableShortcutsTool.ID]),
|
|
198
174
|
ShowToastMessageAction.create({
|
|
199
175
|
id: Symbol.for(ElementNavigatorKeyListener.name),
|
|
200
176
|
message: messages.navigation.default_navigation_mode_activated
|
|
@@ -216,7 +192,7 @@ export class ElementNavigatorKeyListener extends KeyListener {
|
|
|
216
192
|
this.navigator?.clean?.(element.root);
|
|
217
193
|
this.clean();
|
|
218
194
|
this.mode = NavigationMode.NONE;
|
|
219
|
-
this.tool.
|
|
195
|
+
this.tool.dispatchActions([
|
|
220
196
|
EnableDefaultToolsAction.create(),
|
|
221
197
|
ShowToastMessageAction.createWithTimeout({
|
|
222
198
|
id: Symbol.for(ElementNavigatorKeyListener.name),
|
|
@@ -13,25 +13,24 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Action,
|
|
16
|
+
import { Action, matchesKeystroke, SetUIExtensionVisibilityAction, TYPES } from '@eclipse-glsp/sprotty';
|
|
17
17
|
import { inject, injectable } from 'inversify';
|
|
18
|
-
import {
|
|
18
|
+
import type { IShortcutManager } from '../../base/shortcuts/shortcuts-manager';
|
|
19
19
|
import { KeyboardGridMetadata, KeyboardNodeGridMetadata } from '../accessibility/keyboard-grid/constants';
|
|
20
20
|
import { ToolPalette } from '../tool-palette/tool-palette';
|
|
21
|
+
import { BaseEditTool } from '../tools/base-tools';
|
|
21
22
|
import { FocusDomAction } from './actions';
|
|
22
|
-
import { AccessibleKeyShortcutProvider, SetAccessibleKeyShortcutAction } from './key-shortcut/accessible-key-shortcut';
|
|
23
23
|
import { KeyboardPointerMetadata } from './keyboard-pointer/constants';
|
|
24
|
-
import { KeyboardToolPalette } from './keyboard-tool-palette/keyboard-tool-palette';
|
|
25
24
|
|
|
26
25
|
@injectable()
|
|
27
|
-
export class GlobalKeyListenerTool
|
|
26
|
+
export class GlobalKeyListenerTool extends BaseEditTool {
|
|
28
27
|
static ID = 'glsp.global-key-listener';
|
|
28
|
+
static TOKEN = Symbol.for(GlobalKeyListenerTool.name);
|
|
29
29
|
|
|
30
|
-
isEditTool = false;
|
|
31
30
|
protected alreadyRegistered = false;
|
|
32
31
|
|
|
33
|
-
@inject(TYPES.
|
|
34
|
-
protected
|
|
32
|
+
@inject(TYPES.IShortcutManager)
|
|
33
|
+
protected readonly shortcutManager: IShortcutManager;
|
|
35
34
|
|
|
36
35
|
get id(): string {
|
|
37
36
|
return GlobalKeyListenerTool.ID;
|
|
@@ -41,28 +40,12 @@ export class GlobalKeyListenerTool implements Tool, AccessibleKeyShortcutProvide
|
|
|
41
40
|
if (!this.alreadyRegistered) {
|
|
42
41
|
this.alreadyRegistered = true;
|
|
43
42
|
document.addEventListener('keyup', this.trigger.bind(this));
|
|
44
|
-
this.registerShortcutKey();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
43
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
registerShortcutKey(): void {
|
|
54
|
-
this.actionDispatcher.onceModelInitialized().then(() => {
|
|
55
|
-
this.actionDispatcher.dispatchAll([
|
|
56
|
-
SetAccessibleKeyShortcutAction.create({
|
|
57
|
-
token: KeyboardToolPalette.name,
|
|
58
|
-
keys: [{ shortcuts: ['ALT', 'P'], description: 'Focus on tool palette', group: 'Tool-Palette', position: 0 }]
|
|
59
|
-
}),
|
|
60
|
-
SetAccessibleKeyShortcutAction.create({
|
|
61
|
-
token: 'Graph',
|
|
62
|
-
keys: [{ shortcuts: ['ALT', 'G'], description: 'Focus on graph', group: 'Graph', position: 0 }]
|
|
63
|
-
})
|
|
44
|
+
this.shortcutManager.register(GlobalKeyListenerTool.TOKEN, [
|
|
45
|
+
{ shortcuts: ['ALT', 'P'], description: 'Focus on tool palette', group: 'Tool-Palette', position: 0 },
|
|
46
|
+
{ shortcuts: ['ALT', 'G'], description: 'Focus on graph', group: 'Graph', position: 0 }
|
|
64
47
|
]);
|
|
65
|
-
}
|
|
48
|
+
}
|
|
66
49
|
}
|
|
67
50
|
|
|
68
51
|
trigger(event: KeyboardEvent): void {
|
|
@@ -14,58 +14,40 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
Action,
|
|
19
|
-
GModelElement,
|
|
20
|
-
IActionDispatcher,
|
|
21
|
-
KeyListener,
|
|
22
|
-
KeyTool,
|
|
23
|
-
matchesKeystroke,
|
|
24
|
-
SetUIExtensionVisibilityAction,
|
|
25
|
-
TYPES
|
|
26
|
-
} from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { Action, GModelElement, KeyListener, matchesKeystroke, SetUIExtensionVisibilityAction, TYPES } from '@eclipse-glsp/sprotty';
|
|
27
18
|
import { inject, injectable } from 'inversify';
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
19
|
+
import type { IShortcutManager } from '../../../base/shortcuts/shortcuts-manager';
|
|
20
|
+
import { BaseTool } from '../../tools/base-tools';
|
|
30
21
|
import { SearchAutocompletePalette } from './search-palette';
|
|
22
|
+
|
|
31
23
|
@injectable()
|
|
32
|
-
export class SearchAutocompletePaletteTool
|
|
24
|
+
export class SearchAutocompletePaletteTool extends BaseTool {
|
|
33
25
|
static readonly ID = 'glsp.search-autocomplete-palette-tool';
|
|
26
|
+
static readonly TOKEN = Symbol.for(SearchAutocompletePaletteTool.ID);
|
|
34
27
|
|
|
35
28
|
protected readonly keyListener = new SearchAutocompletePaletteKeyListener(this);
|
|
36
|
-
@inject(TYPES.
|
|
37
|
-
|
|
29
|
+
@inject(TYPES.IShortcutManager)
|
|
30
|
+
protected readonly shortcutManager: IShortcutManager;
|
|
38
31
|
|
|
39
32
|
get id(): string {
|
|
40
33
|
return SearchAutocompletePaletteTool.ID;
|
|
41
34
|
}
|
|
42
35
|
|
|
43
36
|
enable(): void {
|
|
44
|
-
this.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
this.toDisposeOnDisable.push(
|
|
38
|
+
this.keyTool.registerListener(this.keyListener),
|
|
39
|
+
this.shortcutManager.register(SearchAutocompletePaletteTool.TOKEN, [
|
|
40
|
+
{ shortcuts: ['CTRL', 'F'], description: 'Activate search for elements', group: 'Search', position: 0 }
|
|
41
|
+
])
|
|
42
|
+
);
|
|
50
43
|
}
|
|
51
44
|
}
|
|
52
45
|
|
|
53
|
-
export class SearchAutocompletePaletteKeyListener extends KeyListener
|
|
54
|
-
protected readonly token = SearchAutocompletePalette.name;
|
|
55
|
-
|
|
46
|
+
export class SearchAutocompletePaletteKeyListener extends KeyListener {
|
|
56
47
|
constructor(protected tool: SearchAutocompletePaletteTool) {
|
|
57
48
|
super();
|
|
58
49
|
}
|
|
59
50
|
|
|
60
|
-
registerShortcutKey(): void {
|
|
61
|
-
this.tool.actionDispatcher.dispatchOnceModelInitialized(
|
|
62
|
-
SetAccessibleKeyShortcutAction.create({
|
|
63
|
-
token: this.token,
|
|
64
|
-
keys: [{ shortcuts: ['CTRL', 'F'], description: 'Activate search for elements', group: 'Search', position: 0 }]
|
|
65
|
-
})
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
51
|
override keyDown(element: GModelElement, event: KeyboardEvent): Action[] {
|
|
70
52
|
if (this.matchesSearchActivateKeystroke(event)) {
|
|
71
53
|
return [
|
package/src/features/accessibility/view-key-tools/{zoom-key-tool.ts → grid-cell-zoom-key-tool.ts}
RENAMED
|
@@ -19,9 +19,7 @@ import {
|
|
|
19
19
|
CenterAction,
|
|
20
20
|
GModelElement,
|
|
21
21
|
GModelRoot,
|
|
22
|
-
IActionDispatcher,
|
|
23
22
|
KeyListener,
|
|
24
|
-
KeyTool,
|
|
25
23
|
Point,
|
|
26
24
|
SetViewportAction,
|
|
27
25
|
TYPES,
|
|
@@ -30,14 +28,13 @@ import {
|
|
|
30
28
|
matchesKeystroke
|
|
31
29
|
} from '@eclipse-glsp/sprotty';
|
|
32
30
|
import { inject, injectable } from 'inversify';
|
|
33
|
-
import { EditorContextService } from '../../../base/editor-context-service';
|
|
34
31
|
import { SelectionService } from '../../../base/selection-service';
|
|
35
|
-
import {
|
|
32
|
+
import type { IShortcutManager } from '../../../base/shortcuts/shortcuts-manager';
|
|
36
33
|
import { getAbsolutePositionByPoint } from '../../../utils/viewpoint-util';
|
|
34
|
+
import { BaseTool } from '../../tools/base-tools';
|
|
35
|
+
import type { ZoomFactors } from '../../viewport/zoom-viewport-action';
|
|
37
36
|
import { ElementNavigatorKeyListener } from '../element-navigation/diagram-navigation-tool';
|
|
38
|
-
import { SetAccessibleKeyShortcutAction } from '../key-shortcut/accessible-key-shortcut';
|
|
39
37
|
import { EnableKeyboardGridAction, KeyboardGridCellSelectedAction, KeyboardGridKeyboardEventAction } from '../keyboard-grid/action';
|
|
40
|
-
import { ZoomElementAction, ZoomViewportAction } from '../move-zoom/zoom-handler';
|
|
41
38
|
import * as messages from '../toast/messages.json';
|
|
42
39
|
import { HideToastAction, ShowToastMessageAction } from '../toast/toast-handler';
|
|
43
40
|
|
|
@@ -45,48 +42,42 @@ import { HideToastAction, ShowToastMessageAction } from '../toast/toast-handler'
|
|
|
45
42
|
* Zoom viewport and elements when its focused and arrow keys are hit.
|
|
46
43
|
*/
|
|
47
44
|
@injectable()
|
|
48
|
-
export class
|
|
49
|
-
static ID = 'glsp.zoom-
|
|
45
|
+
export class GridCellZoomTool extends BaseTool {
|
|
46
|
+
static ID = 'glsp.accessibility-grid-cell-zoom-tool';
|
|
47
|
+
static TOKEN = Symbol.for(GridCellZoomTool.name);
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
protected readonly zoomKeyListener = new GridZoomKeyListener(this);
|
|
52
50
|
|
|
53
|
-
protected readonly
|
|
54
|
-
|
|
55
|
-
@inject(KeyTool) protected readonly keytool: KeyTool;
|
|
56
|
-
@inject(TYPES.IActionDispatcher) readonly actionDispatcher: IActionDispatcher;
|
|
51
|
+
@inject(TYPES.IShortcutManager) protected readonly shortcutManager: IShortcutManager;
|
|
52
|
+
@inject(TYPES.ZoomFactors) protected readonly zoomFactors: ZoomFactors;
|
|
57
53
|
@inject(SelectionService) selectionService: SelectionService;
|
|
58
|
-
@inject(EditorContextService)
|
|
59
|
-
protected editorContextService: EditorContextService;
|
|
60
54
|
|
|
61
55
|
get id(): string {
|
|
62
|
-
return
|
|
56
|
+
return GridCellZoomTool.ID;
|
|
63
57
|
}
|
|
64
58
|
|
|
65
59
|
enable(): void {
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
this.toDisposeOnDisable.push(
|
|
61
|
+
this.keyTool.registerListener(this.zoomKeyListener),
|
|
62
|
+
this.shortcutManager.register(GridCellZoomTool.TOKEN, [
|
|
63
|
+
{ shortcuts: ['CTRL', '+'], description: 'Zoom in via Grid', group: 'Zoom', position: 0 }
|
|
64
|
+
])
|
|
65
|
+
);
|
|
72
66
|
}
|
|
73
67
|
|
|
74
68
|
handle(action: Action): Action | void {
|
|
75
|
-
if (isViewport(this.
|
|
69
|
+
if (isViewport(this.editorContext.modelRoot)) {
|
|
76
70
|
let viewportAction: Action | undefined = undefined;
|
|
77
71
|
|
|
78
|
-
if (KeyboardGridCellSelectedAction.is(action) && action.options.originId ===
|
|
72
|
+
if (KeyboardGridCellSelectedAction.is(action) && action.options.originId === GridCellZoomTool.ID) {
|
|
79
73
|
viewportAction = this.zoomKeyListener.setNewZoomFactor(
|
|
80
|
-
this.
|
|
81
|
-
|
|
82
|
-
getAbsolutePositionByPoint(this.
|
|
74
|
+
this.editorContext.modelRoot,
|
|
75
|
+
this.zoomFactors.in,
|
|
76
|
+
getAbsolutePositionByPoint(this.editorContext.modelRoot, action.options.centerCellPosition)
|
|
83
77
|
);
|
|
84
|
-
} else if (KeyboardGridKeyboardEventAction.is(action) && action.options.originId ===
|
|
78
|
+
} else if (KeyboardGridKeyboardEventAction.is(action) && action.options.originId === GridCellZoomTool.ID) {
|
|
85
79
|
if (matchesKeystroke(action.options.event, 'Minus')) {
|
|
86
|
-
viewportAction = this.zoomKeyListener.setNewZoomFactor(
|
|
87
|
-
this.editorContextService.modelRoot,
|
|
88
|
-
ZoomKeyListener.defaultZoomOutFactor
|
|
89
|
-
);
|
|
80
|
+
viewportAction = this.zoomKeyListener.setNewZoomFactor(this.editorContext.modelRoot, this.zoomFactors.out);
|
|
90
81
|
} else if (matchesKeystroke(action.options.event, 'Digit0', 'ctrl')) {
|
|
91
82
|
viewportAction = CenterAction.create([]);
|
|
92
83
|
}
|
|
@@ -102,29 +93,11 @@ export class ZoomKeyTool implements Tool {
|
|
|
102
93
|
}
|
|
103
94
|
}
|
|
104
95
|
|
|
105
|
-
export class
|
|
106
|
-
|
|
107
|
-
static readonly defaultZoomOutFactor = 0.9;
|
|
108
|
-
protected readonly token = ZoomKeyListener.name;
|
|
109
|
-
|
|
110
|
-
constructor(protected tool: ZoomKeyTool) {
|
|
96
|
+
export class GridZoomKeyListener extends KeyListener {
|
|
97
|
+
constructor(protected tool: GridCellZoomTool) {
|
|
111
98
|
super();
|
|
112
99
|
}
|
|
113
100
|
|
|
114
|
-
registerShortcutKey(): void {
|
|
115
|
-
this.tool.actionDispatcher.dispatchOnceModelInitialized(
|
|
116
|
-
SetAccessibleKeyShortcutAction.create({
|
|
117
|
-
token: this.token,
|
|
118
|
-
keys: [
|
|
119
|
-
{ shortcuts: ['+'], description: 'Zoom in to element or viewport', group: 'Zoom', position: 0 },
|
|
120
|
-
{ shortcuts: ['-'], description: 'Zoom out to element or viewport', group: 'Zoom', position: 1 },
|
|
121
|
-
{ shortcuts: ['CTRL', '0'], description: 'Reset zoom to default', group: 'Zoom', position: 2 },
|
|
122
|
-
{ shortcuts: ['CTRL', '+'], description: 'Zoom in via Grid', group: 'Zoom', position: 3 }
|
|
123
|
-
]
|
|
124
|
-
})
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
101
|
setNewZoomFactor(viewport: GModelElement & GModelRoot & Viewport, zoomFactor: number, point?: Point): SetViewportAction {
|
|
129
102
|
let newViewport: Viewport;
|
|
130
103
|
const newZoom = viewport.zoom * zoomFactor;
|
|
@@ -143,16 +116,14 @@ export class ZoomKeyListener extends KeyListener {
|
|
|
143
116
|
zoom: newZoom
|
|
144
117
|
};
|
|
145
118
|
}
|
|
146
|
-
return SetViewportAction.create(viewport.id, newViewport, { animate:
|
|
119
|
+
return SetViewportAction.create(viewport.id, newViewport, { animate: false });
|
|
147
120
|
}
|
|
148
121
|
|
|
149
122
|
override keyDown(element: GModelElement, event: KeyboardEvent): Action[] {
|
|
150
|
-
const selectedElementIds = this.tool.selectionService.getSelectedElementIDs();
|
|
151
|
-
|
|
152
123
|
if (this.matchesZoomViaGrid(event)) {
|
|
153
124
|
return [
|
|
154
125
|
EnableKeyboardGridAction.create({
|
|
155
|
-
originId:
|
|
126
|
+
originId: GridCellZoomTool.ID,
|
|
156
127
|
triggerActions: []
|
|
157
128
|
}),
|
|
158
129
|
|
|
@@ -161,37 +132,11 @@ export class ZoomKeyListener extends KeyListener {
|
|
|
161
132
|
message: messages.grid.zoom_in_grid
|
|
162
133
|
})
|
|
163
134
|
];
|
|
164
|
-
} else if (this.matchesZoomOutKeystroke(event)) {
|
|
165
|
-
if (selectedElementIds.length > 0) {
|
|
166
|
-
return [ZoomElementAction.create(selectedElementIds, ZoomKeyListener.defaultZoomOutFactor)];
|
|
167
|
-
} else {
|
|
168
|
-
return [ZoomViewportAction.create(ZoomKeyListener.defaultZoomOutFactor)];
|
|
169
|
-
}
|
|
170
|
-
} else if (this.matchesZoomInKeystroke(event)) {
|
|
171
|
-
if (selectedElementIds.length > 0) {
|
|
172
|
-
return [ZoomElementAction.create(selectedElementIds, ZoomKeyListener.defaultZoomInFactor)];
|
|
173
|
-
} else {
|
|
174
|
-
return [ZoomViewportAction.create(ZoomKeyListener.defaultZoomInFactor)];
|
|
175
|
-
}
|
|
176
|
-
} else if (this.matchesMinZoomLevelKeystroke(event)) {
|
|
177
|
-
return [CenterAction.create(selectedElementIds)];
|
|
178
135
|
}
|
|
179
136
|
return [];
|
|
180
137
|
}
|
|
181
138
|
|
|
182
|
-
protected matchesZoomInKeystroke(event: KeyboardEvent): boolean {
|
|
183
|
-
/** here event.key is used for '+', as keycode 187 is already declared for 'Equals' in {@link matchesKeystroke}.*/
|
|
184
|
-
return event.key === '+' || matchesKeystroke(event, 'NumpadAdd');
|
|
185
|
-
}
|
|
186
|
-
|
|
187
139
|
protected matchesZoomViaGrid(event: KeyboardEvent): boolean {
|
|
188
140
|
return event.key === '+' && event.ctrlKey;
|
|
189
141
|
}
|
|
190
|
-
protected matchesMinZoomLevelKeystroke(event: KeyboardEvent): boolean {
|
|
191
|
-
return matchesKeystroke(event, 'Digit0', 'ctrl') || matchesKeystroke(event, 'Numpad0', 'ctrl');
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
protected matchesZoomOutKeystroke(event: KeyboardEvent): boolean {
|
|
195
|
-
return matchesKeystroke(event, 'Minus') || matchesKeystroke(event, 'NumpadSubtract');
|
|
196
|
-
}
|
|
197
142
|
}
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
17
|
import { bindAsService, BindingContext, configureActionHandler, FeatureModule, TYPES } from '@eclipse-glsp/sprotty';
|
|
18
|
+
import { viewportModule } from '../../viewport/viewport-modules';
|
|
18
19
|
import { KeyboardGridCellSelectedAction, KeyboardGridKeyboardEventAction } from '../keyboard-grid/action';
|
|
19
20
|
import { DeselectKeyTool } from './deselect-key-tool';
|
|
20
|
-
import {
|
|
21
|
-
import { ZoomKeyTool } from './zoom-key-tool';
|
|
21
|
+
import { GridCellZoomTool } from './grid-cell-zoom-key-tool';
|
|
22
22
|
|
|
23
23
|
export const viewKeyToolsModule = new FeatureModule(
|
|
24
24
|
(bind, _unbind, isBound, rebind) => {
|
|
@@ -26,14 +26,14 @@ export const viewKeyToolsModule = new FeatureModule(
|
|
|
26
26
|
configureViewKeyTools(context);
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
featureId: Symbol('viewKeyTools')
|
|
29
|
+
featureId: Symbol('viewKeyTools'),
|
|
30
|
+
requires: viewportModule
|
|
30
31
|
}
|
|
31
32
|
);
|
|
32
33
|
|
|
33
34
|
export function configureViewKeyTools(context: Pick<BindingContext, 'bind' | 'isBound'>): void {
|
|
34
|
-
bindAsService(context, TYPES.IDefaultTool,
|
|
35
|
-
|
|
36
|
-
configureActionHandler(context,
|
|
37
|
-
configureActionHandler(context, KeyboardGridKeyboardEventAction.KIND, ZoomKeyTool);
|
|
35
|
+
bindAsService(context, TYPES.IDefaultTool, GridCellZoomTool);
|
|
36
|
+
configureActionHandler(context, KeyboardGridCellSelectedAction.KIND, GridCellZoomTool);
|
|
37
|
+
configureActionHandler(context, KeyboardGridKeyboardEventAction.KIND, GridCellZoomTool);
|
|
38
38
|
bindAsService(context, TYPES.IDefaultTool, DeselectKeyTool);
|
|
39
39
|
}
|
|
@@ -23,9 +23,12 @@ import {
|
|
|
23
23
|
TYPES,
|
|
24
24
|
VBoxLayouter,
|
|
25
25
|
bindAsService,
|
|
26
|
+
configureActionHandler,
|
|
26
27
|
configureCommand,
|
|
27
28
|
configureLayout
|
|
28
29
|
} from '@eclipse-glsp/sprotty';
|
|
30
|
+
import { MoveElementRelativeAction } from '../change-bounds/move-element-action';
|
|
31
|
+
import { MoveElementHandler } from '../change-bounds/move-element-handler';
|
|
29
32
|
import { PositionSnapper } from '../change-bounds/position-snapper';
|
|
30
33
|
import { FreeFormLayouter } from './freeform-layout';
|
|
31
34
|
import { GLSPHiddenBoundsUpdater } from './glsp-hidden-bounds-updater';
|
|
@@ -53,6 +56,9 @@ export const boundsModule = new FeatureModule(
|
|
|
53
56
|
configureLayout(context, HBoxLayouter.KIND, HBoxLayouterExt);
|
|
54
57
|
configureLayout(context, FreeFormLayouter.KIND, FreeFormLayouter);
|
|
55
58
|
|
|
59
|
+
bind(MoveElementHandler).toSelf().inSingletonScope();
|
|
60
|
+
configureActionHandler(context, MoveElementRelativeAction.KIND, MoveElementHandler);
|
|
61
|
+
|
|
56
62
|
// backwards compatibility
|
|
57
63
|
// eslint-disable-next-line deprecation/deprecation
|
|
58
64
|
bind(PositionSnapper).toSelf();
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2024 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
import { Action } from '@eclipse-glsp/sprotty';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Action for triggering moving of elements. It is similar to `MoveAction` but is used for moving elements relative
|
|
21
|
+
* to their current position.
|
|
22
|
+
* The corresponding namespace declares the action kind as constant and offers helper functions for type guard checks
|
|
23
|
+
* and creating new `MoveElementRelativeAction`.
|
|
24
|
+
*/
|
|
25
|
+
export interface MoveElementRelativeAction extends Action {
|
|
26
|
+
kind: typeof MoveElementRelativeAction.KIND;
|
|
27
|
+
/**
|
|
28
|
+
* Specifies the elements to be moved in/out
|
|
29
|
+
*/
|
|
30
|
+
elementIds: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Specifies the amount to be moved in the x-axis
|
|
33
|
+
*/
|
|
34
|
+
moveX: number;
|
|
35
|
+
/**
|
|
36
|
+
* Specifies the amount to be moved in the y-axis
|
|
37
|
+
*/
|
|
38
|
+
moveY: number;
|
|
39
|
+
/**
|
|
40
|
+
* Specifies whether we should snap to the grid
|
|
41
|
+
*/
|
|
42
|
+
snap: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export namespace MoveElementRelativeAction {
|
|
46
|
+
export const KIND = 'moveElementRelative';
|
|
47
|
+
|
|
48
|
+
export function is(object: any): object is MoveElementRelativeAction {
|
|
49
|
+
return Action.hasKind(object, KIND);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function create(options: { elementIds: string[]; moveX: number; moveY: number; snap?: boolean }): MoveElementRelativeAction {
|
|
53
|
+
return { kind: KIND, snap: true, ...options };
|
|
54
|
+
}
|
|
55
|
+
}
|