@eclipse-glsp/client 1.1.0-next.6c2f3cc.244 → 1.1.0-next.6d6e326.247

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.
Files changed (60) hide show
  1. package/lib/features/accessibility/di.config.d.ts.map +1 -1
  2. package/lib/features/accessibility/di.config.js +10 -4
  3. package/lib/features/accessibility/di.config.js.map +1 -1
  4. package/lib/features/accessibility/move-zoom/di.config.d.ts +23 -0
  5. package/lib/features/accessibility/move-zoom/di.config.d.ts.map +1 -0
  6. package/lib/features/accessibility/move-zoom/di.config.js +41 -0
  7. package/lib/features/accessibility/move-zoom/di.config.js.map +1 -0
  8. package/lib/features/accessibility/move-zoom/move-handler.d.ts +81 -0
  9. package/lib/features/accessibility/move-zoom/move-handler.d.ts.map +1 -0
  10. package/lib/features/accessibility/move-zoom/move-handler.js +173 -0
  11. package/lib/features/accessibility/move-zoom/move-handler.js.map +1 -0
  12. package/lib/features/accessibility/move-zoom/zoom-handler.d.ts +74 -0
  13. package/lib/features/accessibility/move-zoom/zoom-handler.d.ts.map +1 -0
  14. package/lib/features/accessibility/move-zoom/zoom-handler.js +159 -0
  15. package/lib/features/accessibility/move-zoom/zoom-handler.js.map +1 -0
  16. package/lib/features/accessibility/resize-key-tool/di.config.d.ts +23 -0
  17. package/lib/features/accessibility/resize-key-tool/di.config.d.ts.map +1 -0
  18. package/lib/features/accessibility/resize-key-tool/di.config.js +38 -0
  19. package/lib/features/accessibility/resize-key-tool/di.config.js.map +1 -0
  20. package/lib/features/accessibility/resize-key-tool/resize-key-handler.d.ts +55 -0
  21. package/lib/features/accessibility/resize-key-tool/resize-key-handler.d.ts.map +1 -0
  22. package/lib/features/accessibility/resize-key-tool/resize-key-handler.js +126 -0
  23. package/lib/features/accessibility/resize-key-tool/resize-key-handler.js.map +1 -0
  24. package/lib/features/accessibility/resize-key-tool/resize-key-tool.d.ts +44 -0
  25. package/lib/features/accessibility/resize-key-tool/resize-key-tool.d.ts.map +1 -0
  26. package/lib/features/accessibility/resize-key-tool/resize-key-tool.js +127 -0
  27. package/lib/features/accessibility/resize-key-tool/resize-key-tool.js.map +1 -0
  28. package/lib/features/accessibility/view-key-tools/deselect-key-tool.d.ts +35 -0
  29. package/lib/features/accessibility/view-key-tools/deselect-key-tool.d.ts.map +1 -0
  30. package/lib/features/accessibility/view-key-tools/deselect-key-tool.js +87 -0
  31. package/lib/features/accessibility/view-key-tools/deselect-key-tool.js.map +1 -0
  32. package/lib/features/accessibility/view-key-tools/di.config.d.ts +20 -0
  33. package/lib/features/accessibility/view-key-tools/di.config.d.ts.map +1 -0
  34. package/lib/features/accessibility/view-key-tools/di.config.js +35 -0
  35. package/lib/features/accessibility/view-key-tools/di.config.js.map +1 -0
  36. package/lib/features/accessibility/view-key-tools/movement-key-tool.d.ts +49 -0
  37. package/lib/features/accessibility/view-key-tools/movement-key-tool.d.ts.map +1 -0
  38. package/lib/features/accessibility/view-key-tools/movement-key-tool.js +131 -0
  39. package/lib/features/accessibility/view-key-tools/movement-key-tool.js.map +1 -0
  40. package/lib/features/accessibility/view-key-tools/zoom-key-tool.d.ts +43 -0
  41. package/lib/features/accessibility/view-key-tools/zoom-key-tool.d.ts.map +1 -0
  42. package/lib/features/accessibility/view-key-tools/zoom-key-tool.js +109 -0
  43. package/lib/features/accessibility/view-key-tools/zoom-key-tool.js.map +1 -0
  44. package/lib/index.d.ts +8 -1
  45. package/lib/index.d.ts.map +1 -1
  46. package/lib/index.js +59 -49
  47. package/lib/index.js.map +1 -1
  48. package/package.json +3 -3
  49. package/src/features/accessibility/di.config.ts +8 -2
  50. package/src/features/accessibility/move-zoom/di.config.ts +43 -0
  51. package/src/features/accessibility/move-zoom/move-handler.ts +198 -0
  52. package/src/features/accessibility/move-zoom/zoom-handler.ts +178 -0
  53. package/src/features/accessibility/resize-key-tool/di.config.ts +37 -0
  54. package/src/features/accessibility/resize-key-tool/resize-key-handler.ts +120 -0
  55. package/src/features/accessibility/resize-key-tool/resize-key-tool.ts +108 -0
  56. package/src/features/accessibility/view-key-tools/deselect-key-tool.ts +80 -0
  57. package/src/features/accessibility/view-key-tools/di.config.ts +33 -0
  58. package/src/features/accessibility/view-key-tools/movement-key-tool.ts +115 -0
  59. package/src/features/accessibility/view-key-tools/zoom-key-tool.ts +94 -0
  60. package/src/index.ts +11 -1
