@eclipse-glsp/client 0.10.0-next.ab6a367.154 → 0.10.0-next.bb1c2fd.157
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/action-dispatcher.d.ts +2 -2
- package/lib/base/action-dispatcher.d.ts.map +1 -1
- package/lib/base/action-dispatcher.js +9 -7
- package/lib/base/action-dispatcher.js.map +1 -1
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts +16 -0
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts.map +1 -1
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js +36 -8
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js.map +1 -1
- package/lib/features/hover/di.config.d.ts +1 -1
- package/lib/features/hover/di.config.d.ts.map +1 -1
- package/lib/features/hover/di.config.js +4 -2
- package/lib/features/hover/di.config.js.map +1 -1
- package/lib/features/hover/hover.d.ts +13 -3
- package/lib/features/hover/hover.d.ts.map +1 -1
- package/lib/features/hover/hover.js +21 -1
- package/lib/features/hover/hover.js.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.js +30 -4
- package/lib/features/tool-feedback/creation-tool-feedback.js.map +1 -1
- package/lib/views/compartments.js +1 -1
- package/lib/views/compartments.js.map +1 -1
- package/package.json +3 -3
- package/src/base/action-dispatcher.ts +9 -8
- package/src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts +40 -11
- package/src/features/hover/di.config.ts +4 -2
- package/src/features/hover/hover.ts +26 -2
- package/src/features/tool-feedback/creation-tool-feedback.ts +33 -5
- package/src/views/compartments.tsx +1 -1
|
@@ -19,8 +19,8 @@ import { ActionDispatcher } from 'sprotty';
|
|
|
19
19
|
import { ModelInitializationConstraint } from './model-initialization-constraint';
|
|
20
20
|
export declare class GLSPActionDispatcher extends ActionDispatcher {
|
|
21
21
|
protected readonly timeouts: Map<string, NodeJS.Timeout>;
|
|
22
|
-
protected
|
|
23
|
-
protected
|
|
22
|
+
protected initializedConstraint: boolean;
|
|
23
|
+
protected initializationConstraint: ModelInitializationConstraint;
|
|
24
24
|
initialize(): Promise<void>;
|
|
25
25
|
startModelInitialization(): void;
|
|
26
26
|
onceModelInitialized(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-dispatcher.d.ts","sourceRoot":"","sources":["../../src/base/action-dispatcher.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAoB,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAElF,qBAAa,oBAAqB,SAAQ,gBAAgB;IACtD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAa;
|
|
1
|
+
{"version":3,"file":"action-dispatcher.d.ts","sourceRoot":"","sources":["../../src/base/action-dispatcher.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAoB,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAElF,qBAAa,oBAAqB,SAAQ,gBAAgB;IACtD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAa;IACrE,SAAS,CAAC,qBAAqB,UAAS;IACD,SAAS,CAAC,wBAAwB,EAAE,6BAA6B,CAAC;IAEzG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,wBAAwB,IAAI,IAAI;IAQhC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMvC,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBrD;;;;;;;;;OASG;IACH,YAAY,CAAC,GAAG,SAAS,cAAc,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,EAAE,SAAS,SAAO,EAAE,eAAe,UAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;CA0BhI"}
|
|
@@ -33,22 +33,24 @@ class GLSPActionDispatcher extends sprotty_1.ActionDispatcher {
|
|
|
33
33
|
constructor() {
|
|
34
34
|
super(...arguments);
|
|
35
35
|
this.timeouts = new Map();
|
|
36
|
-
this.
|
|
36
|
+
this.initializedConstraint = false;
|
|
37
37
|
}
|
|
38
38
|
initialize() {
|
|
39
39
|
return super.initialize().then(() => this.startModelInitialization());
|
|
40
40
|
}
|
|
41
41
|
startModelInitialization() {
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
if (!this.initializedConstraint) {
|
|
43
|
+
this.logger.log(this, 'Starting model initialization mode');
|
|
44
|
+
this.initializationConstraint.onInitialized().then(() => this.logger.log(this, 'Model initialization completed'));
|
|
45
|
+
this.initializedConstraint = true;
|
|
46
|
+
}
|
|
45
47
|
}
|
|
46
48
|
onceModelInitialized() {
|
|
47
|
-
return this.
|
|
49
|
+
return this.initializationConstraint.onInitialized();
|
|
48
50
|
}
|
|
49
51
|
dispatch(action) {
|
|
50
52
|
const result = super.dispatch(action);
|
|
51
|
-
this.
|
|
53
|
+
this.initializationConstraint.notifyDispatched(action);
|
|
52
54
|
return result;
|
|
53
55
|
}
|
|
54
56
|
handleAction(action) {
|
|
@@ -106,6 +108,6 @@ class GLSPActionDispatcher extends sprotty_1.ActionDispatcher {
|
|
|
106
108
|
__decorate([
|
|
107
109
|
inversify_1.inject(model_initialization_constraint_1.ModelInitializationConstraint),
|
|
108
110
|
__metadata("design:type", model_initialization_constraint_1.ModelInitializationConstraint)
|
|
109
|
-
], GLSPActionDispatcher.prototype, "
|
|
111
|
+
], GLSPActionDispatcher.prototype, "initializationConstraint", void 0);
|
|
110
112
|
exports.GLSPActionDispatcher = GLSPActionDispatcher;
|
|
111
113
|
//# sourceMappingURL=action-dispatcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-dispatcher.js","sourceRoot":"","sources":["../../src/base/action-dispatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAiG;AACjG,yCAAmC;AACnC,qCAA2C;AAC3C,uFAAkF;AAElF,MAAa,oBAAqB,SAAQ,0BAAgB;IAA1D;;QACuB,aAAQ,GAAgC,IAAI,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"action-dispatcher.js","sourceRoot":"","sources":["../../src/base/action-dispatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAiG;AACjG,yCAAmC;AACnC,qCAA2C;AAC3C,uFAAkF;AAElF,MAAa,oBAAqB,SAAQ,0BAAgB;IAA1D;;QACuB,aAAQ,GAAgC,IAAI,GAAG,EAAE,CAAC;QAC3D,0BAAqB,GAAG,KAAK,CAAC;IAgF5C,CAAC;IA7EG,UAAU;QACN,OAAO,KAAK,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,wBAAwB;QACpB,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE;YAC7B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,oCAAoC,CAAC,CAAC;YAC5D,IA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,EAAE,eAAe,GAAG,KAAK;QAC1G,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACnB,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;SACjE;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QACnC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC9C,IAAI,QAAQ,KAAK,SAAS,EAAE;gBACxB,UAAU;gBACV,YAAY,CAAC,OAAO,CAAC,CAAC;gBACtB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBAEhC,MAAM,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,mBAAmB,GAAG,SAAS,GAAG,KAAK,CAAC;gBACtG,IAAI,eAAe,EAAE;oBACjB,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;iBACjC;qBAAM;oBACH,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;oBACrC,QAAQ,CAAC,OAAO,EAAE,CAAC;iBACtB;aACJ;QACL,CAAC,EAAE,SAAS,CAAC,CAAC;QACd,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAEtC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;CACJ;AA/E0C;IAAtC,kBAAM,CAAC,+DAA6B,CAAC;8BAAqC,+DAA6B;sEAAC;AAH7G,oDAkFC"}
|
|
@@ -4,6 +4,22 @@ export declare class SelectionServiceAwareContextMenuMouseListener extends Mouse
|
|
|
4
4
|
protected readonly contextMenuService: IContextMenuServiceProvider;
|
|
5
5
|
protected readonly menuProvider: ContextMenuProviderRegistry;
|
|
6
6
|
protected selectionService: SelectionService;
|
|
7
|
+
/**
|
|
8
|
+
* Opens the context menu on right-click.
|
|
9
|
+
*/
|
|
7
10
|
mouseDown(target: SModelElement, event: MouseEvent): (Action | Promise<Action>)[];
|
|
11
|
+
/**
|
|
12
|
+
* Opens the context menu.
|
|
13
|
+
*
|
|
14
|
+
* - query the element on the click-target
|
|
15
|
+
* - select the element
|
|
16
|
+
* - query the context menu service and the context menu elements
|
|
17
|
+
* - show the context menu
|
|
18
|
+
* - send a focus state change to indicate that the diagram becomes inactive, once the context menu is shown
|
|
19
|
+
*
|
|
20
|
+
* When the context menu is closed, we focus the diagram element again.
|
|
21
|
+
*/
|
|
22
|
+
protected openContextMenu(event: MouseEvent, target: SModelElement): Promise<Action>[];
|
|
23
|
+
protected focusEventTarget(event: MouseEvent): void;
|
|
8
24
|
}
|
|
9
25
|
//# sourceMappingURL=selection-service-aware-context-menu-mouse-listener.d.ts.map
|
package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-service-aware-context-menu-mouse-listener.d.ts","sourceRoot":"","sources":["../../../src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,MAAM,EACN,2BAA2B,EAE3B,2BAA2B,EAE3B,aAAa,EACb,aAAa,EAEhB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,qBACa,6CAA8C,SAAQ,aAAa;IACrB,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;IAClE,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAC;IAChF,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAElF,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"selection-service-aware-context-menu-mouse-listener.d.ts","sourceRoot":"","sources":["../../../src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,MAAM,EACN,2BAA2B,EAE3B,2BAA2B,EAE3B,aAAa,EACb,aAAa,EAEhB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,qBACa,6CAA8C,SAAQ,aAAa;IACrB,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;IAClE,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAC;IAChF,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAElF;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE;IAOjF;;;;;;;;;;OAUG;IACH,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE;IAetF,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CAOtD"}
|
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SelectionServiceAwareContextMenuMouseListener = void 0;
|
|
13
13
|
/********************************************************************************
|
|
14
|
-
* Copyright (c) 2019-
|
|
14
|
+
* Copyright (c) 2019-2022 EclipseSource and others.
|
|
15
15
|
*
|
|
16
16
|
* This program and the accompanying materials are made available under the
|
|
17
17
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -27,21 +27,49 @@ exports.SelectionServiceAwareContextMenuMouseListener = void 0;
|
|
|
27
27
|
********************************************************************************/
|
|
28
28
|
const inversify_1 = require("inversify");
|
|
29
29
|
const sprotty_1 = require("sprotty");
|
|
30
|
+
const focus_change_action_1 = require("../../base/actions/focus-change-action");
|
|
30
31
|
const types_1 = require("../../base/types");
|
|
31
32
|
const selection_service_1 = require("../select/selection-service");
|
|
32
33
|
let SelectionServiceAwareContextMenuMouseListener = class SelectionServiceAwareContextMenuMouseListener extends sprotty_1.MouseListener {
|
|
34
|
+
/**
|
|
35
|
+
* Opens the context menu on right-click.
|
|
36
|
+
*/
|
|
33
37
|
mouseDown(target, event) {
|
|
34
38
|
if (event.button === 2 && this.contextMenuService && this.menuProvider) {
|
|
35
|
-
|
|
36
|
-
const selectableTarget = sprotty_1.findParentByFeature(target, sprotty_1.isSelectable);
|
|
37
|
-
if (selectableTarget) {
|
|
38
|
-
selectableTarget.selected = true;
|
|
39
|
-
this.selectionService.updateSelection(target.root, [selectableTarget.id], []);
|
|
40
|
-
}
|
|
41
|
-
Promise.all([this.contextMenuService(), this.menuProvider.getItems(target.root, mousePosition)]).then(([menuService, menuItems]) => menuService.show(menuItems, mousePosition));
|
|
39
|
+
return this.openContextMenu(event, target);
|
|
42
40
|
}
|
|
43
41
|
return [];
|
|
44
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Opens the context menu.
|
|
45
|
+
*
|
|
46
|
+
* - query the element on the click-target
|
|
47
|
+
* - select the element
|
|
48
|
+
* - query the context menu service and the context menu elements
|
|
49
|
+
* - show the context menu
|
|
50
|
+
* - send a focus state change to indicate that the diagram becomes inactive, once the context menu is shown
|
|
51
|
+
*
|
|
52
|
+
* When the context menu is closed, we focus the diagram element again.
|
|
53
|
+
*/
|
|
54
|
+
openContextMenu(event, target) {
|
|
55
|
+
const mousePosition = { x: event.x, y: event.y };
|
|
56
|
+
const selectableTarget = sprotty_1.findParentByFeature(target, sprotty_1.isSelectable);
|
|
57
|
+
if (selectableTarget) {
|
|
58
|
+
selectableTarget.selected = true;
|
|
59
|
+
this.selectionService.updateSelection(target.root, [selectableTarget.id], []);
|
|
60
|
+
}
|
|
61
|
+
const result = Promise.all([this.contextMenuService(), this.menuProvider.getItems(target.root, mousePosition)])
|
|
62
|
+
.then(([menuService, menuItems]) => menuService.show(menuItems, mousePosition, () => this.focusEventTarget(event)))
|
|
63
|
+
.then(() => new focus_change_action_1.FocusStateChangedAction(false));
|
|
64
|
+
return [result];
|
|
65
|
+
}
|
|
66
|
+
focusEventTarget(event) {
|
|
67
|
+
const targetElement = event.target instanceof SVGElement ? event.target : undefined;
|
|
68
|
+
const svgParentElement = targetElement === null || targetElement === void 0 ? void 0 : targetElement.closest('svg');
|
|
69
|
+
if (svgParentElement) {
|
|
70
|
+
svgParentElement.focus();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
45
73
|
};
|
|
46
74
|
__decorate([
|
|
47
75
|
inversify_1.inject(sprotty_1.TYPES.IContextMenuServiceProvider),
|
package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-service-aware-context-menu-mouse-listener.js","sourceRoot":"","sources":["../../../src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAAyD;AACzD,qCASiB;
|
|
1
|
+
{"version":3,"file":"selection-service-aware-context-menu-mouse-listener.js","sourceRoot":"","sources":["../../../src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAAyD;AACzD,qCASiB;AACjB,gFAAiF;AACjF,4CAA8C;AAC9C,mEAA+D;AAG/D,IAAa,6CAA6C,GAA1D,MAAa,6CAA8C,SAAQ,uBAAa;IAK5E;;OAEG;IACH,SAAS,CAAC,MAAqB,EAAE,KAAiB;QAC9C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,I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CAAC;QACpF,MAAM,gBAAgB,GAAG,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACvD,IAAI,gBAAgB,EAAE;YAClB,gBAAgB,CAAC,KAAK,EAAE,CAAC;SAC5B;IACL,CAAC;CACJ,CAAA;AA/C0D;IAAtD,kBAAM,CAAC,eAAK,CAAC,2BAA2B,CAAC;IAAE,oBAAQ,EAAE;;yFAAoE;AAClE;IAAvD,kBAAM,CAAC,eAAK,CAAC,4BAA4B,CAAC;IAAE,oBAAQ,EAAE;8BAAkC,qCAA2B;mFAAC;AAChF;IAApC,kBAAM,CAAC,kBAAU,CAAC,gBAAgB,CAAC;8BAA6B,oCAAgB;uFAAC;AAHzE,6CAA6C;IADzD,sBAAU,EAAE;GACA,6CAA6C,CAgDzD;AAhDY,sGAA6C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"di.config.d.ts","sourceRoot":"","sources":["../../../src/features/hover/di.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAoB5C,QAAA,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"di.config.d.ts","sourceRoot":"","sources":["../../../src/features/hover/di.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAoB5C,QAAA,MAAM,eAAe,iBAwBnB,CAAC;AAEH,eAAe,eAAe,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/********************************************************************************
|
|
4
|
-
* Copyright (c) 2020-
|
|
4
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
5
5
|
*
|
|
6
6
|
* This program and the accompanying materials are made available under the
|
|
7
7
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -22,7 +22,8 @@ const focus_change_action_1 = require("../../base/actions/focus-change-action");
|
|
|
22
22
|
const hover_1 = require("./hover");
|
|
23
23
|
const glspHoverModule = new inversify_1.ContainerModule((bind, _unbind, isBound) => {
|
|
24
24
|
bind(sprotty_1.TYPES.PopupVNodePostprocessor).to(popup_position_updater_1.PopupPositionUpdater).inSingletonScope();
|
|
25
|
-
bind(
|
|
25
|
+
bind(hover_1.GlspHoverMouseListener).toSelf().inSingletonScope();
|
|
26
|
+
bind(sprotty_1.TYPES.MouseListener).toService(hover_1.GlspHoverMouseListener);
|
|
26
27
|
bind(sprotty_1.TYPES.PopupMouseListener).to(sprotty_1.PopupHoverMouseListener);
|
|
27
28
|
bind(sprotty_1.TYPES.KeyListener).to(sprotty_1.HoverKeyListener);
|
|
28
29
|
bind(sprotty_1.TYPES.HoverState).toConstantValue({
|
|
@@ -41,6 +42,7 @@ const glspHoverModule = new inversify_1.ContainerModule((bind, _unbind, isBound)
|
|
|
41
42
|
sprotty_1.configureActionHandler(context, sprotty_1.SetViewportCommand.KIND, sprotty_1.ClosePopupActionHandler);
|
|
42
43
|
sprotty_1.configureActionHandler(context, sprotty_1.MoveCommand.KIND, sprotty_1.ClosePopupActionHandler);
|
|
43
44
|
sprotty_1.configureActionHandler(context, focus_change_action_1.FocusStateChangedAction.KIND, sprotty_1.ClosePopupActionHandler);
|
|
45
|
+
sprotty_1.configureActionHandler(context, focus_change_action_1.FocusStateChangedAction.KIND, hover_1.GlspHoverMouseListener);
|
|
44
46
|
});
|
|
45
47
|
exports.default = glspHoverModule;
|
|
46
48
|
//# sourceMappingURL=di.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"di.config.js","sourceRoot":"","sources":["../../../src/features/hover/di.config.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAA4C;AAC5C,qCAciB;AACjB,8FAAyF;AACzF,gFAAiF;AACjF,mCAAiD;AAEjD,MAAM,eAAe,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IACnE,IAAI,CAAC,eAAK,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC,6CAAoB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAChF,IAAI,CAAC,eAAK,CAAC,aAAa,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"di.config.js","sourceRoot":"","sources":["../../../src/features/hover/di.config.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAA4C;AAC5C,qCAciB;AACjB,8FAAyF;AACzF,gFAAiF;AACjF,mCAAiD;AAEjD,MAAM,eAAe,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IACnE,IAAI,CAAC,eAAK,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC,6CAAoB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAChF,IAAI,CAAC,8BAAsB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACzD,IAAI,CAAC,eAAK,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,8BAAsB,CAAC,CAAC;IAC5D,IAAI,CAAC,eAAK,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,iCAAuB,CAAC,CAAC;IAC3D,IAAI,CAAC,eAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,0BAAgB,CAAC,CAAC;IAC7C,IAAI,CAAa,eAAK,CAAC,UAAU,CAAC,CAAC,eAAe,CAAC;QAC/C,cAAc,EAAE,SAAS;QACzB,aAAa,EAAE,SAAS;QACxB,SAAS,EAAE,KAAK;QAChB,oBAAoB,EAAE,SAAS;KAClC,CAAC,CAAC;IACH,IAAI,CAAC,iCAAuB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAE1D,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAClC,0BAAgB,CAAC,OAAO,EAAE,8BAAoB,CAAC,CAAC;IAChD,0BAAgB,CAAC,OAAO,EAAE,8BAAoB,CAAC,CAAC;IAChD,gCAAsB,CAAC,OAAO,EAAE,8BAAoB,CAAC,IAAI,EAAE,iCAAuB,CAAC,CAAC;IACpF,gCAAsB,CAAC,OAAO,EAAE,4BAAkB,CAAC,IAAI,EAAE,iCAAuB,CAAC,CAAC;IAClF,gCAAsB,CAAC,OAAO,EAAE,uBAAa,CAAC,IAAI,EAAE,iCAAuB,CAAC,CAAC;IAC7E,gCAAsB,CAAC,OAAO,EAAE,4BAAkB,CAAC,IAAI,EAAE,iCAAuB,CAAC,CAAC;IAClF,gCAAsB,CAAC,OAAO,EAAE,qBAAW,CAAC,IAAI,EAAE,iCAAuB,CAAC,CAAC;IAC3E,gCAAsB,CAAC,OAAO,EAAE,6CAAuB,CAAC,IAAI,EAAE,iCAAuB,CAAC,CAAC;IACvF,gCAAsB,CAAC,OAAO,EAAE,6CAAuB,CAAC,IAAI,EAAE,8BAAsB,CAAC,CAAC;AAC1F,CAAC,CAAC,CAAC;AAEH,kBAAe,eAAe,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -14,9 +14,19 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { Action, Bounds } from '@eclipse-glsp/protocol';
|
|
17
|
-
import { HoverMouseListener, SIssueMarker, SIssueSeverity, SModelElement, SModelElementSchema, SModelRootSchema } from 'sprotty';
|
|
17
|
+
import { HoverMouseListener, IActionHandler, ICommand, SIssueMarker, SIssueSeverity, SModelElement, SModelElementSchema, SModelRootSchema } from 'sprotty';
|
|
18
18
|
import { GIssueMarker } from '../validation/issue-marker';
|
|
19
|
-
export declare class GlspHoverMouseListener extends HoverMouseListener {
|
|
19
|
+
export declare class GlspHoverMouseListener extends HoverMouseListener implements IActionHandler {
|
|
20
|
+
/**
|
|
21
|
+
* Stops mouse over timer and remove hover feedback, if focus is lost.
|
|
22
|
+
*
|
|
23
|
+
* This fixes strange effects that appear if the mouse left the element via e.g. a context menu,
|
|
24
|
+
* which explicitly removes the focus of the diagram.
|
|
25
|
+
* @see SelectionServiceAwareContextMenuMouseListener
|
|
26
|
+
* @param action should be a `FocusStateChangedAction`
|
|
27
|
+
* @returns a `HoverFeedbackAction` resetting the state, if the specified action indicates lost focus
|
|
28
|
+
*/
|
|
29
|
+
handle(action: Action): void | Action | ICommand;
|
|
20
30
|
protected startMouseOverTimer(target: SModelElement, event: MouseEvent): Promise<Action>;
|
|
21
31
|
protected createPopupModel(marker: GIssueMarker, bounds: Bounds): SModelRootSchema;
|
|
22
32
|
protected createMarkerIssuePopup(marker: GIssueMarker): SModelElementSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../../src/features/hover/hover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAgD,MAAM,wBAAwB,CAAC;AAEtG,OAAO,
|
|
1
|
+
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../../src/features/hover/hover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAgD,MAAM,wBAAwB,CAAC;AAEtG,OAAO,EAGH,kBAAkB,EAClB,cAAc,EACd,QAAQ,EAER,YAAY,EACZ,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EACnB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,qBACa,sBAAuB,SAAQ,kBAAmB,YAAW,cAAc;IACpF;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ;IAWhD,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBxF,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB;IAYlF,SAAS,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,GAAG,mBAAmB;IAS3E,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;IAI1D,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CAGjD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,cAAc,CAWhE"}
|
|
@@ -8,7 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.getSeverity = exports.GlspHoverMouseListener = void 0;
|
|
10
10
|
/********************************************************************************
|
|
11
|
-
* Copyright (c) 2020-
|
|
11
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
12
12
|
*
|
|
13
13
|
* This program and the accompanying materials are made available under the
|
|
14
14
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -25,8 +25,28 @@ exports.getSeverity = exports.GlspHoverMouseListener = void 0;
|
|
|
25
25
|
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
26
26
|
const inversify_1 = require("inversify");
|
|
27
27
|
const sprotty_1 = require("sprotty");
|
|
28
|
+
const focus_change_action_1 = require("../../base/actions/focus-change-action");
|
|
28
29
|
const issue_marker_1 = require("../validation/issue-marker");
|
|
29
30
|
let GlspHoverMouseListener = class GlspHoverMouseListener extends sprotty_1.HoverMouseListener {
|
|
31
|
+
/**
|
|
32
|
+
* Stops mouse over timer and remove hover feedback, if focus is lost.
|
|
33
|
+
*
|
|
34
|
+
* This fixes strange effects that appear if the mouse left the element via e.g. a context menu,
|
|
35
|
+
* which explicitly removes the focus of the diagram.
|
|
36
|
+
* @see SelectionServiceAwareContextMenuMouseListener
|
|
37
|
+
* @param action should be a `FocusStateChangedAction`
|
|
38
|
+
* @returns a `HoverFeedbackAction` resetting the state, if the specified action indicates lost focus
|
|
39
|
+
*/
|
|
40
|
+
handle(action) {
|
|
41
|
+
if (focus_change_action_1.isFocusStateChangedAction(action) && !action.hasFocus) {
|
|
42
|
+
this.stopMouseOverTimer();
|
|
43
|
+
if (this.lastHoverFeedbackElementId) {
|
|
44
|
+
const previousTargetId = this.lastHoverFeedbackElementId;
|
|
45
|
+
this.lastHoverFeedbackElementId = undefined;
|
|
46
|
+
return new sprotty_1.HoverFeedbackAction(previousTargetId, false);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
30
50
|
startMouseOverTimer(target, event) {
|
|
31
51
|
this.stopMouseOverTimer();
|
|
32
52
|
return new Promise(resolve => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover.js","sourceRoot":"","sources":["../../../src/features/hover/hover.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAsG;AACtG,yCAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"hover.js","sourceRoot":"","sources":["../../../src/features/hover/hover.ts"],"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lC,sBAAU,EAAE;GACA,sBAAsB,CAkElC;AAlEY,wDAAsB;AAoEnC,SAAgB,WAAW,CAAC,MAAoB;IAC5C,IAAI,eAAe,GAAmB,MAAM,CAAC;IAC7C,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE;QACvD,IAAI,QAAQ,KAAK,OAAO,EAAE;YACtB,OAAO,QAAQ,CAAC;SACnB;QACD,IAAI,QAAQ,KAAK,SAAS,IAAI,eAAe,KAAK,MAAM,EAAE;YACtD,eAAe,GAAG,QAAQ,CAAC;SAC9B;KACJ;IACD,OAAO,eAAe,CAAC;AAC3B,CAAC;AAXD,kCAWC"}
|
|
@@ -49,7 +49,7 @@ export declare class FeedbackEdgeEndMovingMouseListener extends MouseListener {
|
|
|
49
49
|
protected anchorRegistry: AnchorComputerRegistry;
|
|
50
50
|
constructor(anchorRegistry: AnchorComputerRegistry);
|
|
51
51
|
mouseMove(target: SModelElement, event: MouseEvent): Action[];
|
|
52
|
-
protected computeAbsoluteAnchor(element: SConnectableElement,
|
|
52
|
+
protected computeAbsoluteAnchor(element: SConnectableElement, absoluteReferencePoint: Point, offset?: number): Point;
|
|
53
53
|
}
|
|
54
54
|
export declare function feedbackEdgeId(root: SModelRoot): string;
|
|
55
55
|
export declare function feedbackEdgeEndId(root: SModelRoot): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creation-tool-feedback.d.ts","sourceRoot":"","sources":["../../../src/features/tool-feedback/creation-tool-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAEH,sBAAsB,EAEtB,uBAAuB,EACvB,aAAa,EAMb,aAAa,EAIb,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,aAAa,EACb,UAAU,EAC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AQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM;IACvB,YAAY,EAAE,gBAAgB,GAAG,SAAS;aACjC,IAAI,EAAE,MAAM;IALhC,MAAM,CAAC,QAAQ,CAAC,IAAI,uBAAuB;gBAE9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACvB,YAAY,GAAE,gBAAgB,GAAG,SAAqB,EAC7C,IAAI,GAAE,MAA6B;CAI1D;AAED,qBAAa,kCAAmC,SAAQ,aAAa;IACrD,SAAS,CAAC,cAAc,EAAE,sBAAsB;gBAAtC,cAAc,EAAE,sBAAsB;IAI5D,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE;IAyB7D,SAAS,CAAC,qBAAqB,CAAC,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK;CAevH;AA6BD,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEvD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAE1D;AAED,eAAO,MAAM,yBAAyB,EAAE,WAGxB,CAAC;AAEjB,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,uBAAuB,EAChC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,WAAW,GAChC,IAAI,CA2BN;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CASzD"}
|
|
@@ -86,9 +86,9 @@ class FeedbackEdgeEndMovingMouseListener extends sprotty_1.MouseListener {
|
|
|
86
86
|
}
|
|
87
87
|
const edge = edgeEnd.feedbackEdge;
|
|
88
88
|
const position = viewpoint_util_1.getAbsolutePosition(edgeEnd, event);
|
|
89
|
-
const endAtMousePosition = sprotty_1.findChildrenAtPosition(target.root, position).find(element => sprotty_1.isConnectable(element) && element.canConnect(edge, 'target'));
|
|
89
|
+
const endAtMousePosition = sprotty_1.findChildrenAtPosition(target.root, position).reverse().find(element => sprotty_1.isConnectable(element) && element.canConnect(edge, 'target'));
|
|
90
90
|
if (endAtMousePosition instanceof sprotty_1.SConnectableElement && edge.source && sprotty_1.isBoundsAware(edge.source)) {
|
|
91
|
-
const anchor = this.computeAbsoluteAnchor(endAtMousePosition, sprotty_1.center(edge.source
|
|
91
|
+
const anchor = this.computeAbsoluteAnchor(endAtMousePosition, sprotty_1.center(viewpoint_util_1.toAbsoluteBounds(edge.source)));
|
|
92
92
|
if (sprotty_1.euclideanDistance(anchor, edgeEnd.position) > 1) {
|
|
93
93
|
return [new sprotty_1.MoveAction([{ elementId: edgeEnd.id, toPosition: anchor }], false)];
|
|
94
94
|
}
|
|
@@ -98,9 +98,10 @@ class FeedbackEdgeEndMovingMouseListener extends sprotty_1.MouseListener {
|
|
|
98
98
|
}
|
|
99
99
|
return [];
|
|
100
100
|
}
|
|
101
|
-
computeAbsoluteAnchor(element,
|
|
101
|
+
computeAbsoluteAnchor(element, absoluteReferencePoint, offset) {
|
|
102
|
+
const referencePointInParent = absoluteToParent(element, absoluteReferencePoint);
|
|
102
103
|
const anchorComputer = this.anchorRegistry.get(sprotty_1.PolylineEdgeRouter.KIND, element.anchorKind);
|
|
103
|
-
let anchor = anchorComputer.getAnchor(element,
|
|
104
|
+
let anchor = anchorComputer.getAnchor(element, referencePointInParent, offset);
|
|
104
105
|
// The anchor is computed in the local coordinate system of the element.
|
|
105
106
|
// If the element is a nested child element we have to add the absolute position of its parent to the anchor.
|
|
106
107
|
if (element.parent !== element.root) {
|
|
@@ -114,6 +115,31 @@ class FeedbackEdgeEndMovingMouseListener extends sprotty_1.MouseListener {
|
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
exports.FeedbackEdgeEndMovingMouseListener = FeedbackEdgeEndMovingMouseListener;
|
|
118
|
+
/**
|
|
119
|
+
* Convert a point, specified in absolute coordinates, to a point relative
|
|
120
|
+
* to the parent of the specified child element.
|
|
121
|
+
* @param element the child element
|
|
122
|
+
* @param absolutePoint a point in absolute coordinates
|
|
123
|
+
* @returns the equivalent point, relative to the element's parent coordinates
|
|
124
|
+
*/
|
|
125
|
+
function absoluteToParent(element, absolutePoint) {
|
|
126
|
+
if (sprotty_1.isBoundsAware(element.parent)) {
|
|
127
|
+
return absoluteToLocal(element.parent, absolutePoint);
|
|
128
|
+
}
|
|
129
|
+
// If the parent is not bounds-aware, assume it's at 0; 0 and proceed
|
|
130
|
+
return absoluteToLocal(element, absolutePoint);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Convert a point, specified in absolute coordinates, to a point relative
|
|
134
|
+
* to the specified element.
|
|
135
|
+
* @param element the element
|
|
136
|
+
* @param absolutePoint a point in absolute coordinates
|
|
137
|
+
* @returns the equivalent point, relative to the element's coordinates
|
|
138
|
+
*/
|
|
139
|
+
function absoluteToLocal(element, absolutePoint) {
|
|
140
|
+
const absoluteElementBounds = viewpoint_util_1.toAbsoluteBounds(element);
|
|
141
|
+
return { x: absolutePoint.x - absoluteElementBounds.x, y: absolutePoint.y - absoluteElementBounds.y };
|
|
142
|
+
}
|
|
117
143
|
function feedbackEdgeId(root) {
|
|
118
144
|
return root.id + '_feedback_edge';
|
|
119
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creation-tool-feedback.js","sourceRoot":"","sources":["../../../src/features/tool-feedback/creation-tool-feedback.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgBA,yCAA+C;AAC/C,qCAsBiB;AACjB,
|
|
1
|
+
{"version":3,"file":"creation-tool-feedback.js","sourceRoot":"","sources":["../../../src/features/tool-feedback/creation-tool-feedback.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgBA,yCAA+C;AAC/C,qCAsBiB;AACjB,yDAA8E;AAC9E,+DAAuG;AACvG,mCAA0C;AAE1C,MAAa,sBAAsB;IAC/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AAC,CAAC;KAC7B;IACD,IAAI,eAAe,YAAY,uBAAa,EAAE;QAC1C,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;KAChC;AACL,CAAC;AATD,gDASC"}
|
|
@@ -32,7 +32,7 @@ let StructureCompartmentView = class StructureCompartmentView extends lib_1.Shap
|
|
|
32
32
|
return undefined;
|
|
33
33
|
}
|
|
34
34
|
return (JSX.createElement("g", null,
|
|
35
|
-
JSX.createElement("rect", { "class-sprotty-comp": true, "class-debug":
|
|
35
|
+
JSX.createElement("rect", { "class-sprotty-comp": true, "class-debug": false, x: '0', y: '0', width: model.size.width, height: model.size.height }),
|
|
36
36
|
context.renderChildren(model)));
|
|
37
37
|
}
|
|
38
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compartments.js","sourceRoot":"","sources":["../../src/views/compartments.tsx"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAAuC;AAEvC,qCAAyG;AAEzG,6DAA6D;AAC7D,MAAM,GAAG,GAAG,EAAE,aAAa,EAAE,SAAG,EAAE,CAAC;AAGnC,IAAa,wBAAwB,GAArC,MAAa,wBAAyB,SAAQ,eAAS;IACnD,MAAM,CAAC,KAA2D,EAAE,OAAyB;QACzF,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE;YACjC,OAAO,SAAS,CAAC;SACpB;QAED,OAAO,CACH;YACI,kDAA0B,IAAI,iBAAe,
|
|
1
|
+
{"version":3,"file":"compartments.js","sourceRoot":"","sources":["../../src/views/compartments.tsx"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAAuC;AAEvC,qCAAyG;AAEzG,6DAA6D;AAC7D,MAAM,GAAG,GAAG,EAAE,aAAa,EAAE,SAAG,EAAE,CAAC;AAGnC,IAAa,wBAAwB,GAArC,MAAa,wBAAyB,SAAQ,eAAS;IACnD,MAAM,CAAC,KAA2D,EAAE,OAAyB;QACzF,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE;YACjC,OAAO,SAAS,CAAC;SACpB;QAED,OAAO,CACH;YACI,kDAA0B,IAAI,iBAAe,KAAK,EAAE,CAAC,EAAC,GAAG,EAAC,CAAC,EAAC,GAAG,EAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,GAAS;YAC1H,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAC9B,CACP,CAAC;IACN,CAAC;CACJ,CAAA;AAbY,wBAAwB;IADpC,sBAAU,EAAE;GACA,wBAAwB,CAapC;AAbY,4DAAwB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/client",
|
|
3
|
-
"version": "0.10.0-next.
|
|
3
|
+
"version": "0.10.0-next.bb1c2fd.157+bb1c2fd",
|
|
4
4
|
"description": "A sprotty-based client for GLSP",
|
|
5
5
|
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
|
|
6
6
|
"keywords": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"css"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@eclipse-glsp/protocol": "0.10.0-next.
|
|
37
|
+
"@eclipse-glsp/protocol": "0.10.0-next.bb1c2fd.157+bb1c2fd",
|
|
38
38
|
"autocompleter": "5.1.0",
|
|
39
39
|
"sprotty": "0.10.0"
|
|
40
40
|
},
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
},
|
|
68
68
|
"main": "lib/index",
|
|
69
69
|
"types": "lib/index",
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "bb1c2fd0120feb99965b33b6fdf57fcb7fe0d62d"
|
|
71
71
|
}
|
|
@@ -20,27 +20,28 @@ import { ModelInitializationConstraint } from './model-initialization-constraint
|
|
|
20
20
|
|
|
21
21
|
export class GLSPActionDispatcher extends ActionDispatcher {
|
|
22
22
|
protected readonly timeouts: Map<string, NodeJS.Timeout> = new Map();
|
|
23
|
-
|
|
24
|
-
@inject(ModelInitializationConstraint) protected
|
|
25
|
-
protected onModelInitialized: Promise<void> = Promise.resolve();
|
|
23
|
+
protected initializedConstraint = false;
|
|
24
|
+
@inject(ModelInitializationConstraint) protected initializationConstraint: ModelInitializationConstraint;
|
|
26
25
|
|
|
27
26
|
initialize(): Promise<void> {
|
|
28
27
|
return super.initialize().then(() => this.startModelInitialization());
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
startModelInitialization(): void {
|
|
32
|
-
this.
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
if (!this.initializedConstraint) {
|
|
32
|
+
this.logger.log(this, 'Starting model initialization mode');
|
|
33
|
+
this.initializationConstraint.onInitialized().then(() => this.logger.log(this, 'Model initialization completed'));
|
|
34
|
+
this.initializedConstraint = true;
|
|
35
|
+
}
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
onceModelInitialized(): Promise<void> {
|
|
38
|
-
return this.
|
|
39
|
+
return this.initializationConstraint.onInitialized();
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
dispatch(action: Action): Promise<void> {
|
|
42
43
|
const result = super.dispatch(action);
|
|
43
|
-
this.
|
|
44
|
+
this.initializationConstraint.notifyDispatched(action);
|
|
44
45
|
return result;
|
|
45
46
|
}
|
|
46
47
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
SModelElement,
|
|
25
25
|
TYPES
|
|
26
26
|
} from 'sprotty';
|
|
27
|
-
|
|
27
|
+
import { FocusStateChangedAction } from '../../base/actions/focus-change-action';
|
|
28
28
|
import { GLSP_TYPES } from '../../base/types';
|
|
29
29
|
import { SelectionService } from '../select/selection-service';
|
|
30
30
|
|
|
@@ -34,18 +34,47 @@ export class SelectionServiceAwareContextMenuMouseListener extends MouseListener
|
|
|
34
34
|
@inject(TYPES.IContextMenuProviderRegistry) @optional() protected readonly menuProvider: ContextMenuProviderRegistry;
|
|
35
35
|
@inject(GLSP_TYPES.SelectionService) protected selectionService: SelectionService;
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Opens the context menu on right-click.
|
|
39
|
+
*/
|
|
37
40
|
mouseDown(target: SModelElement, event: MouseEvent): (Action | Promise<Action>)[] {
|
|
38
41
|
if (event.button === 2 && this.contextMenuService && this.menuProvider) {
|
|
39
|
-
|
|
40
|
-
const selectableTarget = findParentByFeature(target, isSelectable);
|
|
41
|
-
if (selectableTarget) {
|
|
42
|
-
selectableTarget.selected = true;
|
|
43
|
-
this.selectionService.updateSelection(target.root, [selectableTarget.id], []);
|
|
44
|
-
}
|
|
45
|
-
Promise.all([this.contextMenuService(), this.menuProvider.getItems(target.root, mousePosition)]).then(
|
|
46
|
-
([menuService, menuItems]) => menuService.show(menuItems, mousePosition)
|
|
47
|
-
);
|
|
42
|
+
return this.openContextMenu(event, target);
|
|
48
43
|
}
|
|
49
44
|
return [];
|
|
50
45
|
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Opens the context menu.
|
|
49
|
+
*
|
|
50
|
+
* - query the element on the click-target
|
|
51
|
+
* - select the element
|
|
52
|
+
* - query the context menu service and the context menu elements
|
|
53
|
+
* - show the context menu
|
|
54
|
+
* - send a focus state change to indicate that the diagram becomes inactive, once the context menu is shown
|
|
55
|
+
*
|
|
56
|
+
* When the context menu is closed, we focus the diagram element again.
|
|
57
|
+
*/
|
|
58
|
+
protected openContextMenu(event: MouseEvent, target: SModelElement): Promise<Action>[] {
|
|
59
|
+
const mousePosition = { x: event.x, y: event.y };
|
|
60
|
+
const selectableTarget = findParentByFeature(target, isSelectable);
|
|
61
|
+
if (selectableTarget) {
|
|
62
|
+
selectableTarget.selected = true;
|
|
63
|
+
this.selectionService.updateSelection(target.root, [selectableTarget.id], []);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const result = Promise.all([this.contextMenuService(), this.menuProvider.getItems(target.root, mousePosition)])
|
|
67
|
+
.then(([menuService, menuItems]) => menuService.show(menuItems, mousePosition, () => this.focusEventTarget(event)))
|
|
68
|
+
.then((): Action => new FocusStateChangedAction(false));
|
|
69
|
+
|
|
70
|
+
return [result];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
protected focusEventTarget(event: MouseEvent): void {
|
|
74
|
+
const targetElement = event.target instanceof SVGElement ? event.target : undefined;
|
|
75
|
+
const svgParentElement = targetElement?.closest('svg');
|
|
76
|
+
if (svgParentElement) {
|
|
77
|
+
svgParentElement.focus();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
51
80
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -35,7 +35,8 @@ import { GlspHoverMouseListener } from './hover';
|
|
|
35
35
|
|
|
36
36
|
const glspHoverModule = new ContainerModule((bind, _unbind, isBound) => {
|
|
37
37
|
bind(TYPES.PopupVNodePostprocessor).to(PopupPositionUpdater).inSingletonScope();
|
|
38
|
-
bind(
|
|
38
|
+
bind(GlspHoverMouseListener).toSelf().inSingletonScope();
|
|
39
|
+
bind(TYPES.MouseListener).toService(GlspHoverMouseListener);
|
|
39
40
|
bind(TYPES.PopupMouseListener).to(PopupHoverMouseListener);
|
|
40
41
|
bind(TYPES.KeyListener).to(HoverKeyListener);
|
|
41
42
|
bind<HoverState>(TYPES.HoverState).toConstantValue({
|
|
@@ -55,6 +56,7 @@ const glspHoverModule = new ContainerModule((bind, _unbind, isBound) => {
|
|
|
55
56
|
configureActionHandler(context, SetViewportCommand.KIND, ClosePopupActionHandler);
|
|
56
57
|
configureActionHandler(context, MoveCommand.KIND, ClosePopupActionHandler);
|
|
57
58
|
configureActionHandler(context, FocusStateChangedAction.KIND, ClosePopupActionHandler);
|
|
59
|
+
configureActionHandler(context, FocusStateChangedAction.KIND, GlspHoverMouseListener);
|
|
58
60
|
});
|
|
59
61
|
|
|
60
62
|
export default glspHoverModule;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -17,7 +17,10 @@ import { Action, Bounds, RequestPopupModelAction, SetPopupModelAction } from '@e
|
|
|
17
17
|
import { injectable } from 'inversify';
|
|
18
18
|
import {
|
|
19
19
|
EMPTY_ROOT,
|
|
20
|
+
HoverFeedbackAction,
|
|
20
21
|
HoverMouseListener,
|
|
22
|
+
IActionHandler,
|
|
23
|
+
ICommand,
|
|
21
24
|
PreRenderedElementSchema,
|
|
22
25
|
SIssueMarker,
|
|
23
26
|
SIssueSeverity,
|
|
@@ -25,10 +28,31 @@ import {
|
|
|
25
28
|
SModelElementSchema,
|
|
26
29
|
SModelRootSchema
|
|
27
30
|
} from 'sprotty';
|
|
31
|
+
import { isFocusStateChangedAction } from '../../base/actions/focus-change-action';
|
|
28
32
|
import { GIssueMarker } from '../validation/issue-marker';
|
|
29
33
|
|
|
30
34
|
@injectable()
|
|
31
|
-
export class GlspHoverMouseListener extends HoverMouseListener {
|
|
35
|
+
export class GlspHoverMouseListener extends HoverMouseListener implements IActionHandler {
|
|
36
|
+
/**
|
|
37
|
+
* Stops mouse over timer and remove hover feedback, if focus is lost.
|
|
38
|
+
*
|
|
39
|
+
* This fixes strange effects that appear if the mouse left the element via e.g. a context menu,
|
|
40
|
+
* which explicitly removes the focus of the diagram.
|
|
41
|
+
* @see SelectionServiceAwareContextMenuMouseListener
|
|
42
|
+
* @param action should be a `FocusStateChangedAction`
|
|
43
|
+
* @returns a `HoverFeedbackAction` resetting the state, if the specified action indicates lost focus
|
|
44
|
+
*/
|
|
45
|
+
handle(action: Action): void | Action | ICommand {
|
|
46
|
+
if (isFocusStateChangedAction(action) && !action.hasFocus) {
|
|
47
|
+
this.stopMouseOverTimer();
|
|
48
|
+
if (this.lastHoverFeedbackElementId) {
|
|
49
|
+
const previousTargetId = this.lastHoverFeedbackElementId;
|
|
50
|
+
this.lastHoverFeedbackElementId = undefined;
|
|
51
|
+
return new HoverFeedbackAction(previousTargetId, false);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
32
56
|
protected startMouseOverTimer(target: SModelElement, event: MouseEvent): Promise<Action> {
|
|
33
57
|
this.stopMouseOverTimer();
|
|
34
58
|
return new Promise(resolve => {
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
SRoutableElement,
|
|
39
39
|
TYPES
|
|
40
40
|
} from 'sprotty';
|
|
41
|
-
import { isRoutable } from '../../utils/smodel-util';
|
|
41
|
+
import { isRoutable, BoundsAwareModelElement } from '../../utils/smodel-util';
|
|
42
42
|
import { getAbsolutePosition, toAbsoluteBounds, toAbsolutePosition } from '../../utils/viewpoint-util';
|
|
43
43
|
import { FeedbackCommand } from './model';
|
|
44
44
|
|
|
@@ -106,12 +106,12 @@ export class FeedbackEdgeEndMovingMouseListener extends MouseListener {
|
|
|
106
106
|
|
|
107
107
|
const edge = edgeEnd.feedbackEdge;
|
|
108
108
|
const position = getAbsolutePosition(edgeEnd, event);
|
|
109
|
-
const endAtMousePosition = findChildrenAtPosition(target.root, position).find(
|
|
109
|
+
const endAtMousePosition = findChildrenAtPosition(target.root, position).reverse().find(
|
|
110
110
|
element => isConnectable(element) && element.canConnect(edge, 'target')
|
|
111
111
|
);
|
|
112
112
|
|
|
113
113
|
if (endAtMousePosition instanceof SConnectableElement && edge.source && isBoundsAware(edge.source)) {
|
|
114
|
-
const anchor = this.computeAbsoluteAnchor(endAtMousePosition, center(edge.source
|
|
114
|
+
const anchor = this.computeAbsoluteAnchor(endAtMousePosition, center(toAbsoluteBounds(edge.source)));
|
|
115
115
|
if (euclideanDistance(anchor, edgeEnd.position) > 1) {
|
|
116
116
|
return [new MoveAction([{ elementId: edgeEnd.id, toPosition: anchor }], false)];
|
|
117
117
|
}
|
|
@@ -122,9 +122,10 @@ export class FeedbackEdgeEndMovingMouseListener extends MouseListener {
|
|
|
122
122
|
return [];
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
protected computeAbsoluteAnchor(element: SConnectableElement,
|
|
125
|
+
protected computeAbsoluteAnchor(element: SConnectableElement, absoluteReferencePoint: Point, offset?: number): Point {
|
|
126
|
+
const referencePointInParent = absoluteToParent(element, absoluteReferencePoint);
|
|
126
127
|
const anchorComputer = this.anchorRegistry.get(PolylineEdgeRouter.KIND, element.anchorKind);
|
|
127
|
-
let anchor = anchorComputer.getAnchor(element,
|
|
128
|
+
let anchor = anchorComputer.getAnchor(element, referencePointInParent, offset);
|
|
128
129
|
// The anchor is computed in the local coordinate system of the element.
|
|
129
130
|
// If the element is a nested child element we have to add the absolute position of its parent to the anchor.
|
|
130
131
|
if (element.parent !== element.root) {
|
|
@@ -138,6 +139,33 @@ export class FeedbackEdgeEndMovingMouseListener extends MouseListener {
|
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Convert a point, specified in absolute coordinates, to a point relative
|
|
144
|
+
* to the parent of the specified child element.
|
|
145
|
+
* @param element the child element
|
|
146
|
+
* @param absolutePoint a point in absolute coordinates
|
|
147
|
+
* @returns the equivalent point, relative to the element's parent coordinates
|
|
148
|
+
*/
|
|
149
|
+
function absoluteToParent(element: BoundsAwareModelElement & SChildElement, absolutePoint: Point): Point{
|
|
150
|
+
if (isBoundsAware(element.parent)){
|
|
151
|
+
return absoluteToLocal(element.parent, absolutePoint);
|
|
152
|
+
}
|
|
153
|
+
// If the parent is not bounds-aware, assume it's at 0; 0 and proceed
|
|
154
|
+
return absoluteToLocal(element, absolutePoint);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Convert a point, specified in absolute coordinates, to a point relative
|
|
159
|
+
* to the specified element.
|
|
160
|
+
* @param element the element
|
|
161
|
+
* @param absolutePoint a point in absolute coordinates
|
|
162
|
+
* @returns the equivalent point, relative to the element's coordinates
|
|
163
|
+
*/
|
|
164
|
+
function absoluteToLocal(element: BoundsAwareModelElement, absolutePoint: Point): Point {
|
|
165
|
+
const absoluteElementBounds = toAbsoluteBounds(element);
|
|
166
|
+
return {x: absolutePoint.x - absoluteElementBounds.x, y: absolutePoint.y - absoluteElementBounds.y};
|
|
167
|
+
}
|
|
168
|
+
|
|
141
169
|
export function feedbackEdgeId(root: SModelRoot): string {
|
|
142
170
|
return root.id + '_feedback_edge';
|
|
143
171
|
}
|
|
@@ -29,7 +29,7 @@ export class StructureCompartmentView extends ShapeView {
|
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
31
|
<g>
|
|
32
|
-
<rect class-sprotty-comp={true} class-debug={
|
|
32
|
+
<rect class-sprotty-comp={true} class-debug={false} x='0' y='0' width={model.size.width} height={model.size.height}></rect>
|
|
33
33
|
{context.renderChildren(model)}
|
|
34
34
|
</g>
|
|
35
35
|
);
|