@eclipse-glsp/client 1.1.0-next.91b3a87.217 → 1.1.0-next.93fd4ec.241
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/css/decoration.css +1 -1
- package/lib/base/auto-complete/auto-complete-widget.d.ts +2 -2
- package/lib/base/auto-complete/auto-complete-widget.js +3 -3
- package/lib/base/command-stack.d.ts +1 -2
- package/lib/base/command-stack.d.ts.map +1 -1
- package/lib/base/command-stack.js +5 -14
- package/lib/base/command-stack.js.map +1 -1
- package/lib/base/container-modules.d.ts +16 -16
- package/lib/base/container-modules.d.ts.map +1 -1
- package/lib/base/container-modules.js +60 -64
- package/lib/base/container-modules.js.map +1 -1
- package/lib/base/di.config.d.ts +1 -1
- package/lib/base/di.config.d.ts.map +1 -1
- package/lib/base/di.config.js +7 -7
- package/lib/base/di.config.js.map +1 -1
- package/lib/base/editor-context-service.d.ts +3 -3
- package/lib/base/editor-context-service.d.ts.map +1 -1
- package/lib/base/editor-context-service.js +3 -3
- package/lib/base/editor-context-service.js.map +1 -1
- package/lib/base/tool-manager/glsp-tool-manager.d.ts +4 -5
- package/lib/base/tool-manager/glsp-tool-manager.d.ts.map +1 -1
- package/lib/base/tool-manager/glsp-tool-manager.js +15 -8
- package/lib/base/tool-manager/glsp-tool-manager.js.map +1 -1
- package/lib/features/bounds/di.config.d.ts +0 -16
- package/lib/features/bounds/di.config.d.ts.map +1 -1
- package/lib/features/bounds/di.config.js +12 -9
- package/lib/features/bounds/di.config.js.map +1 -1
- package/lib/features/{layout → bounds}/freeform-layout.d.ts +2 -2
- package/lib/features/{layout → bounds}/freeform-layout.d.ts.map +1 -1
- package/lib/features/{layout → bounds}/freeform-layout.js +2 -2
- package/lib/features/{layout → bounds}/freeform-layout.js.map +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts.map +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.js +3 -2
- package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -1
- package/lib/features/{layout → bounds}/hbox-layout.d.ts +1 -1
- package/lib/features/{layout → bounds}/hbox-layout.d.ts.map +1 -1
- package/lib/features/{layout → bounds}/hbox-layout.js +1 -1
- package/lib/features/{layout → bounds}/hbox-layout.js.map +1 -1
- package/lib/features/{layout → bounds}/layouter.d.ts +1 -1
- package/lib/features/{layout → bounds}/layouter.d.ts.map +1 -1
- package/lib/features/{layout → bounds}/layouter.js +1 -1
- package/lib/features/{layout → bounds}/layouter.js.map +1 -1
- package/lib/features/{layout → bounds}/vbox-layout.d.ts +1 -1
- package/lib/features/{layout → bounds}/vbox-layout.d.ts.map +1 -1
- package/lib/features/{layout → bounds}/vbox-layout.js +1 -1
- package/lib/features/{layout → bounds}/vbox-layout.js.map +1 -1
- package/lib/features/command-palette/command-palette-tool.d.ts +1 -1
- package/lib/features/command-palette/command-palette-tool.d.ts.map +1 -1
- package/lib/features/command-palette/command-palette-tool.js +3 -3
- package/lib/features/command-palette/command-palette-tool.js.map +1 -1
- package/lib/features/command-palette/di.config.d.ts +0 -15
- package/lib/features/command-palette/di.config.d.ts.map +1 -1
- package/lib/features/command-palette/di.config.js +6 -7
- package/lib/features/command-palette/di.config.js.map +1 -1
- package/lib/features/context-menu/di.config.d.ts +0 -15
- package/lib/features/context-menu/di.config.d.ts.map +1 -1
- package/lib/features/context-menu/di.config.js +4 -3
- package/lib/features/context-menu/di.config.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-handler.d.ts +2 -2
- package/lib/features/copy-paste/copy-paste-handler.d.ts.map +1 -1
- package/lib/features/copy-paste/copy-paste-handler.js +5 -5
- package/lib/features/copy-paste/copy-paste-handler.js.map +1 -1
- package/lib/features/decoration/di.config.d.ts +0 -15
- package/lib/features/decoration/di.config.d.ts.map +1 -1
- package/lib/features/decoration/di.config.js +4 -4
- package/lib/features/decoration/di.config.js.map +1 -1
- package/lib/features/edit-label/di.config.d.ts +0 -15
- package/lib/features/edit-label/di.config.d.ts.map +1 -1
- package/lib/features/edit-label/di.config.js +3 -2
- package/lib/features/edit-label/di.config.js.map +1 -1
- package/lib/features/export/di.config.d.ts +0 -15
- package/lib/features/export/di.config.d.ts.map +1 -1
- package/lib/features/export/di.config.js +6 -5
- package/lib/features/export/di.config.js.map +1 -1
- package/lib/features/export/glsp-svg-exporter.d.ts +1 -1
- package/lib/features/export/glsp-svg-exporter.d.ts.map +1 -1
- package/lib/features/export/glsp-svg-exporter.js +1 -2
- package/lib/features/export/glsp-svg-exporter.js.map +1 -1
- package/lib/features/hover/di.config.d.ts +0 -15
- package/lib/features/hover/di.config.d.ts.map +1 -1
- package/lib/features/hover/di.config.js +7 -7
- package/lib/features/hover/di.config.js.map +1 -1
- package/lib/features/layout/di.config.d.ts +1 -1
- package/lib/features/layout/di.config.d.ts.map +1 -1
- package/lib/features/layout/di.config.js +1 -9
- package/lib/features/layout/di.config.js.map +1 -1
- package/lib/features/navigation/di.config.d.ts +2 -1
- package/lib/features/navigation/di.config.d.ts.map +1 -1
- package/lib/features/navigation/di.config.js +3 -3
- package/lib/features/navigation/di.config.js.map +1 -1
- package/lib/features/navigation/navigation-action-handler.d.ts +2 -2
- package/lib/features/navigation/navigation-action-handler.js +2 -2
- package/lib/features/save/di.config.d.ts +0 -15
- package/lib/features/save/di.config.d.ts.map +1 -1
- package/lib/features/save/di.config.js +3 -2
- package/lib/features/save/di.config.js.map +1 -1
- package/lib/features/select/di.config.d.ts +0 -15
- package/lib/features/select/di.config.d.ts.map +1 -1
- package/lib/features/select/di.config.js +8 -7
- package/lib/features/select/di.config.js.map +1 -1
- package/lib/features/{change-bounds/snap.spec.d.ts → svg-metadata/di.config.d.ts} +5 -3
- package/lib/features/svg-metadata/di.config.d.ts.map +1 -0
- package/lib/features/svg-metadata/di.config.js +26 -0
- package/lib/features/svg-metadata/di.config.js.map +1 -0
- package/lib/features/svg-metadata/metadata-placer.d.ts +24 -0
- package/lib/features/svg-metadata/metadata-placer.d.ts.map +1 -0
- package/lib/features/svg-metadata/metadata-placer.js +63 -0
- package/lib/features/svg-metadata/metadata-placer.js.map +1 -0
- package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts +2 -2
- package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js +3 -3
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts +7 -7
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.js +5 -9
- package/lib/features/tool-feedback/creation-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/di.config.d.ts +0 -15
- package/lib/features/tool-feedback/di.config.d.ts.map +1 -1
- package/lib/features/tool-feedback/di.config.js +20 -18
- package/lib/features/tool-feedback/di.config.js.map +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts +2 -3
- package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.js +2 -8
- package/lib/features/tool-feedback/edge-edit-tool-feedback.js.map +1 -1
- package/lib/features/tool-palette/di.config.d.ts +0 -15
- package/lib/features/tool-palette/di.config.d.ts.map +1 -1
- package/lib/features/tool-palette/di.config.js +4 -4
- package/lib/features/tool-palette/di.config.js.map +1 -1
- package/lib/features/tool-palette/tool-palette.d.ts +1 -1
- package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
- package/lib/features/tool-palette/tool-palette.js +2 -2
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/tools/change-bounds-tool.d.ts +1 -1
- package/lib/features/tools/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds-tool.js +6 -6
- package/lib/features/tools/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/di.config.d.ts +18 -5
- package/lib/features/tools/di.config.d.ts.map +1 -1
- package/lib/features/tools/di.config.js +14 -15
- package/lib/features/tools/di.config.js.map +1 -1
- package/lib/features/tools/glsp-manhattan-edge-router.d.ts +2 -2
- package/lib/features/tools/glsp-manhattan-edge-router.d.ts.map +1 -1
- package/lib/features/tools/glsp-manhattan-edge-router.js +4 -4
- package/lib/features/tools/glsp-manhattan-edge-router.js.map +1 -1
- package/lib/features/validation/di.config.js +4 -4
- package/lib/features/validation/di.config.js.map +1 -1
- package/lib/features/validation/validate.d.ts +6 -6
- package/lib/features/validation/validate.d.ts.map +1 -1
- package/lib/features/validation/validate.js +18 -17
- package/lib/features/validation/validate.js.map +1 -1
- package/lib/features/viewport/di.config.d.ts +0 -15
- package/lib/features/viewport/di.config.d.ts.map +1 -1
- package/lib/features/viewport/di.config.js +12 -11
- package/lib/features/viewport/di.config.js.map +1 -1
- package/lib/index.d.ts +28 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +66 -34
- package/lib/index.js.map +1 -1
- package/lib/sprotty-reexport.d.ts +2 -2
- package/lib/sprotty-reexport.d.ts.map +1 -1
- package/lib/sprotty-reexport.js +4 -4
- package/lib/sprotty-reexport.js.map +1 -1
- package/lib/utils/smodel-util.d.ts +1 -1
- package/lib/utils/smodel-util.d.ts.map +1 -1
- package/lib/utils/smodel-util.js +1 -1
- package/lib/utils/smodel-util.js.map +1 -1
- package/lib/views/base-view-module.d.ts +18 -6
- package/lib/views/base-view-module.d.ts.map +1 -1
- package/lib/views/base-view-module.js +1 -1
- package/lib/views/base-view-module.js.map +1 -1
- package/lib/views/glsp-edge-view.d.ts +2 -2
- package/lib/views/glsp-edge-view.d.ts.map +1 -1
- package/lib/views/glsp-edge-view.js +2 -2
- package/lib/views/glsp-edge-view.js.map +1 -1
- package/lib/views/index.d.ts +1 -1
- package/lib/views/index.js +1 -1
- package/lib/views/rounded-corner-view.js +2 -2
- package/lib/views/rounded-corner.d.ts +1 -1
- package/lib/views/rounded-corner.js +1 -1
- package/package.json +17 -17
- package/src/base/auto-complete/auto-complete-widget.ts +3 -3
- package/src/base/command-stack.ts +13 -11
- package/src/base/container-modules.ts +21 -32
- package/src/base/di.config.ts +8 -8
- package/src/base/editor-context-service.ts +4 -4
- package/src/base/tool-manager/glsp-tool-manager.ts +15 -12
- package/src/features/bounds/di.config.ts +21 -11
- package/src/features/{layout/tests → bounds}/freeform-layout.spec.ts +2 -2
- package/src/features/{layout → bounds}/freeform-layout.ts +2 -2
- package/src/features/bounds/glsp-hidden-bounds-updater.ts +4 -7
- package/src/features/{layout/tests → bounds}/hbox-layout.spec.ts +2 -2
- package/src/features/{layout → bounds}/hbox-layout.ts +1 -1
- package/src/features/{layout/tests/layouter-test-util.ts → bounds/layouter-test-util.spec.ts} +5 -5
- package/src/features/{layout → bounds}/layouter.ts +1 -1
- package/src/features/{layout/tests → bounds}/vbox-layout.spec.ts +2 -2
- package/src/features/{layout → bounds}/vbox-layout.ts +1 -1
- package/src/features/command-palette/command-palette-tool.ts +3 -3
- package/src/features/command-palette/di.config.ts +6 -7
- package/src/features/context-menu/di.config.ts +4 -3
- package/src/features/copy-paste/copy-paste-handler.ts +5 -5
- package/src/features/decoration/di.config.ts +4 -4
- package/src/features/edit-label/di.config.ts +3 -2
- package/src/features/export/di.config.ts +6 -5
- package/src/features/export/glsp-svg-exporter.ts +8 -7
- package/src/features/hover/di.config.ts +8 -7
- package/src/features/layout/di.config.ts +2 -11
- package/src/features/navigation/di.config.ts +4 -2
- package/src/features/navigation/navigation-action-handler.ts +2 -2
- package/src/features/save/di.config.ts +3 -2
- package/src/features/select/di.config.ts +8 -7
- package/src/features/select/selection-service.spec.ts +4 -5
- package/{lib/features/tools/marquee-behavior.spec.d.ts → src/features/svg-metadata/di.config.ts} +12 -3
- package/src/features/svg-metadata/metadata-placer.ts +51 -0
- package/src/features/tool-feedback/change-bounds-tool-feedback.ts +3 -3
- package/src/features/tool-feedback/creation-tool-feedback.ts +21 -15
- package/src/features/tool-feedback/di.config.ts +20 -18
- package/src/features/tool-feedback/edge-edit-tool-feedback.ts +2 -10
- package/src/features/tool-palette/di.config.ts +4 -4
- package/src/features/tool-palette/tool-palette.ts +4 -4
- package/src/features/tools/change-bounds-tool.ts +7 -7
- package/src/features/tools/di.config.ts +18 -19
- package/src/features/tools/glsp-manhattan-edge-router.ts +8 -5
- package/src/features/validation/di.config.ts +5 -5
- package/src/features/validation/validate.ts +16 -19
- package/src/features/viewport/di.config.ts +13 -11
- package/src/index.ts +37 -5
- package/src/sprotty-reexport.ts +18 -8
- package/src/utils/smodel-util.ts +12 -5
- package/src/views/base-view-module.ts +4 -9
- package/src/views/glsp-edge-view.tsx +3 -3
- package/src/views/index.ts +1 -2
- package/src/views/rounded-corner-view.tsx +2 -2
- package/src/views/rounded-corner.ts +2 -2
- package/lib/features/change-bounds/snap.spec.d.ts.map +0 -1
- package/lib/features/change-bounds/snap.spec.js +0 -82
- package/lib/features/change-bounds/snap.spec.js.map +0 -1
- package/lib/features/layout/layout-elements-action.spec.d.ts +0 -3
- package/lib/features/layout/layout-elements-action.spec.d.ts.map +0 -1
- package/lib/features/layout/layout-elements-action.spec.js +0 -325
- package/lib/features/layout/layout-elements-action.spec.js.map +0 -1
- package/lib/features/layout/tests/freeform-layout.spec.d.ts +0 -3
- package/lib/features/layout/tests/freeform-layout.spec.d.ts.map +0 -1
- package/lib/features/layout/tests/freeform-layout.spec.js +0 -201
- package/lib/features/layout/tests/freeform-layout.spec.js.map +0 -1
- package/lib/features/layout/tests/hbox-layout.spec.d.ts +0 -3
- package/lib/features/layout/tests/hbox-layout.spec.d.ts.map +0 -1
- package/lib/features/layout/tests/hbox-layout.spec.js +0 -161
- package/lib/features/layout/tests/hbox-layout.spec.js.map +0 -1
- package/lib/features/layout/tests/layouter-test-util.d.ts +0 -34
- package/lib/features/layout/tests/layouter-test-util.d.ts.map +0 -1
- package/lib/features/layout/tests/layouter-test-util.js +0 -96
- package/lib/features/layout/tests/layouter-test-util.js.map +0 -1
- package/lib/features/layout/tests/vbox-layout.spec.d.ts +0 -3
- package/lib/features/layout/tests/vbox-layout.spec.d.ts.map +0 -1
- package/lib/features/layout/tests/vbox-layout.spec.js +0 -161
- package/lib/features/layout/tests/vbox-layout.spec.js.map +0 -1
- package/lib/features/navigation/navigation-target-resolver.spec.d.ts +0 -3
- package/lib/features/navigation/navigation-target-resolver.spec.d.ts.map +0 -1
- package/lib/features/navigation/navigation-target-resolver.spec.js +0 -54
- package/lib/features/navigation/navigation-target-resolver.spec.js.map +0 -1
- package/lib/features/select/selection-service.spec.d.ts +0 -2
- package/lib/features/select/selection-service.spec.d.ts.map +0 -1
- package/lib/features/select/selection-service.spec.js +0 -347
- package/lib/features/select/selection-service.spec.js.map +0 -1
- package/lib/features/tools/marquee-behavior.spec.d.ts.map +0 -1
- package/lib/features/tools/marquee-behavior.spec.js +0 -165
- package/lib/features/tools/marquee-behavior.spec.js.map +0 -1
- package/lib/features/validation/marker-navigator.spec.d.ts +0 -3
- package/lib/features/validation/marker-navigator.spec.d.ts.map +0 -1
- package/lib/features/validation/marker-navigator.spec.js +0 -169
- package/lib/features/validation/marker-navigator.spec.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2023 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
|
|
@@ -33,28 +33,25 @@ export class ValidationFeedbackEmitter implements IFeedbackEmitter {
|
|
|
33
33
|
|
|
34
34
|
@inject(TYPES.IActionDispatcherProvider) protected actionDispatcher: () => Promise<IActionDispatcher>;
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
39
|
-
private constructor() {}
|
|
36
|
+
protected registeredFeedbackByReason: Map<string, ApplyMarkersAction> = new Map();
|
|
40
37
|
|
|
41
38
|
/**
|
|
42
39
|
* Register the action that should be emitted for visualizing validation feedback.
|
|
43
40
|
* @param action the action that should be emitted when the model is updated and that will visualize the model validation feedback.
|
|
41
|
+
* @param reason the reason for this validation feedback.
|
|
44
42
|
*/
|
|
45
|
-
registerValidationFeedbackAction(action: ApplyMarkersAction): void {
|
|
46
|
-
// De-register
|
|
47
|
-
this.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const deleteMarkersAction = DeleteMarkersAction.create(this.registeredAction.markers);
|
|
43
|
+
registerValidationFeedbackAction(action: ApplyMarkersAction, reason = ''): void {
|
|
44
|
+
// De-register feedback and clear existing markers with the same reason
|
|
45
|
+
const previousFeedbackWithSameReason = this.registeredFeedbackByReason.get(reason);
|
|
46
|
+
if (previousFeedbackWithSameReason) {
|
|
47
|
+
this.feedbackActionDispatcher.deregisterFeedback(this, [previousFeedbackWithSameReason]);
|
|
48
|
+
const deleteMarkersAction = DeleteMarkersAction.create(previousFeedbackWithSameReason.markers);
|
|
52
49
|
this.actionDispatcher().then(dispatcher => dispatcher.dispatch(deleteMarkersAction));
|
|
53
50
|
}
|
|
54
51
|
|
|
55
52
|
// Register new action responsible for applying markers and re-applying them when the model is updated
|
|
56
|
-
this.
|
|
57
|
-
this.
|
|
53
|
+
this.registeredFeedbackByReason.set(reason, action);
|
|
54
|
+
this.feedbackActionDispatcher.registerFeedback(this, [...this.registeredFeedbackByReason.values()]);
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
57
|
|
|
@@ -80,7 +77,7 @@ export abstract class ExternalMarkerManager {
|
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
79
|
|
|
83
|
-
abstract setMarkers(markers: Marker[], sourceUri?: string): void;
|
|
80
|
+
abstract setMarkers(markers: Marker[], reason?: string, sourceUri?: string): void;
|
|
84
81
|
}
|
|
85
82
|
|
|
86
83
|
@injectable()
|
|
@@ -97,14 +94,14 @@ export class SetMarkersActionHandler implements IActionHandler {
|
|
|
97
94
|
|
|
98
95
|
handle(action: SetMarkersAction): void | Action | ICommand {
|
|
99
96
|
const markers: Marker[] = action.markers;
|
|
100
|
-
this.setMarkers(markers);
|
|
97
|
+
this.setMarkers(markers, action.reason);
|
|
101
98
|
}
|
|
102
99
|
|
|
103
|
-
async setMarkers(markers: Marker[]): Promise<void> {
|
|
100
|
+
async setMarkers(markers: Marker[], reason: string | undefined): Promise<void> {
|
|
104
101
|
const uri = await this.editorContextService.getSourceUri();
|
|
105
|
-
this.externalMarkerManager?.setMarkers(markers, uri);
|
|
102
|
+
this.externalMarkerManager?.setMarkers(markers, reason, uri);
|
|
106
103
|
const applyMarkersAction = ApplyMarkersAction.create(markers);
|
|
107
|
-
this.validationFeedbackEmitter.registerValidationFeedbackAction(applyMarkersAction);
|
|
104
|
+
this.validationFeedbackEmitter.registerValidationFeedbackAction(applyMarkersAction, reason);
|
|
108
105
|
}
|
|
109
106
|
}
|
|
110
107
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021-
|
|
2
|
+
* Copyright (c) 2021-2023 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
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
import { bindAsService } from '@eclipse-glsp/protocol';
|
|
16
17
|
import { ContainerModule } from 'inversify';
|
|
17
18
|
import {
|
|
18
19
|
CenterCommand,
|
|
@@ -30,17 +31,18 @@ import {
|
|
|
30
31
|
import { GLSPScrollMouseListener } from './glsp-scroll-mouse-listener';
|
|
31
32
|
|
|
32
33
|
const glspViewportModule = new ContainerModule((bind, _unbind, isBound) => {
|
|
33
|
-
|
|
34
|
-
configureCommand(
|
|
35
|
-
configureCommand(
|
|
36
|
-
configureCommand(
|
|
37
|
-
|
|
38
|
-
bind(TYPES.MouseListener).to(ZoomMouseListener);
|
|
39
|
-
bind(GLSPScrollMouseListener).toSelf().inSingletonScope();
|
|
40
|
-
bind(TYPES.MouseListener).toService(GLSPScrollMouseListener);
|
|
34
|
+
const context = { bind, isBound };
|
|
35
|
+
configureCommand(context, CenterCommand);
|
|
36
|
+
configureCommand(context, FitToScreenCommand);
|
|
37
|
+
configureCommand(context, GetViewportCommand);
|
|
38
|
+
configureCommand(context, SetViewportCommand);
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
bindAsService(context, TYPES.KeyListener, CenterKeyboardListener);
|
|
41
|
+
bindAsService(context, TYPES.MouseListener, ZoomMouseListener);
|
|
42
|
+
bindAsService(context, TYPES.MouseListener, GLSPScrollMouseListener);
|
|
43
|
+
|
|
44
|
+
configureActionHandler(context, EnableToolsAction.KIND, GLSPScrollMouseListener);
|
|
45
|
+
configureActionHandler(context, EnableDefaultToolsAction.KIND, GLSPScrollMouseListener);
|
|
44
46
|
});
|
|
45
47
|
|
|
46
48
|
export default glspViewportModule;
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2023 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
|
|
@@ -18,21 +18,23 @@ import glspCommandPaletteModule from './features/command-palette/di.config';
|
|
|
18
18
|
import glspContextMenuModule from './features/context-menu/di.config';
|
|
19
19
|
import { copyPasteContextMenuModule, glspServerCopyPasteModule } from './features/copy-paste/di.config';
|
|
20
20
|
import glspDecorationModule from './features/decoration/di.config';
|
|
21
|
+
import svgMetadataModule from './features/svg-metadata/di.config';
|
|
21
22
|
import glspEditLabelModule from './features/edit-label/di.config';
|
|
22
23
|
import modelHintsModule from './features/hints/di.config';
|
|
23
24
|
import glspHoverModule from './features/hover/di.config';
|
|
24
25
|
import layoutModule from './features/layout/di.config';
|
|
25
26
|
import glspMouseToolModule from './features/mouse-tool/di.config';
|
|
26
|
-
import
|
|
27
|
+
import navigationModule from './features/navigation/di.config';
|
|
27
28
|
import saveModule from './features/save/di.config';
|
|
28
29
|
import glspSelectModule from './features/select/di.config';
|
|
29
30
|
import sourceModelWatcherModule from './features/source-model-watcher/di.config';
|
|
30
31
|
import toolFeedbackModule from './features/tool-feedback/di.config';
|
|
31
32
|
import paletteModule from './features/tool-palette/di.config';
|
|
32
33
|
import { enableDefaultToolsOnFocusLossModule, toolsModule } from './features/tools/di.config';
|
|
33
|
-
import { markerNavigatorModule, validationModule } from './features/validation/di.config';
|
|
34
|
+
import { markerNavigatorContextMenuModule, markerNavigatorModule, validationModule } from './features/validation/di.config';
|
|
34
35
|
import glspViewportModule from './features/viewport/di.config';
|
|
35
36
|
|
|
37
|
+
// ------------------ Base ------------------
|
|
36
38
|
export * from './base/action-dispatcher';
|
|
37
39
|
export * from './base/actions/focus-change-action';
|
|
38
40
|
export * from './base/argumentable';
|
|
@@ -50,18 +52,32 @@ export * from './base/model/model-registry';
|
|
|
50
52
|
export * from './base/model/update-model-command';
|
|
51
53
|
export * from './base/selection-clearing-mouse-listener';
|
|
52
54
|
export * from './base/source-uri-aware';
|
|
55
|
+
export * from './base/tool-manager/glsp-tool-manager';
|
|
53
56
|
export * from './base/tool-manager/tool-actions';
|
|
54
57
|
export * from './base/types';
|
|
55
58
|
export * from './base/view/view-registry';
|
|
59
|
+
//
|
|
60
|
+
// ------------------ Features ------------------
|
|
61
|
+
export * from './features/bounds/freeform-layout';
|
|
62
|
+
export * from './features/bounds/glsp-hidden-bounds-updater';
|
|
63
|
+
export * from './features/bounds/hbox-layout';
|
|
64
|
+
export * from './features/bounds/layouter';
|
|
65
|
+
export * from './features/bounds/vbox-layout';
|
|
56
66
|
export * from './features/change-bounds/model';
|
|
57
67
|
export * from './features/change-bounds/movement-restrictor';
|
|
58
68
|
export * from './features/change-bounds/snap';
|
|
69
|
+
export * from './features/command-palette/command-palette-tool';
|
|
59
70
|
export * from './features/command-palette/server-command-palette-provider';
|
|
60
71
|
export * from './features/context-menu/delete-element-context-menu';
|
|
72
|
+
export * from './features/context-menu/selection-service-aware-context-menu-mouse-listener';
|
|
73
|
+
export * from './features/context-menu/server-context-menu-provider';
|
|
74
|
+
export * from './features/copy-paste/copy-paste-context-menu';
|
|
61
75
|
export * from './features/copy-paste/copy-paste-handler';
|
|
62
76
|
export * from './features/decoration/decoration-placer';
|
|
77
|
+
export * from './features/svg-metadata/metadata-placer';
|
|
63
78
|
export * from './features/edit-label/edit-label-tool';
|
|
64
79
|
export * from './features/edit-label/edit-label-validator';
|
|
80
|
+
export * from './features/export/glsp-svg-exporter';
|
|
65
81
|
export * from './features/hints/model';
|
|
66
82
|
export * from './features/hints/type-hints';
|
|
67
83
|
export * from './features/hover/hover';
|
|
@@ -73,33 +89,47 @@ export * from './features/rank/model';
|
|
|
73
89
|
export * from './features/reconnect/model';
|
|
74
90
|
export * from './features/save/model';
|
|
75
91
|
export * from './features/save/save-keylistener';
|
|
92
|
+
export * from './features/select/select-feedback-action';
|
|
93
|
+
export * from './features/select/select-mouse-listener';
|
|
94
|
+
export * from './features/select/selection-service';
|
|
76
95
|
export * from './features/source-model-watcher/source-model-changed-action-handler';
|
|
77
96
|
export * from './features/tool-feedback/change-bounds-tool-feedback';
|
|
78
97
|
export * from './features/tool-feedback/creation-tool-feedback';
|
|
79
98
|
export * from './features/tool-feedback/css-feedback';
|
|
80
99
|
export * from './features/tool-feedback/edge-edit-tool-feedback';
|
|
81
100
|
export * from './features/tool-feedback/feedback-action-dispatcher';
|
|
101
|
+
export * from './features/tool-feedback/marquee-tool-feedback';
|
|
82
102
|
export * from './features/tool-feedback/model';
|
|
103
|
+
export * from './features/tool-feedback/view';
|
|
83
104
|
export * from './features/tool-palette/tool-palette';
|
|
84
105
|
export * from './features/tools/base-glsp-tool';
|
|
85
106
|
export * from './features/tools/change-bounds-tool';
|
|
86
107
|
export * from './features/tools/delete-tool';
|
|
108
|
+
export { configureMarqueeTool } from './features/tools/di.config';
|
|
87
109
|
export * from './features/tools/edge-creation-tool';
|
|
88
110
|
export * from './features/tools/edge-edit-tool';
|
|
111
|
+
export * from './features/tools/enable-default-tools-on-focus-loss';
|
|
112
|
+
export * from './features/tools/glsp-manhattan-edge-router';
|
|
89
113
|
export * from './features/tools/marquee-behavior';
|
|
114
|
+
export * from './features/tools/model';
|
|
90
115
|
export * from './features/tools/node-creation-tool';
|
|
91
116
|
export * from './features/validation/issue-marker';
|
|
92
117
|
export * from './features/validation/marker-navigator';
|
|
93
118
|
export * from './features/validation/validate';
|
|
94
119
|
export * from './features/viewport/glsp-scroll-mouse-listener';
|
|
120
|
+
//
|
|
121
|
+
// ------------------ Misc ------------------
|
|
95
122
|
export * from './lib/model';
|
|
96
123
|
export * from './model-source/glsp-diagram-server';
|
|
97
124
|
export * from './sprotty-reexport';
|
|
98
125
|
export * from './utils/argument-utils';
|
|
126
|
+
export * from './utils/html-utils';
|
|
127
|
+
export * from './utils/layout-utils';
|
|
99
128
|
export * from './utils/marker';
|
|
100
129
|
export * from './utils/smodel-util';
|
|
101
130
|
export * from './utils/viewpoint-util';
|
|
102
131
|
export * from './views';
|
|
132
|
+
// ------------------ DI Modules ------------------
|
|
103
133
|
export {
|
|
104
134
|
validationModule,
|
|
105
135
|
saveModule,
|
|
@@ -121,6 +151,8 @@ export {
|
|
|
121
151
|
navigationModule,
|
|
122
152
|
markerNavigatorModule,
|
|
123
153
|
glspDecorationModule,
|
|
124
|
-
sourceModelWatcherModule
|
|
125
|
-
|
|
154
|
+
sourceModelWatcherModule,
|
|
155
|
+
markerNavigatorContextMenuModule,
|
|
156
|
+
glspViewportModule,
|
|
157
|
+
svgMetadataModule
|
|
126
158
|
};
|
package/src/sprotty-reexport.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 STMicroelectronics and others.
|
|
2
|
+
* Copyright (c) 2022-2023 STMicroelectronics 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
|
|
@@ -23,8 +23,13 @@
|
|
|
23
23
|
export * from '@eclipse-glsp/protocol';
|
|
24
24
|
// sprotty-protocol
|
|
25
25
|
export {
|
|
26
|
-
BringToFrontAction,
|
|
27
|
-
|
|
26
|
+
BringToFrontAction,
|
|
27
|
+
CollapseExpandAction,
|
|
28
|
+
CollapseExpandAllAction,
|
|
29
|
+
ElementAndAlignment,
|
|
30
|
+
HoverFeedbackAction,
|
|
31
|
+
MoveAction,
|
|
32
|
+
SetBoundsAction
|
|
28
33
|
} from 'sprotty-protocol/lib/actions';
|
|
29
34
|
export { Viewport } from 'sprotty-protocol/lib/model';
|
|
30
35
|
// ------------------ Base ------------------
|
|
@@ -157,8 +162,14 @@ export {
|
|
|
157
162
|
export * from 'sprotty/lib/features/hover/model';
|
|
158
163
|
export * from 'sprotty/lib/features/move/model';
|
|
159
164
|
export {
|
|
160
|
-
ElementMove,
|
|
161
|
-
|
|
165
|
+
ElementMove,
|
|
166
|
+
LocationPostprocessor,
|
|
167
|
+
MorphEdgesAnimation,
|
|
168
|
+
MoveAnimation,
|
|
169
|
+
MoveCommand,
|
|
170
|
+
MoveMouseListener,
|
|
171
|
+
ResolvedElementMove,
|
|
172
|
+
ResolvedHandleMove
|
|
162
173
|
} from 'sprotty/lib/features/move/move';
|
|
163
174
|
export * from 'sprotty/lib/features/move/snap';
|
|
164
175
|
export * from 'sprotty/lib/features/nameable/model';
|
|
@@ -181,8 +192,8 @@ export * from 'sprotty/lib/features/select/model';
|
|
|
181
192
|
export {
|
|
182
193
|
GetSelectionAction,
|
|
183
194
|
GetSelectionCommand,
|
|
184
|
-
SelectAllCommand,
|
|
185
|
-
SelectCommand,
|
|
195
|
+
SelectAllCommand as SprottySelectAllCommand,
|
|
196
|
+
SelectCommand as SprottySelectCommand,
|
|
186
197
|
SelectionResult,
|
|
187
198
|
SelectKeyboardListener,
|
|
188
199
|
SelectMouseListener
|
|
@@ -291,4 +302,3 @@ import viewportModule from 'sprotty/lib/features/viewport/di.config';
|
|
|
291
302
|
import zorderModule from 'sprotty/lib/features/zorder/di.config';
|
|
292
303
|
import graphModule from 'sprotty/lib/graph/di.config';
|
|
293
304
|
import modelSourceModule from 'sprotty/lib/model-source/di.config';
|
|
294
|
-
|
package/src/utils/smodel-util.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2023 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,7 +14,12 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import {
|
|
17
|
-
distinctAdd,
|
|
17
|
+
distinctAdd,
|
|
18
|
+
ElementAndBounds,
|
|
19
|
+
ElementAndRoutingPoints,
|
|
20
|
+
Point,
|
|
21
|
+
remove,
|
|
22
|
+
SModelElementSchema,
|
|
18
23
|
TypeGuard
|
|
19
24
|
} from '@eclipse-glsp/protocol';
|
|
20
25
|
import {
|
|
@@ -23,7 +28,8 @@ import {
|
|
|
23
28
|
isBoundsAware,
|
|
24
29
|
isMoveable,
|
|
25
30
|
isSelectable,
|
|
26
|
-
isSelected,
|
|
31
|
+
isSelected,
|
|
32
|
+
ModelIndexImpl,
|
|
27
33
|
RoutedPoint,
|
|
28
34
|
Selectable,
|
|
29
35
|
SModelElement,
|
|
@@ -275,7 +281,9 @@ export function calcElementAndRoute(element: SRoutableElement, routerRegistry?:
|
|
|
275
281
|
* @returns The corresponding route for the given element.
|
|
276
282
|
*/
|
|
277
283
|
export function calcRoute(element: SRoutableElement, routerRegistry: EdgeRouterRegistry, pointKinds?: string[]): RoutedPoint[] | undefined {
|
|
278
|
-
return routerRegistry
|
|
284
|
+
return routerRegistry
|
|
285
|
+
?.get(element.routerKind)
|
|
286
|
+
.route(element)
|
|
279
287
|
.filter((point, idx, fullRoute) => idx === fullRoute.findIndex(otherPoint => otherPoint.x === point.x && otherPoint.y === point.y))
|
|
280
288
|
.filter(point => !pointKinds || pointKinds.includes(point.kind));
|
|
281
289
|
}
|
|
@@ -302,4 +310,3 @@ export function getElementTypeId(input: SModelElement | SModelElementSchema | st
|
|
|
302
310
|
return (input as any)['type'] as string;
|
|
303
311
|
}
|
|
304
312
|
}
|
|
305
|
-
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021-
|
|
2
|
+
* Copyright (c) 2021-2023 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
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { DefaultTypes } from '@eclipse-glsp/protocol';
|
|
17
|
-
import { ContainerModule
|
|
16
|
+
import { BindingContext, DefaultTypes } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { ContainerModule } from 'inversify';
|
|
18
18
|
import {
|
|
19
19
|
CircularNode,
|
|
20
20
|
CircularNodeView,
|
|
@@ -53,17 +53,12 @@ import { GEdgeView } from './glsp-edge-view';
|
|
|
53
53
|
import { GIssueMarkerView } from './issue-marker-view';
|
|
54
54
|
import { RoundedCornerNodeView } from './rounded-corner-view';
|
|
55
55
|
|
|
56
|
-
interface ContainerContext {
|
|
57
|
-
bind: interfaces.Bind;
|
|
58
|
-
isBound: interfaces.IsBound;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
56
|
const baseViewModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
62
57
|
const context = { bind, unbind, isBound, rebind };
|
|
63
58
|
configureDefaultModelElements(context);
|
|
64
59
|
});
|
|
65
60
|
|
|
66
|
-
export function configureDefaultModelElements(context:
|
|
61
|
+
export function configureDefaultModelElements(context: Pick<BindingContext, 'bind' | 'isBound'>): void {
|
|
67
62
|
// HTML elements
|
|
68
63
|
configureModelElement(context, DefaultTypes.HTML, HtmlRoot, HtmlRootView);
|
|
69
64
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021-
|
|
2
|
+
* Copyright (c) 2021-2023 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
|
|
@@ -32,7 +32,7 @@ export class GEdgeView extends PolylineEdgeView {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<g class-sprotty-edge={true} class-mouseover={edge.hoverFeedback} {...this.
|
|
35
|
+
<g class-sprotty-edge={true} class-mouseover={edge.hoverFeedback} {...this.additionalClasses(edge, context)}>
|
|
36
36
|
{this.renderLine(edge, route, context)}
|
|
37
37
|
{this.renderAdditionals(edge, route, context)}
|
|
38
38
|
{context.renderChildren(edge, { route })}
|
|
@@ -40,7 +40,7 @@ export class GEdgeView extends PolylineEdgeView {
|
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
protected
|
|
43
|
+
protected additionalClasses(_edge: Readonly<SEdge>, _context: RenderingContext): Classes {
|
|
44
44
|
return {};
|
|
45
45
|
}
|
|
46
46
|
|
package/src/views/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2023 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
|
|
@@ -20,4 +20,3 @@ export * from './glsp-projection-view';
|
|
|
20
20
|
export * from './issue-marker-view';
|
|
21
21
|
export * from './rounded-corner';
|
|
22
22
|
export * from './rounded-corner-view';
|
|
23
|
-
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021-
|
|
2
|
+
* Copyright (c) 2021-2023 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
|
|
@@ -70,7 +70,7 @@ export class RoundedCornerNodeView extends RectangularNodeView {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
protected renderPath(wrapper: Readonly<RoundedCornerWrapper>, _context: RenderingContext, inset: number): string {
|
|
73
|
-
//
|
|
73
|
+
// Calculate length of straight line segments
|
|
74
74
|
const topLineLength = Math.max(0, wrapper.size.width - wrapper.cornerRadius.topLeft - wrapper.cornerRadius.topRight);
|
|
75
75
|
const rightLineLength = Math.max(0, wrapper.size.height - wrapper.cornerRadius.topRight - wrapper.cornerRadius.bottomRight);
|
|
76
76
|
const bottomLineLength = Math.max(0, wrapper.size.width - wrapper.cornerRadius.bottomLeft - wrapper.cornerRadius.bottomRight);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2021-2023 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
|
|
@@ -76,7 +76,7 @@ export class RoundedCornerWrapper {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/*
|
|
79
|
-
* Scales the radius if necessary. (
|
|
79
|
+
* Scales the radius if necessary. (Percentile down scaling if the radius is bigger then the maximal allowed length)
|
|
80
80
|
*/
|
|
81
81
|
export function scaledRadius(radius: number, maximalLength: number): number {
|
|
82
82
|
if (radius <= maximalLength) {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snap.spec.d.ts","sourceRoot":"","sources":["../../../src/features/change-bounds/snap.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/********************************************************************************
|
|
3
|
-
* Copyright (c) 2022 EclipseSource and others.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials are made available under the
|
|
6
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
*
|
|
9
|
-
* This Source Code may also be made available under the following Secondary
|
|
10
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
* with the GNU Classpath Exception which is available at
|
|
13
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
*
|
|
15
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
********************************************************************************/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const chai_1 = require("chai");
|
|
19
|
-
const sprotty_1 = require("sprotty");
|
|
20
|
-
const snap_1 = require("./snap");
|
|
21
|
-
describe('GridSnapper', () => {
|
|
22
|
-
it('snap', () => {
|
|
23
|
-
const element = new sprotty_1.SModelElement();
|
|
24
|
-
const snapper = new snap_1.GridSnapper();
|
|
25
|
-
(0, chai_1.expect)(snapper.snap({ x: 0, y: 0 }, element)).to.be.deep.equals({ x: 0, y: 0 });
|
|
26
|
-
(0, chai_1.expect)(snapper.snap({ x: 4, y: 5 }, element)).to.be.deep.equals({ x: 0, y: 10 });
|
|
27
|
-
(0, chai_1.expect)(snapper.snap({ x: 8, y: 11 }, element)).to.be.deep.equals({ x: 10, y: 10 });
|
|
28
|
-
(0, chai_1.expect)(snapper.snap({ x: -7, y: -4 }, element)).to.be.deep.equals({ x: -10, y: -0 });
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
describe('PointPositionUpdater', () => {
|
|
32
|
-
it('updatePosition with no last drag position', () => {
|
|
33
|
-
const element = new sprotty_1.SModelElement();
|
|
34
|
-
const updater = new snap_1.PointPositionUpdater();
|
|
35
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 0, y: 0 }, false)).to.be.undefined;
|
|
36
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 0, y: 0 }, true)).to.be.undefined;
|
|
37
|
-
});
|
|
38
|
-
it('update last position and reset', () => {
|
|
39
|
-
const updater = new snap_1.PointPositionUpdater();
|
|
40
|
-
(0, chai_1.expect)(updater.isLastDragPositionUndefined()).to.be.true;
|
|
41
|
-
updater.updateLastDragPosition({ x: 0, y: 0 });
|
|
42
|
-
(0, chai_1.expect)(updater.isLastDragPositionUndefined()).to.be.false;
|
|
43
|
-
updater.resetPosition();
|
|
44
|
-
(0, chai_1.expect)(updater.isLastDragPositionUndefined()).to.be.true;
|
|
45
|
-
});
|
|
46
|
-
it('updatePosition with no snapper', () => {
|
|
47
|
-
const element = new sprotty_1.SModelElement();
|
|
48
|
-
const updater = new snap_1.PointPositionUpdater();
|
|
49
|
-
resetUpdater(updater);
|
|
50
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 0, y: 0 }, false)).to.be.undefined;
|
|
51
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 0, y: 0 }, true)).to.be.undefined;
|
|
52
|
-
resetUpdater(updater);
|
|
53
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 5, y: 3 }, false)).to.be.deep.equals({ x: 5, y: 3 });
|
|
54
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 5, y: 3 }, true)).to.be.undefined;
|
|
55
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 11, y: 6 }, false)).to.be.deep.equals({ x: 6, y: 3 });
|
|
56
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: -3, y: 2 }, true)).to.be.deep.equals({ x: -14, y: -4 });
|
|
57
|
-
});
|
|
58
|
-
it('updatePosition with snapper', () => {
|
|
59
|
-
const element = new sprotty_1.SModelElement();
|
|
60
|
-
const snapper = new snap_1.GridSnapper();
|
|
61
|
-
const updater = new snap_1.PointPositionUpdater(snapper);
|
|
62
|
-
resetUpdater(updater);
|
|
63
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 0, y: 0 }, false)).to.be.undefined;
|
|
64
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 0, y: 0 }, true)).to.be.undefined;
|
|
65
|
-
resetUpdater(updater);
|
|
66
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 5, y: 3 }, true)).to.be.deep.equals({ x: 10, y: 0 });
|
|
67
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 5, y: 3 }, true)).to.be.undefined;
|
|
68
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 11, y: 6 }, true)).to.be.deep.equals({ x: 0, y: 10 });
|
|
69
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: -3, y: 2 }, true)).to.be.deep.equals({ x: -10, y: -10 });
|
|
70
|
-
// disable snapping (alt key)
|
|
71
|
-
resetUpdater(updater);
|
|
72
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 5, y: 3 }, false)).to.be.deep.equals({ x: 5, y: 3 });
|
|
73
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 5, y: 3 }, false)).to.be.undefined;
|
|
74
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: 11, y: 6 }, false)).to.be.deep.equals({ x: 6, y: 3 });
|
|
75
|
-
(0, chai_1.expect)(updater.updatePosition(element, { x: -3, y: 2 }, false)).to.be.deep.equals({ x: -14, y: -4 });
|
|
76
|
-
});
|
|
77
|
-
function resetUpdater(updater) {
|
|
78
|
-
updater.resetPosition();
|
|
79
|
-
updater.updateLastDragPosition({ x: 0, y: 0 });
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
//# sourceMappingURL=snap.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snap.spec.js","sourceRoot":"","sources":["../../../src/features/change-bounds/snap.spec.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;AAElF,+BAA8B;AAC9B,qCAAwC;AACxC,iCAA2D;AAE3D,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACZ,MAAM,OAAO,GAAG,IAAI,uBAAa,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,IAAI,kBAAW,EAAE,CAAC;QAClC,IAAA,aAAM,EAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAChF,IAAA,aAAM,EAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACjF,IAAA,aAAM,EAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,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