@@ -1 +1 @@
1
- {"version":3,"file":"di.config.d.ts","sourceRoot":"","sources":["../../../src/features/accessibility/di.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C;;GAEG;AACH,eAAO,MAAM,uBAAuB,iBAGlC,CAAC"}
1
+ {"version":3,"file":"di.config.d.ts","sourceRoot":"","sources":["../../../src/features/accessibility/di.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAM5C;;GAEG;AACH,eAAO,MAAM,uBAAuB,iBAMlC,CAAC"}
@@ -17,12 +17,18 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.glspAccessibilityModule = void 0;
19
19
  const inversify_1 = require("inversify");
20
- const di_config_1 = require("./search/di.config");
20
+ const di_config_1 = require("./move-zoom/di.config");
21
+ const di_config_2 = require("./resize-key-tool/di.config");
22
+ const di_config_3 = require("./search/di.config");
23
+ const di_config_4 = require("./view-key-tools/di.config");
21
24
  /**
22
25
  * Enables the accessibility tools for a keyboard-only-usage
23
26
  */
24
- exports.glspAccessibilityModule = new inversify_1.ContainerModule((bind, _unbind, isBound, rebind) => {
25
- const context = { bind, isBound, rebind };
26
- (0, di_config_1.configureSearchPaletteModule)(context);
27
+ exports.glspAccessibilityModule = new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
28
+ const context = { bind, unbind, isBound, rebind };
29
+ (0, di_config_2.configureResizeTools)(context);
30
+ (0, di_config_4.configureViewKeyTools)(context);
31
+ (0, di_config_1.configureMoveZoom)(context);
32
+ (0, di_config_3.configureSearchPaletteModule)(context);
27
33
  });
28
34
  //# sourceMappingURL=di.config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"di.config.js","sourceRoot":"","sources":["../../../src/features/accessibility/di.config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,yCAA4C;AAC5C,kDAAkE;AAElE;;GAEG;AACU,QAAA,uBAAuB,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IAC1F,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAC1C,IAAA,wCAA4B,EAAC,OAAO,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"di.config.js","sourceRoot":"","sources":["../../../src/features/accessibility/di.config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,yCAA4C;AAC5C,qDAA0D;AAC1D,2DAAmE;AACnE,kDAAkE;AAClE,0DAAmE;AAEnE;;GAEG;AACU,QAAA,uBAAuB,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IACzF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClD,IAAA,gCAAoB,EAAC,OAAO,CAAC,CAAC;IAC9B,IAAA,iCAAqB,EAAC,OAAO,CAAC,CAAC;IAC/B,IAAA,6BAAiB,EAAC,OAAO,CAAC,CAAC;IAC3B,IAAA,wCAA4B,EAAC,OAAO,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 Business Informatics Group (TU Wien) and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { BindingContext } from '@eclipse-glsp/protocol';
17
+ import { ContainerModule } from 'inversify';
18
+ /**
19
+ * Handles move and zoom actions.
20
+ */
21
+ export declare const glspMoveZoomModule: ContainerModule;
22
+ export declare function configureMoveZoom(context: BindingContext): void;
23
+ //# sourceMappingURL=di.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"di.config.d.ts","sourceRoot":"","sources":["../../../../src/features/accessibility/move-zoom/di.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAK5C;;GAEG;AACH,eAAO,MAAM,kBAAkB,iBAG7B,CAAC;AAEH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAY/D"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2023 Business Informatics Group (TU Wien) 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
+ exports.configureMoveZoom = exports.glspMoveZoomModule = void 0;
19
+ const inversify_1 = require("inversify");
20
+ const sprotty_1 = require("sprotty");
21
+ const move_handler_1 = require("./move-handler");
22
+ const zoom_handler_1 = require("./zoom-handler");
23
+ /**
24
+ * Handles move and zoom actions.
25
+ */
26
+ exports.glspMoveZoomModule = new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
27
+ const context = { bind, unbind, isBound, rebind };
28
+ configureMoveZoom(context);
29
+ });
30
+ function configureMoveZoom(context) {
31
+ context.bind(move_handler_1.MoveViewportHandler).toSelf().inSingletonScope();
32
+ context.bind(move_handler_1.MoveElementHandler).toSelf().inSingletonScope();
33
+ context.bind(zoom_handler_1.ZoomViewportHandler).toSelf().inSingletonScope();
34
+ context.bind(zoom_handler_1.ZoomElementHandler).toSelf().inSingletonScope();
35
+ (0, sprotty_1.configureActionHandler)(context, move_handler_1.MoveViewportAction.KIND, move_handler_1.MoveViewportHandler);
36
+ (0, sprotty_1.configureActionHandler)(context, move_handler_1.MoveElementAction.KIND, move_handler_1.MoveElementHandler);
37
+ (0, sprotty_1.configureActionHandler)(context, zoom_handler_1.ZoomViewportAction.KIND, zoom_handler_1.ZoomViewportHandler);
38
+ (0, sprotty_1.configureActionHandler)(context, zoom_handler_1.ZoomElementAction.KIND, zoom_handler_1.ZoomElementHandler);
39
+ }
40
+ exports.configureMoveZoom = configureMoveZoom;
41
+ //# sourceMappingURL=di.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"di.config.js","sourceRoot":"","sources":["../../../../src/features/accessibility/move-zoom/di.config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAGlF,yCAA4C;AAC5C,qCAAiD;AACjD,iDAAgH;AAChH,iDAAgH;AAEhH;;GAEG;AACU,QAAA,kBAAkB,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IACpF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClD,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,SAAgB,iBAAiB,CAAC,OAAuB;IACrD,OAAO,CAAC,IAAI,CAAC,kCAAmB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC9D,OAAO,CAAC,IAAI,CAAC,iCAAkB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAE7D,OAAO,CAAC,IAAI,CAAC,kCAAmB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC9D,OAAO,CAAC,IAAI,CAAC,iCAAkB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAE7D,IAAA,gCAAsB,EAAC,OAAO,EAAE,iCAAkB,CAAC,IAAI,EAAE,kCAAmB,CAAC,CAAC;IAC9E,IAAA,gCAAsB,EAAC,OAAO,EAAE,gCAAiB,CAAC,IAAI,EAAE,iCAAkB,CAAC,CAAC;IAE5E,IAAA,gCAAsB,EAAC,OAAO,EAAE,iCAAkB,CAAC,IAAI,EAAE,kCAAmB,CAAC,CAAC;IAC9E,IAAA,gCAAsB,EAAC,OAAO,EAAE,gCAAiB,CAAC,IAAI,EAAE,iCAAkB,CAAC,CAAC;AAChF,CAAC;AAZD,8CAYC"}
@@ -0,0 +1,81 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 Business Informatics Group (TU Wien) and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Action, ChangeBoundsOperation, Point, SetViewportAction, Viewport } from '@eclipse-glsp/protocol';
17
+ import { IActionDispatcher, IActionHandler, ICommand, SModelRoot } from 'sprotty';
18
+ import { EditorContextService } from '../../../base/editor-context-service';
19
+ import { SelectableBoundsAware } from '../../../utils/smodel-util';
20
+ /**
21
+ * Action for triggering moving of the viewport.
22
+ */
23
+ export interface MoveViewportAction extends Action {
24
+ kind: typeof MoveViewportAction.KIND;
25
+ /**
26
+ * used to specify the amount to be moved in the x-axis
27
+ */
28
+ moveX: number;
29
+ /**
30
+ * used to specify the amount to be moved in the y-axis
31
+ */
32
+ moveY: number;
33
+ }
34
+ export declare namespace MoveViewportAction {
35
+ const KIND = "moveViewportAction";
36
+ function is(object: any): object is MoveViewportAction;
37
+ function create(moveX: number, moveY: number): MoveViewportAction;
38
+ }
39
+ /**
40
+ * Action for triggering moving of elements.
41
+ */
42
+ export interface MoveElementAction extends Action {
43
+ kind: typeof MoveElementAction.KIND;
44
+ /**
45
+ * used to specify the elements to be zoomed in/out
46
+ */
47
+ elementIds: string[];
48
+ /**
49
+ * used to specify the amount to be moved in the x-axis
50
+ */
51
+ moveX: number;
52
+ /**
53
+ * used to specify the amount to be moved in the y-axis
54
+ */
55
+ moveY: number;
56
+ }
57
+ export declare namespace MoveElementAction {
58
+ const KIND = "moveElementAction";
59
+ function is(object: any): object is MoveElementAction;
60
+ function create(elementIds: string[], moveX: number, moveY: number): MoveElementAction;
61
+ }
62
+ export declare class MoveViewportHandler implements IActionHandler {
63
+ protected editorContextService: EditorContextService;
64
+ protected dispatcher: IActionDispatcher;
65
+ protected readonly throttledHandleViewportMove: import("lodash").DebouncedFunc<(action: MoveViewportAction) => void>;
66
+ handle(action: Action): void | Action | ICommand;
67
+ handleMoveViewport(action: MoveViewportAction): void;
68
+ protected moveViewport(viewport: SModelRoot & Viewport, offsetX: number, offSetY: number): SetViewportAction;
69
+ }
70
+ export declare class MoveElementHandler implements IActionHandler {
71
+ protected editorContextService: EditorContextService;
72
+ protected dispatcher: IActionDispatcher;
73
+ protected readonly throttledHandleElementMove: import("lodash").DebouncedFunc<(action: MoveElementAction) => void>;
74
+ handle(action: Action): void | Action | ICommand;
75
+ handleMoveElement(action: MoveElementAction): void;
76
+ protected getBounds(element: SelectableBoundsAware, offSetX: number, offSetY: number): Point;
77
+ protected adaptViewport(viewport: SModelRoot & Viewport, newPoint: Point, moveX: number, moveY: number): MoveViewportAction | undefined;
78
+ protected moveElement(element: SelectableBoundsAware, offSetX: number, offSetY: number): ChangeBoundsOperation;
79
+ protected move(viewport: SModelRoot & Viewport, selectedElements: SelectableBoundsAware[], deltaX: number, deltaY: number): Action[];
80
+ }
81
+ //# sourceMappingURL=move-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-handler.d.ts","sourceRoot":"","sources":["../../../../src/features/accessibility/move-zoom/move-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAG3G,OAAO,EAAuB,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAc,UAAU,EAAE,MAAM,SAAS,CAAC;AACnH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAA2C,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAE5G;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,MAAM;IAC9C,IAAI,EAAE,OAAO,kBAAkB,CAAC,IAAI,CAAC;IACrC;;OAEG;IACH,KAAK,EAAE,MAAM,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W/G;AAID,qBACa,kBAAmB,YAAW,cAAc;IAErD,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IACpB,SAAS,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACzE,SAAS,CAAC,QAAQ,CAAC,0BAA0B,0CAAqB,iBAAiB,WAA0C;IAE7H,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ;IAMhD,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAWlD,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK;IAI5F,SAAS,CAAC,aAAa,CACnB,QAAQ,EAAE,UAAU,GAAG,QAAQ,EAC/B,QAAQ,EAAE,KAAK,EACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACd,kBAAkB,GAAG,SAAS;IAYjC,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,qBAAqB;IAgB9G,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,QAAQ,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;CAevI"}
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2023 Business Informatics Group (TU Wien) 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
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.MoveElementHandler = exports.MoveViewportHandler = exports.MoveElementAction = exports.MoveViewportAction = void 0;
28
+ const protocol_1 = require("@eclipse-glsp/protocol");
29
+ const inversify_1 = require("inversify");
30
+ const lodash_1 = require("lodash");
31
+ const sprotty_1 = require("sprotty");
32
+ const editor_context_service_1 = require("../../../base/editor-context-service");
33
+ const types_1 = require("../../../base/types");
34
+ const smodel_util_1 = require("../../../utils/smodel-util");
35
+ var MoveViewportAction;
36
+ (function (MoveViewportAction) {
37
+ MoveViewportAction.KIND = 'moveViewportAction';
38
+ function is(object) {
39
+ return protocol_1.Action.hasKind(object, MoveViewportAction.KIND);
40
+ }
41
+ MoveViewportAction.is = is;
42
+ function create(moveX, moveY) {
43
+ return { kind: MoveViewportAction.KIND, moveX, moveY };
44
+ }
45
+ MoveViewportAction.create = create;
46
+ })(MoveViewportAction = exports.MoveViewportAction || (exports.MoveViewportAction = {}));
47
+ var MoveElementAction;
48
+ (function (MoveElementAction) {
49
+ MoveElementAction.KIND = 'moveElementAction';
50
+ function is(object) {
51
+ return protocol_1.Action.hasKind(object, MoveElementAction.KIND);
52
+ }
53
+ MoveElementAction.is = is;
54
+ function create(elementIds, moveX, moveY) {
55
+ return { kind: MoveElementAction.KIND, elementIds, moveX, moveY };
56
+ }
57
+ MoveElementAction.create = create;
58
+ })(MoveElementAction = exports.MoveElementAction || (exports.MoveElementAction = {}));
59
+ /* The MoveViewportHandler class is an implementation of the IActionHandler interface that handles
60
+ moving of the viewport. */
61
+ let MoveViewportHandler = class MoveViewportHandler {
62
+ constructor() {
63
+ this.throttledHandleViewportMove = (0, lodash_1.throttle)((action) => this.handleMoveViewport(action), 150);
64
+ }
65
+ handle(action) {
66
+ if (MoveViewportAction.is(action)) {
67
+ this.throttledHandleViewportMove(action);
68
+ }
69
+ }
70
+ handleMoveViewport(action) {
71
+ const viewport = (0, sprotty_1.findParentByFeature)(this.editorContextService.modelRoot, sprotty_1.isViewport);
72
+ if (!viewport) {
73
+ return;
74
+ }
75
+ this.dispatcher.dispatch(this.moveViewport(viewport, action.moveX, action.moveY));
76
+ }
77
+ moveViewport(viewport, offsetX, offSetY) {
78
+ const newViewport = {
79
+ scroll: {
80
+ x: viewport.scroll.x + offsetX,
81
+ y: viewport.scroll.y + offSetY
82
+ },
83
+ zoom: viewport.zoom
84
+ };
85
+ return protocol_1.SetViewportAction.create(viewport.id, newViewport, { animate: true });
86
+ }
87
+ };
88
+ __decorate([
89
+ (0, inversify_1.inject)(editor_context_service_1.EditorContextService),
90
+ __metadata("design:type", editor_context_service_1.EditorContextService)
91
+ ], MoveViewportHandler.prototype, "editorContextService", void 0);
92
+ __decorate([
93
+ (0, inversify_1.inject)(types_1.TYPES.IActionDispatcher),
94
+ __metadata("design:type", Object)
95
+ ], MoveViewportHandler.prototype, "dispatcher", void 0);
96
+ MoveViewportHandler = __decorate([
97
+ (0, inversify_1.injectable)()
98
+ ], MoveViewportHandler);
99
+ exports.MoveViewportHandler = MoveViewportHandler;
100
+ /* The MoveElementHandler class is an implementation of the IActionHandler interface that handles
101
+ moving elements. */
102
+ let MoveElementHandler = class MoveElementHandler {
103
+ constructor() {
104
+ this.throttledHandleElementMove = (0, lodash_1.throttle)((action) => this.handleMoveElement(action), 150);
105
+ }
106
+ handle(action) {
107
+ if (MoveElementAction.is(action)) {
108
+ this.throttledHandleElementMove(action);
109
+ }
110
+ }
111
+ handleMoveElement(action) {
112
+ const viewport = (0, sprotty_1.findParentByFeature)(this.editorContextService.modelRoot, sprotty_1.isViewport);
113
+ if (!viewport) {
114
+ return;
115
+ }
116
+ const elements = (0, smodel_util_1.getElements)(this.editorContextService.modelRoot.index, action.elementIds, smodel_util_1.isSelectableAndBoundsAware);
117
+ this.dispatcher.dispatchAll(this.move(viewport, elements, action.moveX, action.moveY));
118
+ }
119
+ getBounds(element, offSetX, offSetY) {
120
+ return { x: element.bounds.x + offSetX, y: element.bounds.y + offSetY };
121
+ }
122
+ adaptViewport(viewport, newPoint, moveX, moveY) {
123
+ if (newPoint.x < viewport.scroll.x ||
124
+ newPoint.x > viewport.scroll.x + viewport.canvasBounds.width ||
125
+ newPoint.y < viewport.scroll.y ||
126
+ newPoint.y > viewport.scroll.y + viewport.canvasBounds.height) {
127
+ return MoveViewportAction.create(moveX, moveY);
128
+ }
129
+ return;
130
+ }
131
+ moveElement(element, offSetX, offSetY) {
132
+ return protocol_1.ChangeBoundsOperation.create([
133
+ {
134
+ elementId: element.id,
135
+ newSize: {
136
+ width: element.bounds.width,
137
+ height: element.bounds.height
138
+ },
139
+ newPosition: {
140
+ x: element.bounds.x + offSetX,
141
+ y: element.bounds.y + offSetY
142
+ }
143
+ }
144
+ ]);
145
+ }
146
+ move(viewport, selectedElements, deltaX, deltaY) {
147
+ const results = [];
148
+ if (selectedElements.length !== 0) {
149
+ selectedElements.forEach(currentElement => {
150
+ results.push(this.moveElement(currentElement, deltaX, deltaY));
151
+ const newPosition = this.getBounds(currentElement, deltaX, deltaY);
152
+ const viewportAction = this.adaptViewport(viewport, newPosition, deltaX, deltaY);
153
+ if (viewportAction) {
154
+ results.push(viewportAction);
155
+ }
156
+ });
157
+ }
158
+ return results;
159
+ }
160
+ };
161
+ __decorate([
162
+ (0, inversify_1.inject)(editor_context_service_1.EditorContextService),
163
+ __metadata("design:type", editor_context_service_1.EditorContextService)
164
+ ], MoveElementHandler.prototype, "editorContextService", void 0);
165
+ __decorate([
166
+ (0, inversify_1.inject)(types_1.TYPES.IActionDispatcher),
167
+ __metadata("design:type", Object)
168
+ ], MoveElementHandler.prototype, "dispatcher", void 0);
169
+ MoveElementHandler = __decorate([
170
+ (0, inversify_1.injectable)()
171
+ ], MoveElementHandler);
172
+ exports.MoveElementHandler = MoveElementHandler;
173
+ //# sourceMappingURL=move-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-handler.js","sourceRoot":"","sources":["../../../../src/features/accessibility/move-zoom/move-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,qDAA2G;AAC3G,yCAA+C;AAC/C,mCAAkC;AAClC,qCAAmH;AACnH,iFAA4E;AAC5E,+CAA4C;AAC5C,4DAA4G;AAiB5G,IAAiB,kBAAkB,CAUlC;AAVD,WAAiB,kBAAkB;IAClB,uBAAI,GAAG,oBAAoB,CAAC;IAEzC,SAAgB,EAAE,CAAC,MAAW;QAC1B,OAAO,iBAAM,CAAC,OAAO,CAAC,MAAM,EAAE,mBAAA,IAAI,CAAC,CAAC;IACxC,CAAC;IAFe,qBAAE,KAEjB,CAAA;IAED,SAAgB,MAAM,CAAC,KAAa,EAAE,KAAa;QAC/C,OAAO,EAAE,IAAI,EAAE,mBAAA,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACxC,CAAC;IAFe,yBAAM,SAErB,CAAA;AACL,CAAC,EAVgB,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAUlC;AAqBD,IAAiB,iBAAiB,CAUjC;AAVD,WAAiB,iBAAiB;IACjB,sBAAI,GAAG,mBAAmB,CAAC;IAExC,SAAgB,EAAE,CAAC,MAAW;QAC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E,gBAAyC,EAAE,MAAc,EAAE,MAAc;QACrH,MAAM,OAAO,GAAa,EAAE,CAAC;QAE7B,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,gBAAgB,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE;gBACtC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;gBAC/D,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;gBACnE,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;gBACjF,IAAI,cAAc,EAAE;oBAChB,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;iBAChC;YACL,CAAC,CAAC,CAAC;SACN;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ,CAAA;AA1EG;IAAC,IAAA,kBAAM,EAAC,6CAAoB,CAAC;8BACG,6CAAoB;gEAAC;AACrD;IAAC,IAAA,kBAAM,EAAC,aAAK,CAAC,iBAAiB,CAAC;;sDAAyC;AAHhE,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CA2E9B;AA3EY,gDAAkB"}
@@ -0,0 +1,74 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 Business Informatics Group (TU Wien) and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Action, Bounds, Point, SetViewportAction, Viewport } from '@eclipse-glsp/protocol';
17
+ import { IActionDispatcher, IActionHandler, ICommand, SModelElement, SModelRoot } from 'sprotty';
18
+ import { EditorContextService } from '../../../base/editor-context-service';
19
+ import { SelectableBoundsAware } from '../../../utils/smodel-util';
20
+ /**
21
+ * Action for triggering zooming of the viewport.
22
+ */
23
+ export interface ZoomViewportAction extends Action {
24
+ kind: typeof ZoomViewportAction.KIND;
25
+ /**
26
+ * used to specify the amount by which the viewport should be zoomed
27
+ */
28
+ zoomFactor: number;
29
+ }
30
+ export declare namespace ZoomViewportAction {
31
+ const KIND = "zoomViewportAction";
32
+ function is(object: any): object is ZoomViewportAction;
33
+ function create(zoomFactor: number): ZoomViewportAction;
34
+ }
35
+ /**
36
+ * Action for triggering zooming of the elements..
37
+ */
38
+ export interface ZoomElementAction extends Action {
39
+ kind: typeof ZoomElementAction.KIND;
40
+ /**
41
+ * used to specify the elements to be zoomed in/out
42
+ */
43
+ elementIds: string[];
44
+ /**
45
+ * used to specify the amount by which the viewport should be zoomed
46
+ */
47
+ zoomFactor: number;
48
+ }
49
+ export declare namespace ZoomElementAction {
50
+ const KIND = "zoomElementAction";
51
+ function is(object: any): object is ZoomElementAction;
52
+ function create(elementIds: string[], zoomFactor: number): ZoomElementAction;
53
+ }
54
+ export declare class ZoomViewportHandler implements IActionHandler {
55
+ protected editorContextService: EditorContextService;
56
+ static readonly defaultZoomInFactor = 1.1;
57
+ static readonly defaultZoomOutFactor = 0.9;
58
+ protected dispatcher: IActionDispatcher;
59
+ protected readonly throttledHandleViewportZoom: import("lodash").DebouncedFunc<(action: ZoomViewportAction) => void>;
60
+ handle(action: Action): void;
61
+ handleZoomViewport(action: ZoomViewportAction): void;
62
+ protected setNewZoomFactor(viewport: SModelRoot & Viewport, zoomFactor: number): SetViewportAction;
63
+ }
64
+ export declare class ZoomElementHandler implements IActionHandler {
65
+ protected editorContextService: EditorContextService;
66
+ protected dispatcher: IActionDispatcher;
67
+ protected readonly throttledHandleElementZoom: import("lodash").DebouncedFunc<(action: ZoomElementAction) => void>;
68
+ handle(action: Action): void | Action | ICommand;
69
+ handleZoomElement(action: ZoomElementAction): void;
70
+ protected getCenter(viewport: SModelRoot & Viewport, selectedElements: SelectableBoundsAware[]): Point;
71
+ protected boundsInViewport(viewport: SModelRoot & Viewport, element: SModelElement, bounds: Bounds): Bounds;
72
+ protected setNewZoomFactor(viewport: SModelRoot & Viewport, zoomFactor: number, point: Point): SetViewportAction;
73
+ }
74
+ //# sourceMappingURL=zoom-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zoom-handler.d.ts","sourceRoot":"","sources":["../../../../src/features/accessibility/move-zoom/zoom-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAG5F,OAAO,EAEH,iBAAiB,EACjB,cAAc,EACd,QAAQ,EAGR,aAAa,EACb,UAAU,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAA2C,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAE5G;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,MAAM;IAC9C,IAAI,EAAE,OAAO,kBAAkB,CAAC,IAAI,CAAC;IACrC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,yBAAiB,kBAAkB,CAAC;IACzB,MAAM,IAAI,uBAAuB,CAAC;IAEzC,SAAgB,EAAE,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,kBAAkB,CAE5D;IAED,SAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,CAE7D;CACJ;AAED;;GAEG;AACH,MAAM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AAS,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,GAAG,QAAQ,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,GAAG,KAAK;IAQtG,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,GAAG,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAQ3G,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,GAAG,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,iBAAiB;CAanH"}
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2023 Business Informatics Group (TU Wien) 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
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.ZoomElementHandler = exports.ZoomViewportHandler = exports.ZoomElementAction = exports.ZoomViewportAction = void 0;
28
+ const protocol_1 = require("@eclipse-glsp/protocol");
29
+ const inversify_1 = require("inversify");
30
+ const lodash_1 = require("lodash");
31
+ const sprotty_1 = require("sprotty");
32
+ const editor_context_service_1 = require("../../../base/editor-context-service");
33
+ const types_1 = require("../../../base/types");
34
+ const smodel_util_1 = require("../../../utils/smodel-util");
35
+ var ZoomViewportAction;
36
+ (function (ZoomViewportAction) {
37
+ ZoomViewportAction.KIND = 'zoomViewportAction';
38
+ function is(object) {
39
+ return protocol_1.Action.hasKind(object, ZoomViewportAction.KIND);
40
+ }
41
+ ZoomViewportAction.is = is;
42
+ function create(zoomFactor) {
43
+ return { kind: ZoomViewportAction.KIND, zoomFactor };
44
+ }
45
+ ZoomViewportAction.create = create;
46
+ })(ZoomViewportAction = exports.ZoomViewportAction || (exports.ZoomViewportAction = {}));
47
+ var ZoomElementAction;
48
+ (function (ZoomElementAction) {
49
+ ZoomElementAction.KIND = 'zoomElementAction';
50
+ function is(object) {
51
+ return protocol_1.Action.hasKind(object, ZoomElementAction.KIND);
52
+ }
53
+ ZoomElementAction.is = is;
54
+ function create(elementIds, zoomFactor) {
55
+ return { kind: ZoomElementAction.KIND, elementIds, zoomFactor };
56
+ }
57
+ ZoomElementAction.create = create;
58
+ })(ZoomElementAction = exports.ZoomElementAction || (exports.ZoomElementAction = {}));
59
+ /* The ZoomViewportHandler class is an implementation of the IActionHandler interface that handles
60
+ zooming in and out of a viewport. */
61
+ let ZoomViewportHandler = class ZoomViewportHandler {
62
+ constructor() {
63
+ this.throttledHandleViewportZoom = (0, lodash_1.throttle)((action) => this.handleZoomViewport(action), 150);
64
+ }
65
+ handle(action) {
66
+ if (ZoomViewportAction.is(action)) {
67
+ this.throttledHandleViewportZoom(action);
68
+ }
69
+ }
70
+ handleZoomViewport(action) {
71
+ const viewport = (0, sprotty_1.findParentByFeature)(this.editorContextService.modelRoot, sprotty_1.isViewport);
72
+ if (!viewport) {
73
+ return;
74
+ }
75
+ this.dispatcher.dispatch(this.setNewZoomFactor(viewport, action.zoomFactor));
76
+ }
77
+ setNewZoomFactor(viewport, zoomFactor) {
78
+ const newZoom = viewport.zoom * zoomFactor;
79
+ const newViewport = {
80
+ scroll: viewport.scroll,
81
+ zoom: newZoom
82
+ };
83
+ return protocol_1.SetViewportAction.create(viewport.id, newViewport, { animate: true });
84
+ }
85
+ };
86
+ ZoomViewportHandler.defaultZoomInFactor = 1.1;
87
+ ZoomViewportHandler.defaultZoomOutFactor = 0.9;
88
+ __decorate([
89
+ (0, inversify_1.inject)(editor_context_service_1.EditorContextService),
90
+ __metadata("design:type", editor_context_service_1.EditorContextService)
91
+ ], ZoomViewportHandler.prototype, "editorContextService", void 0);
92
+ __decorate([
93
+ (0, inversify_1.inject)(types_1.TYPES.IActionDispatcher),
94
+ __metadata("design:type", Object)
95
+ ], ZoomViewportHandler.prototype, "dispatcher", void 0);
96
+ ZoomViewportHandler = __decorate([
97
+ (0, inversify_1.injectable)()
98
+ ], ZoomViewportHandler);
99
+ exports.ZoomViewportHandler = ZoomViewportHandler;
100
+ /* The ZoomElementHandler class is an implementation of the IActionHandler interface that handles
101
+ zooming in and out of elements. */
102
+ let ZoomElementHandler = class ZoomElementHandler {
103
+ constructor() {
104
+ this.throttledHandleElementZoom = (0, lodash_1.throttle)((action) => this.handleZoomElement(action), 150);
105
+ }
106
+ handle(action) {
107
+ if (ZoomElementAction.is(action)) {
108
+ this.throttledHandleElementZoom(action);
109
+ }
110
+ }
111
+ handleZoomElement(action) {
112
+ const viewport = (0, sprotty_1.findParentByFeature)(this.editorContextService.modelRoot, sprotty_1.isViewport);
113
+ if (!viewport) {
114
+ return;
115
+ }
116
+ const elements = (0, smodel_util_1.getElements)(this.editorContextService.modelRoot.index, action.elementIds, smodel_util_1.isSelectableAndBoundsAware);
117
+ const center = this.getCenter(viewport, elements);
118
+ this.dispatcher.dispatch(this.setNewZoomFactor(viewport, action.zoomFactor, center));
119
+ }
120
+ getCenter(viewport, selectedElements) {
121
+ // Get bounds of elements based on the viewport
122
+ const allBounds = selectedElements.map(e => this.boundsInViewport(viewport, e, e.bounds));
123
+ const mergedBounds = allBounds.reduce((b0, b1) => protocol_1.Bounds.combine(b0, b1));
124
+ return protocol_1.Bounds.center(mergedBounds);
125
+ }
126
+ // copy from center-fit.ts, translates the children bounds to the viewport bounds
127
+ boundsInViewport(viewport, element, bounds) {
128
+ if (element instanceof sprotty_1.SChildElement && element.parent !== viewport) {
129
+ return this.boundsInViewport(viewport, element.parent, element.parent.localToParent(bounds));
130
+ }
131
+ else {
132
+ return bounds;
133
+ }
134
+ }
135
+ setNewZoomFactor(viewport, zoomFactor, point) {
136
+ const newZoom = viewport.zoom * zoomFactor;
137
+ const newViewport = {
138
+ scroll: {
139
+ x: point.x - (0.5 * viewport.canvasBounds.width) / newZoom,
140
+ y: point.y - (0.5 * viewport.canvasBounds.height) / newZoom
141
+ },
142
+ zoom: newZoom
143
+ };
144
+ return protocol_1.SetViewportAction.create(viewport.id, newViewport, { animate: true });
145
+ }
146
+ };
147
+ __decorate([
148
+ (0, inversify_1.inject)(editor_context_service_1.EditorContextService),
149
+ __metadata("design:type", editor_context_service_1.EditorContextService)
150
+ ], ZoomElementHandler.prototype, "editorContextService", void 0);
151
+ __decorate([
152
+ (0, inversify_1.inject)(types_1.TYPES.IActionDispatcher),
153
+ __metadata("design:type", Object)
154
+ ], ZoomElementHandler.prototype, "dispatcher", void 0);
155
+ ZoomElementHandler = __decorate([
156
+ (0, inversify_1.injectable)()
157
+ ], ZoomElementHandler);
158
+ exports.ZoomElementHandler = ZoomElementHandler;
159
+ //# sourceMappingURL=zoom-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zoom-handler.js","sourceRoot":"","sources":["../../../../src/features/accessibility/move-zoom/zoom-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;k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