@eclipse-glsp/client 2.1.0-next.300 → 2.1.0-next.302
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/glsp-sprotty.css +1 -0
- package/css/helper-lines.css +33 -0
- package/lib/base/auto-complete/index.d.ts +21 -0
- package/lib/base/auto-complete/index.d.ts.map +1 -0
- package/lib/base/auto-complete/index.js +37 -0
- package/lib/base/auto-complete/index.js.map +1 -0
- package/lib/base/feedback/index.d.ts +20 -0
- package/lib/base/feedback/index.d.ts.map +1 -0
- package/lib/base/feedback/index.js +36 -0
- package/lib/base/feedback/index.js.map +1 -0
- package/lib/base/focus/index.d.ts +18 -0
- package/lib/base/focus/index.d.ts.map +1 -0
- package/lib/base/focus/index.js +34 -0
- package/lib/base/focus/index.js.map +1 -0
- package/lib/base/index.d.ts +32 -0
- package/lib/base/index.d.ts.map +1 -0
- package/lib/base/index.js +48 -0
- package/lib/base/index.js.map +1 -0
- package/lib/base/model/index.d.ts +20 -0
- package/lib/base/model/index.d.ts.map +1 -0
- package/lib/base/model/index.js +36 -0
- package/lib/base/model/index.js.map +1 -0
- package/lib/base/tool-manager/index.d.ts +18 -0
- package/lib/base/tool-manager/index.d.ts.map +1 -0
- package/lib/base/tool-manager/index.js +34 -0
- package/lib/base/tool-manager/index.js.map +1 -0
- package/lib/base/view/index.d.ts +19 -0
- package/lib/base/view/index.d.ts.map +1 -0
- package/lib/base/view/index.js +35 -0
- package/lib/base/view/index.js.map +1 -0
- package/lib/default-modules.js +4 -4
- package/lib/default-modules.js.map +1 -1
- package/lib/features/accessibility/edge-autocomplete/index.d.ts +20 -0
- package/lib/features/accessibility/edge-autocomplete/index.d.ts.map +1 -0
- package/lib/features/accessibility/edge-autocomplete/index.js +36 -0
- package/lib/features/accessibility/edge-autocomplete/index.js.map +1 -0
- package/lib/features/accessibility/element-navigation/index.d.ts +22 -0
- package/lib/features/accessibility/element-navigation/index.d.ts.map +1 -0
- package/lib/features/accessibility/element-navigation/index.js +38 -0
- package/lib/features/accessibility/element-navigation/index.js.map +1 -0
- package/lib/features/accessibility/focus-tracker/index.d.ts +18 -0
- package/lib/features/accessibility/focus-tracker/index.d.ts.map +1 -0
- package/lib/features/accessibility/focus-tracker/index.js +34 -0
- package/lib/features/accessibility/focus-tracker/index.js.map +1 -0
- package/lib/features/accessibility/index.d.ts +31 -0
- package/lib/features/accessibility/index.d.ts.map +1 -0
- package/lib/features/accessibility/index.js +47 -0
- package/lib/features/accessibility/index.js.map +1 -0
- package/lib/features/accessibility/key-shortcut/index.d.ts +19 -0
- package/lib/features/accessibility/key-shortcut/index.d.ts.map +1 -0
- package/lib/features/accessibility/key-shortcut/index.js +35 -0
- package/lib/features/accessibility/key-shortcut/index.js.map +1 -0
- package/lib/features/accessibility/keyboard-grid/index.d.ts +21 -0
- package/lib/features/accessibility/keyboard-grid/index.d.ts.map +1 -0
- package/lib/features/accessibility/keyboard-grid/index.js +37 -0
- package/lib/features/accessibility/keyboard-grid/index.js.map +1 -0
- package/lib/features/accessibility/keyboard-pointer/index.d.ts +22 -0
- package/lib/features/accessibility/keyboard-pointer/index.d.ts.map +1 -0
- package/lib/features/accessibility/keyboard-pointer/index.js +38 -0
- package/lib/features/accessibility/keyboard-pointer/index.js.map +1 -0
- package/lib/features/accessibility/keyboard-tool-palette/index.d.ts +18 -0
- package/lib/features/accessibility/keyboard-tool-palette/index.d.ts.map +1 -0
- package/lib/features/accessibility/keyboard-tool-palette/index.js +34 -0
- package/lib/features/accessibility/keyboard-tool-palette/index.js.map +1 -0
- package/lib/features/accessibility/move-zoom/index.d.ts +19 -0
- package/lib/features/accessibility/move-zoom/index.d.ts.map +1 -0
- package/lib/features/accessibility/move-zoom/index.js +35 -0
- package/lib/features/accessibility/move-zoom/index.js.map +1 -0
- package/lib/features/accessibility/resize-key-tool/index.d.ts +19 -0
- package/lib/features/accessibility/resize-key-tool/index.d.ts.map +1 -0
- package/lib/features/accessibility/resize-key-tool/index.js +35 -0
- package/lib/features/accessibility/resize-key-tool/index.js.map +1 -0
- package/lib/features/accessibility/search/index.d.ts +19 -0
- package/lib/features/accessibility/search/index.d.ts.map +1 -0
- package/lib/features/accessibility/search/index.js +35 -0
- package/lib/features/accessibility/search/index.js.map +1 -0
- package/lib/features/accessibility/toast/index.d.ts +19 -0
- package/lib/features/accessibility/toast/index.d.ts.map +1 -0
- package/lib/features/accessibility/toast/index.js +35 -0
- package/lib/features/accessibility/toast/index.js.map +1 -0
- package/lib/features/accessibility/view-key-tools/index.d.ts +20 -0
- package/lib/features/accessibility/view-key-tools/index.d.ts.map +1 -0
- package/lib/features/accessibility/view-key-tools/index.js +36 -0
- package/lib/features/accessibility/view-key-tools/index.js.map +1 -0
- package/lib/features/accessibility/view-key-tools/movement-key-tool.d.ts +6 -3
- package/lib/features/accessibility/view-key-tools/movement-key-tool.d.ts.map +1 -1
- package/lib/features/accessibility/view-key-tools/movement-key-tool.js +12 -17
- package/lib/features/accessibility/view-key-tools/movement-key-tool.js.map +1 -1
- package/lib/features/bounds/bounds-module.d.ts.map +1 -1
- package/lib/features/bounds/bounds-module.js +3 -1
- package/lib/features/bounds/bounds-module.js.map +1 -1
- package/lib/features/bounds/index.d.ts +24 -0
- package/lib/features/bounds/index.d.ts.map +1 -0
- package/lib/features/bounds/index.js +40 -0
- package/lib/features/bounds/index.js.map +1 -0
- package/lib/features/bounds/local-bounds.d.ts +2 -1
- package/lib/features/bounds/local-bounds.d.ts.map +1 -1
- package/lib/features/bounds/local-bounds.js +7 -0
- package/lib/features/bounds/local-bounds.js.map +1 -1
- package/lib/features/bounds/set-bounds-feedback-command.d.ts +1 -1
- package/lib/features/bounds/set-bounds-feedback-command.d.ts.map +1 -1
- package/lib/features/bounds/set-bounds-feedback-command.js +7 -7
- package/lib/features/bounds/set-bounds-feedback-command.js.map +1 -1
- package/lib/features/change-bounds/index.d.ts +21 -0
- package/lib/features/change-bounds/index.d.ts.map +1 -0
- package/lib/features/change-bounds/index.js +37 -0
- package/lib/features/change-bounds/index.js.map +1 -0
- package/lib/features/change-bounds/model.d.ts +4 -0
- package/lib/features/change-bounds/model.d.ts.map +1 -1
- package/lib/features/change-bounds/model.js +14 -2
- package/lib/features/change-bounds/model.js.map +1 -1
- package/lib/features/change-bounds/point-position-updater.d.ts +63 -0
- package/lib/features/change-bounds/point-position-updater.d.ts.map +1 -0
- package/lib/features/change-bounds/point-position-updater.js +87 -0
- package/lib/features/change-bounds/point-position-updater.js.map +1 -0
- package/lib/features/change-bounds/position-snapper.d.ts +28 -0
- package/lib/features/change-bounds/position-snapper.d.ts.map +1 -0
- package/lib/features/change-bounds/position-snapper.js +88 -0
- package/lib/features/change-bounds/position-snapper.js.map +1 -0
- package/lib/features/change-bounds/snap.d.ts +19 -42
- package/lib/features/change-bounds/snap.d.ts.map +1 -1
- package/lib/features/change-bounds/snap.js +9 -92
- package/lib/features/change-bounds/snap.js.map +1 -1
- package/lib/features/change-bounds/snap.spec.js +6 -5
- package/lib/features/change-bounds/snap.spec.js.map +1 -1
- package/lib/features/command-palette/index.d.ts +19 -0
- package/lib/features/command-palette/index.d.ts.map +1 -0
- package/lib/features/command-palette/index.js +35 -0
- package/lib/features/command-palette/index.js.map +1 -0
- package/lib/features/context-menu/index.d.ts +20 -0
- package/lib/features/context-menu/index.d.ts.map +1 -0
- package/lib/features/context-menu/index.js +36 -0
- package/lib/features/context-menu/index.js.map +1 -0
- package/lib/features/copy-paste/index.d.ts +20 -0
- package/lib/features/copy-paste/index.d.ts.map +1 -0
- package/lib/features/copy-paste/index.js +36 -0
- package/lib/features/copy-paste/index.js.map +1 -0
- package/lib/features/decoration/index.d.ts +18 -0
- package/lib/features/decoration/index.d.ts.map +1 -0
- package/lib/features/decoration/index.js +34 -0
- package/lib/features/decoration/index.js.map +1 -0
- package/lib/features/element-template/index.d.ts +20 -0
- package/lib/features/element-template/index.d.ts.map +1 -0
- package/lib/features/element-template/index.js +36 -0
- package/lib/features/element-template/index.js.map +1 -0
- package/lib/features/element-template/mouse-tracking-element-position-listener.d.ts +6 -3
- package/lib/features/element-template/mouse-tracking-element-position-listener.d.ts.map +1 -1
- package/lib/features/element-template/mouse-tracking-element-position-listener.js +23 -18
- package/lib/features/element-template/mouse-tracking-element-position-listener.js.map +1 -1
- package/lib/features/export/index.d.ts +19 -0
- package/lib/features/export/index.d.ts.map +1 -0
- package/lib/features/export/index.js +35 -0
- package/lib/features/export/index.js.map +1 -0
- package/lib/features/helper-lines/helper-line-feedback.d.ts +64 -0
- package/lib/features/helper-lines/helper-line-feedback.d.ts.map +1 -0
- package/lib/features/helper-lines/helper-line-feedback.js +218 -0
- package/lib/features/helper-lines/helper-line-feedback.js.map +1 -0
- package/lib/features/helper-lines/helper-line-manager-default.d.ts +46 -0
- package/lib/features/helper-lines/helper-line-manager-default.d.ts.map +1 -0
- package/lib/features/helper-lines/helper-line-manager-default.js +122 -0
- package/lib/features/helper-lines/helper-line-manager-default.js.map +1 -0
- package/lib/features/helper-lines/helper-line-manager.d.ts +21 -0
- package/lib/features/helper-lines/helper-line-manager.d.ts.map +1 -0
- package/lib/features/helper-lines/helper-line-manager.js +3 -0
- package/lib/features/helper-lines/helper-line-manager.js.map +1 -0
- package/lib/features/helper-lines/helper-line-module.d.ts +18 -0
- package/lib/features/helper-lines/helper-line-module.d.ts.map +1 -0
- package/lib/features/helper-lines/helper-line-module.js +39 -0
- package/lib/features/helper-lines/helper-line-module.js.map +1 -0
- package/lib/features/helper-lines/index.d.ts +22 -0
- package/lib/features/helper-lines/index.d.ts.map +1 -0
- package/lib/features/helper-lines/index.js +38 -0
- package/lib/features/helper-lines/index.js.map +1 -0
- package/lib/features/helper-lines/model.d.ts +62 -0
- package/lib/features/helper-lines/model.d.ts.map +1 -0
- package/lib/features/helper-lines/model.js +123 -0
- package/lib/features/helper-lines/model.js.map +1 -0
- package/lib/features/helper-lines/view.d.ts +25 -0
- package/lib/features/helper-lines/view.d.ts.map +1 -0
- package/lib/features/helper-lines/view.js +52 -0
- package/lib/features/helper-lines/view.js.map +1 -0
- package/lib/features/hints/index.d.ts +19 -0
- package/lib/features/hints/index.d.ts.map +1 -0
- package/lib/features/hints/index.js +35 -0
- package/lib/features/hints/index.js.map +1 -0
- package/lib/features/hover/index.d.ts +18 -0
- package/lib/features/hover/index.d.ts.map +1 -0
- package/lib/features/hover/index.js +34 -0
- package/lib/features/hover/index.js.map +1 -0
- package/lib/features/index.d.ts +43 -0
- package/lib/features/index.d.ts.map +1 -0
- package/lib/features/index.js +59 -0
- package/lib/features/index.js.map +1 -0
- package/lib/features/label-edit/index.d.ts +19 -0
- package/lib/features/label-edit/index.d.ts.map +1 -0
- package/lib/features/label-edit/index.js +35 -0
- package/lib/features/label-edit/index.js.map +1 -0
- package/lib/features/layout/index.d.ts +18 -0
- package/lib/features/layout/index.d.ts.map +1 -0
- package/lib/features/layout/index.js +34 -0
- package/lib/features/layout/index.js.map +1 -0
- package/lib/features/navigation/index.d.ts +19 -0
- package/lib/features/navigation/index.d.ts.map +1 -0
- package/lib/features/navigation/index.js +35 -0
- package/lib/features/navigation/index.js.map +1 -0
- package/lib/features/reconnect/index.d.ts +17 -0
- package/lib/features/reconnect/index.d.ts.map +1 -0
- package/lib/features/reconnect/index.js +33 -0
- package/lib/features/reconnect/index.js.map +1 -0
- package/lib/features/routing/index.d.ts +18 -0
- package/lib/features/routing/index.d.ts.map +1 -0
- package/lib/features/routing/index.js +34 -0
- package/lib/features/routing/index.js.map +1 -0
- package/lib/features/save/index.d.ts +18 -0
- package/lib/features/save/index.d.ts.map +1 -0
- package/lib/features/save/index.js +34 -0
- package/lib/features/save/index.js.map +1 -0
- package/lib/features/select/index.d.ts +19 -0
- package/lib/features/select/index.d.ts.map +1 -0
- package/lib/features/select/index.js +35 -0
- package/lib/features/select/index.js.map +1 -0
- package/lib/features/source-model-watcher/index.d.ts +18 -0
- package/lib/features/source-model-watcher/index.d.ts.map +1 -0
- package/lib/features/source-model-watcher/index.js +34 -0
- package/lib/features/source-model-watcher/index.js.map +1 -0
- package/lib/features/source-model-watcher/{source-model-wacher-module.d.ts → source-model-watcher-module.d.ts} +1 -1
- package/lib/features/source-model-watcher/source-model-watcher-module.d.ts.map +1 -0
- package/lib/features/source-model-watcher/{source-model-wacher-module.js → source-model-watcher-module.js} +1 -1
- package/lib/features/source-model-watcher/source-model-watcher-module.js.map +1 -0
- package/lib/features/status/index.d.ts +18 -0
- package/lib/features/status/index.d.ts.map +1 -0
- package/lib/features/status/index.js +34 -0
- package/lib/features/status/index.js.map +1 -0
- package/lib/features/svg-metadata/index.d.ts +18 -0
- package/lib/features/svg-metadata/index.d.ts.map +1 -0
- package/lib/features/svg-metadata/index.js +34 -0
- package/lib/features/svg-metadata/index.js.map +1 -0
- package/lib/features/tool-palette/index.d.ts +18 -0
- package/lib/features/tool-palette/index.d.ts.map +1 -0
- package/lib/features/tool-palette/index.js +34 -0
- package/lib/features/tool-palette/index.js.map +1 -0
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.d.ts +28 -12
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js +91 -51
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js.map +1 -1
- package/lib/features/tools/change-bounds/{change-boounds-tool-module.d.ts → change-bounds-tool-module.d.ts} +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-module.d.ts.map +1 -0
- package/lib/features/tools/change-bounds/{change-boounds-tool-module.js → change-bounds-tool-module.js} +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-module.js.map +1 -0
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts +4 -4
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.js +11 -13
- package/lib/features/tools/change-bounds/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/change-bounds/index.d.ts +20 -0
- package/lib/features/tools/change-bounds/index.d.ts.map +1 -0
- package/lib/features/tools/change-bounds/index.js +36 -0
- package/lib/features/tools/change-bounds/index.js.map +1 -0
- package/lib/features/tools/deletion/index.d.ts +18 -0
- package/lib/features/tools/deletion/index.d.ts.map +1 -0
- package/lib/features/tools/deletion/index.js +34 -0
- package/lib/features/tools/deletion/index.js.map +1 -0
- package/lib/features/tools/edge-creation/index.d.ts +21 -0
- package/lib/features/tools/edge-creation/index.d.ts.map +1 -0
- package/lib/features/tools/edge-creation/index.js +37 -0
- package/lib/features/tools/edge-creation/index.js.map +1 -0
- package/lib/features/tools/edge-edit/edge-edit-tool-feedback.d.ts +20 -6
- package/lib/features/tools/edge-edit/edge-edit-tool-feedback.d.ts.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool-feedback.js +10 -14
- package/lib/features/tools/edge-edit/edge-edit-tool-feedback.js.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool.d.ts +18 -2
- package/lib/features/tools/edge-edit/edge-edit-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool.js +6 -6
- package/lib/features/tools/edge-edit/edge-edit-tool.js.map +1 -1
- package/lib/features/tools/edge-edit/index.d.ts +19 -0
- package/lib/features/tools/edge-edit/index.d.ts.map +1 -0
- package/lib/features/tools/edge-edit/index.js +35 -0
- package/lib/features/tools/edge-edit/index.js.map +1 -0
- package/lib/features/tools/index.d.ts +24 -0
- package/lib/features/tools/index.d.ts.map +1 -0
- package/lib/features/tools/index.js +40 -0
- package/lib/features/tools/index.js.map +1 -0
- package/lib/features/tools/marquee-selection/index.d.ts +23 -0
- package/lib/features/tools/marquee-selection/index.d.ts.map +1 -0
- package/lib/features/tools/marquee-selection/index.js +39 -0
- package/lib/features/tools/marquee-selection/index.js.map +1 -0
- package/lib/features/tools/marquee-selection/marquee-tool.d.ts +20 -1
- package/lib/features/tools/marquee-selection/marquee-tool.d.ts.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-tool.js +19 -7
- package/lib/features/tools/marquee-selection/marquee-tool.js.map +1 -1
- package/lib/features/tools/node-creation/index.d.ts +18 -0
- package/lib/features/tools/node-creation/index.d.ts.map +1 -0
- package/lib/features/tools/node-creation/index.js +34 -0
- package/lib/features/tools/node-creation/index.js.map +1 -0
- package/lib/features/tools/node-creation/node-creation-tool.d.ts +3 -2
- package/lib/features/tools/node-creation/node-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.js +11 -15
- package/lib/features/tools/node-creation/node-creation-tool.js.map +1 -1
- package/lib/features/undo-redo/index.d.ts +18 -0
- package/lib/features/undo-redo/index.d.ts.map +1 -0
- package/lib/features/undo-redo/index.js +34 -0
- package/lib/features/undo-redo/index.js.map +1 -0
- package/lib/features/validation/index.d.ts +20 -0
- package/lib/features/validation/index.d.ts.map +1 -0
- package/lib/features/validation/index.js +36 -0
- package/lib/features/validation/index.js.map +1 -0
- package/lib/features/viewport/index.d.ts +20 -0
- package/lib/features/viewport/index.d.ts.map +1 -0
- package/lib/features/viewport/index.js +36 -0
- package/lib/features/viewport/index.js.map +1 -0
- package/lib/index.d.ts +5 -139
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -157
- package/lib/index.js.map +1 -1
- package/lib/re-exports.d.ts +17 -0
- package/lib/re-exports.d.ts.map +1 -0
- package/lib/re-exports.js +33 -0
- package/lib/re-exports.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/geometry-util.d.ts +38 -0
- package/lib/utils/geometry-util.d.ts.map +1 -0
- package/lib/utils/geometry-util.js +103 -0
- package/lib/utils/geometry-util.js.map +1 -0
- package/lib/utils/gmodel-util.d.ts +3 -1
- package/lib/utils/gmodel-util.d.ts.map +1 -1
- package/lib/utils/gmodel-util.js +27 -1
- package/lib/utils/gmodel-util.js.map +1 -1
- package/lib/utils/html-utils.d.ts +1 -15
- package/lib/utils/html-utils.d.ts.map +1 -1
- package/lib/utils/html-utils.js +6 -1
- package/lib/utils/html-utils.js.map +1 -1
- package/lib/utils/index.d.ts +23 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +39 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/viewpoint-util.d.ts +1 -0
- package/lib/utils/viewpoint-util.d.ts.map +1 -1
- package/lib/utils/viewpoint-util.js +8 -1
- package/lib/utils/viewpoint-util.js.map +1 -1
- package/lib/views/index.d.ts +2 -2
- package/lib/views/index.d.ts.map +1 -1
- package/lib/views/index.js +2 -2
- package/lib/views/index.js.map +1 -1
- package/package.json +3 -3
- package/src/base/auto-complete/index.ts +20 -0
- package/src/base/feedback/index.ts +19 -0
- package/src/base/focus/index.ts +17 -0
- package/src/base/index.ts +31 -0
- package/src/base/model/index.ts +19 -0
- package/src/base/tool-manager/index.ts +17 -0
- package/src/base/view/index.ts +18 -0
- package/src/default-modules.ts +2 -2
- package/src/features/accessibility/edge-autocomplete/index.ts +19 -0
- package/src/features/accessibility/element-navigation/index.ts +21 -0
- package/src/features/accessibility/focus-tracker/index.ts +17 -0
- package/src/features/accessibility/index.ts +30 -0
- package/src/features/accessibility/key-shortcut/index.ts +18 -0
- package/src/features/accessibility/keyboard-grid/index.ts +20 -0
- package/src/features/accessibility/keyboard-pointer/index.ts +21 -0
- package/src/features/accessibility/keyboard-tool-palette/index.ts +17 -0
- package/src/features/accessibility/move-zoom/index.ts +18 -0
- package/src/features/accessibility/resize-key-tool/index.ts +18 -0
- package/src/features/accessibility/search/index.ts +18 -0
- package/src/features/accessibility/toast/index.ts +18 -0
- package/src/features/accessibility/view-key-tools/index.ts +19 -0
- package/src/features/accessibility/view-key-tools/movement-key-tool.ts +15 -19
- package/src/features/bounds/bounds-module.ts +5 -2
- package/src/features/bounds/index.ts +23 -0
- package/src/features/bounds/local-bounds.ts +7 -1
- package/src/features/bounds/set-bounds-feedback-command.ts +1 -1
- package/src/features/change-bounds/index.ts +20 -0
- package/src/features/change-bounds/model.ts +18 -2
- package/src/features/change-bounds/point-position-updater.ts +120 -0
- package/src/features/change-bounds/position-snapper.ts +69 -0
- package/src/features/change-bounds/snap.spec.ts +3 -2
- package/src/features/change-bounds/snap.ts +8 -82
- package/src/features/command-palette/index.ts +18 -0
- package/src/features/context-menu/index.ts +19 -0
- package/src/features/copy-paste/index.ts +19 -0
- package/src/features/decoration/index.ts +17 -0
- package/src/features/element-template/index.ts +19 -0
- package/src/features/element-template/mouse-tracking-element-position-listener.ts +29 -22
- package/src/features/export/index.ts +18 -0
- package/src/features/helper-lines/helper-line-feedback.ts +269 -0
- package/src/features/helper-lines/helper-line-manager-default.ts +114 -0
- package/src/features/helper-lines/helper-line-manager.ts +21 -0
- package/src/features/helper-lines/helper-line-module.ts +47 -0
- package/src/features/helper-lines/index.ts +21 -0
- package/src/features/helper-lines/model.ts +140 -0
- package/src/features/helper-lines/view.tsx +60 -0
- package/src/features/hints/index.ts +18 -0
- package/src/features/hover/index.ts +17 -0
- package/src/features/index.ts +42 -0
- package/src/features/label-edit/index.ts +18 -0
- package/src/features/layout/index.ts +17 -0
- package/src/features/navigation/index.ts +18 -0
- package/src/features/reconnect/index.ts +16 -0
- package/src/features/routing/index.ts +17 -0
- package/src/features/save/index.ts +17 -0
- package/src/features/select/index.ts +18 -0
- package/src/features/source-model-watcher/index.ts +17 -0
- package/src/features/status/index.ts +17 -0
- package/src/features/svg-metadata/index.ts +17 -0
- package/src/features/tool-palette/index.ts +17 -0
- package/src/features/tools/change-bounds/change-bounds-tool-feedback.ts +99 -69
- package/src/features/tools/change-bounds/change-bounds-tool.ts +12 -11
- package/src/features/tools/change-bounds/index.ts +19 -0
- package/src/features/tools/deletion/index.ts +17 -0
- package/src/features/tools/edge-creation/index.ts +20 -0
- package/src/features/tools/edge-edit/edge-edit-tool-feedback.ts +20 -21
- package/src/features/tools/edge-edit/edge-edit-tool.ts +5 -6
- package/src/features/tools/edge-edit/index.ts +18 -0
- package/src/features/tools/index.ts +23 -0
- package/src/features/tools/marquee-selection/index.ts +22 -0
- package/src/features/tools/marquee-selection/marquee-tool.ts +14 -4
- package/src/features/tools/node-creation/index.ts +17 -0
- package/src/features/tools/node-creation/node-creation-tool.ts +9 -13
- package/src/features/undo-redo/index.ts +17 -0
- package/src/features/validation/index.ts +19 -0
- package/src/features/viewport/index.ts +19 -0
- package/src/index.ts +5 -147
- package/src/re-exports.ts +16 -0
- package/src/utils/geometry-util.ts +101 -0
- package/src/utils/gmodel-util.ts +41 -10
- package/src/utils/html-utils.ts +6 -0
- package/src/utils/index.ts +22 -0
- package/src/utils/viewpoint-util.ts +8 -0
- package/src/views/index.ts +2 -2
- package/lib/features/source-model-watcher/source-model-wacher-module.d.ts.map +0 -1
- package/lib/features/source-model-watcher/source-model-wacher-module.js.map +0 -1
- package/lib/features/tools/change-bounds/change-boounds-tool-module.d.ts.map +0 -1
- package/lib/features/tools/change-bounds/change-boounds-tool-module.js.map +0 -1
- /package/src/features/source-model-watcher/{source-model-wacher-module.ts → source-model-watcher-module.ts} +0 -0
- /package/src/features/tools/change-bounds/{change-boounds-tool-module.ts → change-bounds-tool-module.ts} +0 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
Action,
|
|
19
|
+
Bounds,
|
|
20
|
+
CommandExecutionContext,
|
|
21
|
+
CommandReturn,
|
|
22
|
+
GModelElement,
|
|
23
|
+
GModelRoot,
|
|
24
|
+
TYPES,
|
|
25
|
+
Viewport,
|
|
26
|
+
findParentByFeature,
|
|
27
|
+
isBoundsAware,
|
|
28
|
+
isViewport
|
|
29
|
+
} from '@eclipse-glsp/sprotty';
|
|
30
|
+
import { inject, injectable } from 'inversify';
|
|
31
|
+
import { partition } from 'lodash';
|
|
32
|
+
import '../../../css/helper-lines.css';
|
|
33
|
+
import { FeedbackCommand } from '../../base/feedback/feedback-command';
|
|
34
|
+
import {
|
|
35
|
+
bottom,
|
|
36
|
+
bottomCenter,
|
|
37
|
+
bottomLeft,
|
|
38
|
+
bottomRight,
|
|
39
|
+
center,
|
|
40
|
+
isAbove,
|
|
41
|
+
isBefore,
|
|
42
|
+
left,
|
|
43
|
+
middle,
|
|
44
|
+
middleLeft,
|
|
45
|
+
middleRight,
|
|
46
|
+
right,
|
|
47
|
+
sortBy,
|
|
48
|
+
top,
|
|
49
|
+
topCenter,
|
|
50
|
+
topLeft,
|
|
51
|
+
topRight
|
|
52
|
+
} from '../../utils/geometry-util';
|
|
53
|
+
import { BoundsAwareModelElement, findTopLevelElementByFeature, forEachElement, getMatchingElements } from '../../utils/gmodel-util';
|
|
54
|
+
import { getViewportBounds } from '../../utils/viewpoint-util';
|
|
55
|
+
import { HelperLine, HelperLineType, SelectionBounds, isHelperLine, isSelectionBounds } from './model';
|
|
56
|
+
|
|
57
|
+
export type ViewportLineType = typeof HelperLineType.Center | typeof HelperLineType.Middle | string;
|
|
58
|
+
|
|
59
|
+
export const ALL_ELEMENT_LINE_TYPES = Object.values(HelperLineType);
|
|
60
|
+
export const ALL_VIEWPORT_LINE_TYPES = [HelperLineType.Center, HelperLineType.Middle];
|
|
61
|
+
|
|
62
|
+
export interface DrawHelperLinesFeedbackAction extends Action {
|
|
63
|
+
kind: typeof DrawHelperLinesFeedbackAction.KIND;
|
|
64
|
+
elementIds: string[];
|
|
65
|
+
elementLines?: HelperLineType[];
|
|
66
|
+
viewportLines?: ViewportLineType[];
|
|
67
|
+
alignmentEpsilon?: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export namespace DrawHelperLinesFeedbackAction {
|
|
71
|
+
export const KIND = 'drawHelperLines';
|
|
72
|
+
|
|
73
|
+
export function create(options: Omit<DrawHelperLinesFeedbackAction, 'kind'>): DrawHelperLinesFeedbackAction {
|
|
74
|
+
return {
|
|
75
|
+
kind: KIND,
|
|
76
|
+
...options
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@injectable()
|
|
82
|
+
export class DrawHelperLinesFeedbackCommand extends FeedbackCommand {
|
|
83
|
+
static readonly KIND = DrawHelperLinesFeedbackAction.KIND;
|
|
84
|
+
|
|
85
|
+
constructor(@inject(TYPES.Action) public action: DrawHelperLinesFeedbackAction) {
|
|
86
|
+
super();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
execute(context: CommandExecutionContext): CommandReturn {
|
|
90
|
+
removeHelperLines(context.root);
|
|
91
|
+
removeSelectionBounds(context.root);
|
|
92
|
+
const boundsAwareElements = getMatchingElements(context.root.index, this.isCompareElement);
|
|
93
|
+
const [referenceElements, elements] = partition(boundsAwareElements, element => this.action.elementIds.includes(element.id));
|
|
94
|
+
if (referenceElements.length === 0) {
|
|
95
|
+
return context.root;
|
|
96
|
+
}
|
|
97
|
+
const referenceBounds = this.calcReferenceBounds(referenceElements);
|
|
98
|
+
const helperLines = this.calcHelperLines(elements, referenceBounds, context);
|
|
99
|
+
if (referenceElements.length > 1) {
|
|
100
|
+
context.root.add(new SelectionBounds(referenceBounds));
|
|
101
|
+
}
|
|
102
|
+
helperLines.forEach(helperLine => context.root.add(helperLine));
|
|
103
|
+
return context.root;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
protected isCompareElement(element: GModelElement): element is BoundsAwareModelElement {
|
|
107
|
+
return isBoundsAware(element) && findTopLevelElementByFeature(element, isBoundsAware, isViewport) === element;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
protected calcReferenceBounds(referenceElements: BoundsAwareModelElement[]): Bounds {
|
|
111
|
+
return referenceElements.map(element => element.bounds).reduce((combined, next) => Bounds.combine(combined, next), Bounds.EMPTY);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
protected calcHelperLines(elements: BoundsAwareModelElement[], bounds: Bounds, context: CommandExecutionContext): HelperLine[] {
|
|
115
|
+
const helperLines: HelperLine[] = [];
|
|
116
|
+
const viewport = findParentByFeature(context.root, isViewport);
|
|
117
|
+
if (viewport) {
|
|
118
|
+
helperLines.push(...this.calcHelperLinesForViewport(viewport, bounds));
|
|
119
|
+
}
|
|
120
|
+
elements.flatMap(element => this.calcHelperLinesForElement(element, bounds)).forEach(line => helperLines.push(line));
|
|
121
|
+
return helperLines;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
protected calcHelperLinesForViewport(
|
|
125
|
+
root: Viewport & GModelRoot,
|
|
126
|
+
bounds: Bounds,
|
|
127
|
+
lineTypes: HelperLineType[] = this.action.viewportLines ?? ALL_VIEWPORT_LINE_TYPES
|
|
128
|
+
): HelperLine[] {
|
|
129
|
+
const helperLines: HelperLine[] = [];
|
|
130
|
+
const viewportBounds = getViewportBounds(root, root.canvasBounds);
|
|
131
|
+
if (lineTypes.includes(HelperLineType.Center) && this.isAligned(center, viewportBounds, bounds, 2)) {
|
|
132
|
+
helperLines.push(new HelperLine(topCenter(viewportBounds), bottomCenter(viewportBounds), HelperLineType.Center));
|
|
133
|
+
}
|
|
134
|
+
if (lineTypes.includes(HelperLineType.Middle) && this.isAligned(middle, viewportBounds, bounds, 2)) {
|
|
135
|
+
helperLines.push(new HelperLine(middleLeft(viewportBounds), middleRight(viewportBounds), HelperLineType.Middle));
|
|
136
|
+
}
|
|
137
|
+
return helperLines;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
protected calcHelperLinesForElement(
|
|
141
|
+
element: BoundsAwareModelElement,
|
|
142
|
+
bounds: Bounds,
|
|
143
|
+
lineTypes: HelperLineType[] = this.action.elementLines ?? ALL_ELEMENT_LINE_TYPES
|
|
144
|
+
): HelperLine[] {
|
|
145
|
+
return this.calcHelperLinesForBounds(element.bounds, bounds, lineTypes);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
protected calcHelperLinesForBounds(
|
|
149
|
+
elementBounds: Bounds,
|
|
150
|
+
bounds: Bounds,
|
|
151
|
+
lineTypes: HelperLineType[] = this.action.elementLines ?? ALL_ELEMENT_LINE_TYPES
|
|
152
|
+
): HelperLine[] {
|
|
153
|
+
const helperLines: HelperLine[] = [];
|
|
154
|
+
|
|
155
|
+
if (lineTypes.includes(HelperLineType.Left) && this.isAligned(left, elementBounds, bounds)) {
|
|
156
|
+
const [above, below] = sortBy(top, elementBounds, bounds); // higher top-value ==> lower
|
|
157
|
+
helperLines.push(new HelperLine(bottomLeft(below), topLeft(above), HelperLineType.Left));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (lineTypes.includes(HelperLineType.Center) && this.isAligned(center, elementBounds, bounds)) {
|
|
161
|
+
const [above, below] = sortBy(top, elementBounds, bounds); // higher top-value ==> lower
|
|
162
|
+
helperLines.push(new HelperLine(topCenter(above), bottomCenter(below), HelperLineType.Center));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (lineTypes.includes(HelperLineType.Right) && this.isAligned(right, elementBounds, bounds)) {
|
|
166
|
+
const [above, below] = sortBy(top, elementBounds, bounds); // higher top-value ==> lower
|
|
167
|
+
helperLines.push(new HelperLine(bottomRight(below), topRight(above), HelperLineType.Right));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (lineTypes.includes(HelperLineType.Bottom) && this.isAligned(bottom, elementBounds, bounds)) {
|
|
171
|
+
const [before, after] = sortBy(left, elementBounds, bounds); // higher left-value ==> more to the right
|
|
172
|
+
helperLines.push(new HelperLine(bottomLeft(before), bottomRight(after), HelperLineType.Bottom));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (lineTypes.includes(HelperLineType.Middle) && this.isAligned(middle, elementBounds, bounds)) {
|
|
176
|
+
const [before, after] = sortBy(left, elementBounds, bounds); // higher left-value ==> more to the right
|
|
177
|
+
helperLines.push(new HelperLine(middleLeft(before), middleRight(after), HelperLineType.Middle));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (lineTypes.includes(HelperLineType.Top) && this.isAligned(top, elementBounds, bounds)) {
|
|
181
|
+
const [before, after] = sortBy(left, elementBounds, bounds); // higher left-value ==> more to the right
|
|
182
|
+
helperLines.push(new HelperLine(topLeft(before), topRight(after), HelperLineType.Top));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (lineTypes.includes(HelperLineType.LeftRight) && this.isMatch(left(elementBounds), right(bounds), 2)) {
|
|
186
|
+
if (isAbove(bounds, elementBounds)) {
|
|
187
|
+
helperLines.push(new HelperLine(bottomLeft(elementBounds), topRight(bounds), HelperLineType.RightLeft));
|
|
188
|
+
} else {
|
|
189
|
+
helperLines.push(new HelperLine(topLeft(elementBounds), bottomRight(bounds), HelperLineType.RightLeft));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (lineTypes.includes(HelperLineType.LeftRight) && this.isMatch(right(elementBounds), left(bounds), 2)) {
|
|
194
|
+
if (isAbove(bounds, elementBounds)) {
|
|
195
|
+
helperLines.push(new HelperLine(bottomRight(elementBounds), topLeft(bounds), HelperLineType.LeftRight));
|
|
196
|
+
} else {
|
|
197
|
+
helperLines.push(new HelperLine(topRight(elementBounds), bottomLeft(bounds), HelperLineType.LeftRight));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (lineTypes.includes(HelperLineType.TopBottom) && this.isMatch(top(elementBounds), bottom(bounds), 2)) {
|
|
202
|
+
if (isBefore(bounds, elementBounds)) {
|
|
203
|
+
helperLines.push(new HelperLine(topRight(elementBounds), bottomLeft(bounds), HelperLineType.BottomTop));
|
|
204
|
+
} else {
|
|
205
|
+
helperLines.push(new HelperLine(topLeft(elementBounds), bottomRight(bounds), HelperLineType.BottomTop));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (lineTypes.includes(HelperLineType.TopBottom) && this.isMatch(bottom(elementBounds), top(bounds), 2)) {
|
|
210
|
+
if (isBefore(bounds, elementBounds)) {
|
|
211
|
+
helperLines.push(new HelperLine(bottomRight(elementBounds), topLeft(bounds), HelperLineType.TopBottom));
|
|
212
|
+
} else {
|
|
213
|
+
helperLines.push(new HelperLine(bottomLeft(elementBounds), topRight(bounds), HelperLineType.TopBottom));
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return helperLines;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
protected isAligned(
|
|
221
|
+
coordinate: (elem: Bounds) => number,
|
|
222
|
+
leftBounds: Bounds,
|
|
223
|
+
rightBounds: Bounds,
|
|
224
|
+
epsilon = this.action.alignmentEpsilon ?? 1
|
|
225
|
+
): boolean {
|
|
226
|
+
return this.isMatch(coordinate(leftBounds), coordinate(rightBounds), epsilon);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
protected isMatch(leftCoordinate: number, rightCoordinate: number, epsilon = this.action.alignmentEpsilon ?? 1): boolean {
|
|
230
|
+
return Math.abs(leftCoordinate - rightCoordinate) < epsilon;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export interface RemoveHelperLinesFeedbackAction extends Action {
|
|
235
|
+
kind: typeof RemoveHelperLinesFeedbackAction.KIND;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export namespace RemoveHelperLinesFeedbackAction {
|
|
239
|
+
export const KIND = 'removeHelperLines';
|
|
240
|
+
|
|
241
|
+
export function create(options: Omit<RemoveHelperLinesFeedbackAction, 'kind'> = {}): RemoveHelperLinesFeedbackAction {
|
|
242
|
+
return {
|
|
243
|
+
kind: KIND,
|
|
244
|
+
...options
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@injectable()
|
|
250
|
+
export class RemoveHelperLinesFeedbackCommand extends FeedbackCommand {
|
|
251
|
+
static readonly KIND = RemoveHelperLinesFeedbackAction.KIND;
|
|
252
|
+
|
|
253
|
+
constructor(@inject(TYPES.Action) public action: RemoveHelperLinesFeedbackAction) {
|
|
254
|
+
super();
|
|
255
|
+
}
|
|
256
|
+
override execute(context: CommandExecutionContext): CommandReturn {
|
|
257
|
+
removeHelperLines(context.root);
|
|
258
|
+
removeSelectionBounds(context.root);
|
|
259
|
+
return context.root;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export function removeHelperLines(root: GModelRoot): void {
|
|
264
|
+
forEachElement(root.index, isHelperLine, line => root.remove(line));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export function removeSelectionBounds(root: GModelRoot): void {
|
|
268
|
+
forEachElement(root.index, isSelectionBounds, line => root.remove(line));
|
|
269
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import {
|
|
17
|
+
Action,
|
|
18
|
+
DisposableCollection,
|
|
19
|
+
GModelElement,
|
|
20
|
+
GModelRoot,
|
|
21
|
+
IActionHandler,
|
|
22
|
+
ISnapper,
|
|
23
|
+
MoveAction,
|
|
24
|
+
SetBoundsAction,
|
|
25
|
+
TYPES
|
|
26
|
+
} from '@eclipse-glsp/sprotty';
|
|
27
|
+
import { inject, injectable, optional, postConstruct } from 'inversify';
|
|
28
|
+
import { IFeedbackActionDispatcher } from '../../base/feedback/feedback-action-dispatcher';
|
|
29
|
+
import { ISelectionListener, SelectionService } from '../../base/selection-service';
|
|
30
|
+
import { SetBoundsFeedbackAction } from '../bounds/set-bounds-feedback-command';
|
|
31
|
+
import { GridSnapper } from '../change-bounds/snap';
|
|
32
|
+
import { MoveFinishedEventAction, MoveInitializedEventAction } from '../tools/change-bounds/change-bounds-tool-feedback';
|
|
33
|
+
import { DrawHelperLinesFeedbackAction, RemoveHelperLinesFeedbackAction, ViewportLineType } from './helper-line-feedback';
|
|
34
|
+
import { IHelperLineManager } from './helper-line-manager';
|
|
35
|
+
import { Direction, HelperLineType } from './model';
|
|
36
|
+
|
|
37
|
+
@injectable()
|
|
38
|
+
export class HelperLineManager implements IActionHandler, ISelectionListener, IHelperLineManager {
|
|
39
|
+
@inject(TYPES.IFeedbackActionDispatcher) protected feedbackDispatcher: IFeedbackActionDispatcher;
|
|
40
|
+
@inject(SelectionService) protected selectionService: SelectionService;
|
|
41
|
+
@optional() @inject(TYPES.ISnapper) protected snapper?: ISnapper;
|
|
42
|
+
|
|
43
|
+
protected snapSize = { x: 20, y: 20 };
|
|
44
|
+
protected feedback: DisposableCollection = new DisposableCollection();
|
|
45
|
+
|
|
46
|
+
protected elementLines?: HelperLineType[];
|
|
47
|
+
protected viewportLines?: ViewportLineType[];
|
|
48
|
+
protected alignmentEpsilon?: number;
|
|
49
|
+
|
|
50
|
+
@postConstruct()
|
|
51
|
+
protected init(): void {
|
|
52
|
+
this.selectionService.onSelectionChanged(change =>
|
|
53
|
+
this.selectionChanged(change.root, change.selectedElements, change.deselectedElements)
|
|
54
|
+
);
|
|
55
|
+
if (this.snapper instanceof GridSnapper) {
|
|
56
|
+
this.snapSize = { x: this.snapper.grid.x * 2, y: this.snapper.grid.y * 2 };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
handle(action: Action): void {
|
|
61
|
+
if (MoveInitializedEventAction.is(action)) {
|
|
62
|
+
this.handleMoveInitializedAction(action);
|
|
63
|
+
} else if (MoveAction.is(action)) {
|
|
64
|
+
this.handleMoveAction(action);
|
|
65
|
+
} else if (MoveFinishedEventAction.is(action)) {
|
|
66
|
+
this.handleMoveFinishedAction(action);
|
|
67
|
+
} else if (SetBoundsAction.is(action) || SetBoundsFeedbackAction.is(action)) {
|
|
68
|
+
this.handleSetBoundsAction(action);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
protected handleMoveInitializedAction(_action: MoveInitializedEventAction): void {
|
|
73
|
+
this.feedback.dispose();
|
|
74
|
+
const feedback = this.createHelperLineFeedback(this.selectionService.getSelectedElementIDs());
|
|
75
|
+
this.feedback.push(this.feedbackDispatcher.registerFeedback(this, [feedback], [RemoveHelperLinesFeedbackAction.create()]));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
protected handleMoveFinishedAction(_action: MoveFinishedEventAction): void {
|
|
79
|
+
this.feedback.dispose();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
protected handleMoveAction(action: MoveAction): void {
|
|
83
|
+
if (!action.finished) {
|
|
84
|
+
const elementIds = action.moves.map(move => move.elementId);
|
|
85
|
+
const feedback = this.createHelperLineFeedback(elementIds);
|
|
86
|
+
this.feedback.push(this.feedbackDispatcher.registerFeedback(this, [feedback], [RemoveHelperLinesFeedbackAction.create()]));
|
|
87
|
+
} else {
|
|
88
|
+
this.feedback.dispose();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
protected createHelperLineFeedback(elementIds: string[]): DrawHelperLinesFeedbackAction {
|
|
93
|
+
return DrawHelperLinesFeedbackAction.create({
|
|
94
|
+
elementIds,
|
|
95
|
+
elementLines: this.elementLines,
|
|
96
|
+
viewportLines: this.viewportLines,
|
|
97
|
+
alignmentEpsilon: this.alignmentEpsilon
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
protected handleSetBoundsAction(action: SetBoundsAction | SetBoundsFeedbackAction): void {
|
|
102
|
+
const elementIds = action.bounds.map(bound => bound.elementId);
|
|
103
|
+
const feedback = this.createHelperLineFeedback(elementIds);
|
|
104
|
+
this.feedback.push(this.feedbackDispatcher.registerFeedback(this, [feedback], [RemoveHelperLinesFeedbackAction.create()]));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
selectionChanged(root: Readonly<GModelRoot>, selectedElements: string[], deselectedElements?: string[] | undefined): void {
|
|
108
|
+
this.feedback.dispose();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
getHelperLineSnapping(target: GModelElement, isSnap: boolean, direction: Direction): number {
|
|
112
|
+
return direction === Direction.Left || direction === Direction.Right ? this.snapSize.x : this.snapSize.y;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { GModelElement } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { Direction } from './model';
|
|
18
|
+
|
|
19
|
+
export interface IHelperLineManager {
|
|
20
|
+
getHelperLineSnapping(target: GModelElement, isSnap: boolean, direction: Direction): number;
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
FeatureModule,
|
|
19
|
+
MoveAction,
|
|
20
|
+
SetBoundsAction,
|
|
21
|
+
TYPES,
|
|
22
|
+
bindAsService,
|
|
23
|
+
configureActionHandler,
|
|
24
|
+
configureCommand,
|
|
25
|
+
configureModelElement
|
|
26
|
+
} from '@eclipse-glsp/sprotty';
|
|
27
|
+
import { SetBoundsFeedbackAction } from '../bounds/set-bounds-feedback-command';
|
|
28
|
+
import { MoveFinishedEventAction, MoveInitializedEventAction } from '../tools/change-bounds/change-bounds-tool-feedback';
|
|
29
|
+
import { DrawHelperLinesFeedbackCommand, RemoveHelperLinesFeedbackCommand } from './helper-line-feedback';
|
|
30
|
+
import { HelperLineManager } from './helper-line-manager-default';
|
|
31
|
+
import { HELPER_LINE, HelperLine, SELECTION_BOUNDS, SelectionBounds } from './model';
|
|
32
|
+
import { HelperLineView, SelectionBoundsView } from './view';
|
|
33
|
+
|
|
34
|
+
export const helperLineModule = new FeatureModule((bind, unbind, isBound, rebind) => {
|
|
35
|
+
const context = { bind, unbind, isBound, rebind };
|
|
36
|
+
configureModelElement(context, HELPER_LINE, HelperLine, HelperLineView);
|
|
37
|
+
configureModelElement(context, SELECTION_BOUNDS, SelectionBounds, SelectionBoundsView);
|
|
38
|
+
configureCommand(context, DrawHelperLinesFeedbackCommand);
|
|
39
|
+
configureCommand(context, RemoveHelperLinesFeedbackCommand);
|
|
40
|
+
|
|
41
|
+
bindAsService(bind, TYPES.IHelperLineManager, HelperLineManager);
|
|
42
|
+
configureActionHandler(context, SetBoundsAction.KIND, TYPES.IHelperLineManager);
|
|
43
|
+
configureActionHandler(context, SetBoundsFeedbackAction.KIND, TYPES.IHelperLineManager);
|
|
44
|
+
configureActionHandler(context, MoveAction.KIND, TYPES.IHelperLineManager);
|
|
45
|
+
configureActionHandler(context, MoveInitializedEventAction.KIND, TYPES.IHelperLineManager);
|
|
46
|
+
configureActionHandler(context, MoveFinishedEventAction.KIND, TYPES.IHelperLineManager);
|
|
47
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
export * from './helper-line-feedback';
|
|
17
|
+
export * from './helper-line-manager-default';
|
|
18
|
+
export * from './helper-line-manager';
|
|
19
|
+
export * from './helper-line-module';
|
|
20
|
+
export * from './model';
|
|
21
|
+
export * from './view';
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
import { Args, Bounds, GChildElement, GModelElement, GShapeElement, Point } from '@eclipse-glsp/sprotty';
|
|
18
|
+
import { v4 as uuid } from 'uuid';
|
|
19
|
+
import { ArgsAware } from '../../base/args-feature';
|
|
20
|
+
import { ResizeHandleLocation } from '../change-bounds/model';
|
|
21
|
+
|
|
22
|
+
export const HelperLineType = {
|
|
23
|
+
Left: 'left',
|
|
24
|
+
Right: 'right',
|
|
25
|
+
Center: 'center',
|
|
26
|
+
Top: 'top',
|
|
27
|
+
Bottom: 'bottom',
|
|
28
|
+
Middle: 'middle',
|
|
29
|
+
LeftRight: 'left-right',
|
|
30
|
+
RightLeft: 'right-left',
|
|
31
|
+
BottomTop: 'bottom-top',
|
|
32
|
+
TopBottom: 'top-bottom'
|
|
33
|
+
} as const;
|
|
34
|
+
|
|
35
|
+
// allow any string to be set as helper line type to support customization
|
|
36
|
+
export type HelperLineType = (typeof HelperLineType)[keyof typeof HelperLineType] | string;
|
|
37
|
+
|
|
38
|
+
export const HELPER_LINE = 'helper-line';
|
|
39
|
+
|
|
40
|
+
export class HelperLine extends GChildElement implements ArgsAware {
|
|
41
|
+
args?: Args;
|
|
42
|
+
|
|
43
|
+
constructor(
|
|
44
|
+
readonly startPoint = Point.ORIGIN,
|
|
45
|
+
readonly endPoint = Point.ORIGIN,
|
|
46
|
+
readonly lineType: HelperLineType = HelperLineType.Left
|
|
47
|
+
) {
|
|
48
|
+
super();
|
|
49
|
+
this.id = uuid();
|
|
50
|
+
this.type = HELPER_LINE;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get isLeft(): boolean {
|
|
54
|
+
return this.lineType === HelperLineType.Left || this.lineType === HelperLineType.LeftRight;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get isRight(): boolean {
|
|
58
|
+
return this.lineType === HelperLineType.Right || this.lineType === HelperLineType.RightLeft;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get isTop(): boolean {
|
|
62
|
+
return this.lineType === HelperLineType.Top || this.lineType === HelperLineType.TopBottom;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get isBottom(): boolean {
|
|
66
|
+
return this.lineType === HelperLineType.Bottom || this.lineType === HelperLineType.BottomTop;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get isMiddle(): boolean {
|
|
70
|
+
return this.lineType === HelperLineType.Middle;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
get isCenter(): boolean {
|
|
74
|
+
return this.lineType === HelperLineType.Center;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function isHelperLine(element: GModelElement): element is HelperLine {
|
|
79
|
+
return element.type === HELPER_LINE;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const SELECTION_BOUNDS = 'selection-bounds';
|
|
83
|
+
|
|
84
|
+
export class SelectionBounds extends GShapeElement implements ArgsAware {
|
|
85
|
+
args?: Args;
|
|
86
|
+
|
|
87
|
+
constructor(bounds?: Bounds) {
|
|
88
|
+
super();
|
|
89
|
+
this.id = uuid();
|
|
90
|
+
this.type = SELECTION_BOUNDS;
|
|
91
|
+
if (bounds) {
|
|
92
|
+
this.bounds = bounds;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function isSelectionBounds(element: GModelElement): element is SelectionBounds {
|
|
98
|
+
return element.type === SELECTION_BOUNDS;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const Direction = {
|
|
102
|
+
Left: 'left',
|
|
103
|
+
Right: 'right',
|
|
104
|
+
Up: 'up',
|
|
105
|
+
Down: 'down'
|
|
106
|
+
} as const;
|
|
107
|
+
|
|
108
|
+
// allow any string to be set as helper line type to support customization
|
|
109
|
+
export type Direction = (typeof Direction)[keyof typeof Direction];
|
|
110
|
+
|
|
111
|
+
export function getDirectionOf(point: Point): Direction[] {
|
|
112
|
+
const directions: Direction[] = [];
|
|
113
|
+
if (point.x < 0) {
|
|
114
|
+
directions.push(Direction.Left);
|
|
115
|
+
} else if (point.x > 0) {
|
|
116
|
+
directions.push(Direction.Right);
|
|
117
|
+
}
|
|
118
|
+
if (point.y < 0) {
|
|
119
|
+
directions.push(Direction.Up);
|
|
120
|
+
} else if (point.y > 0) {
|
|
121
|
+
directions.push(Direction.Down);
|
|
122
|
+
}
|
|
123
|
+
return directions;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function getDirectionFrom(resize?: ResizeHandleLocation): Direction[] {
|
|
127
|
+
if (resize === ResizeHandleLocation.TopLeft) {
|
|
128
|
+
return [Direction.Up, Direction.Left];
|
|
129
|
+
}
|
|
130
|
+
if (resize === ResizeHandleLocation.TopRight) {
|
|
131
|
+
return [Direction.Up, Direction.Right];
|
|
132
|
+
}
|
|
133
|
+
if (resize === ResizeHandleLocation.BottomLeft) {
|
|
134
|
+
return [Direction.Down, Direction.Left];
|
|
135
|
+
}
|
|
136
|
+
if (resize === ResizeHandleLocation.BottomRight) {
|
|
137
|
+
return [Direction.Down, Direction.Right];
|
|
138
|
+
}
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { IViewArgs, RenderingContext, ShapeView, svg } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { injectable } from 'inversify';
|
|
18
|
+
import { VNode } from 'snabbdom';
|
|
19
|
+
import { HelperLine, SelectionBounds } from './model';
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
|
+
const JSX = { createElement: svg };
|
|
23
|
+
|
|
24
|
+
@injectable()
|
|
25
|
+
export class HelperLineView extends ShapeView {
|
|
26
|
+
override render(model: HelperLine, _context: RenderingContext): VNode | undefined {
|
|
27
|
+
return (
|
|
28
|
+
<g>
|
|
29
|
+
<line
|
|
30
|
+
data-alignment={model.lineType}
|
|
31
|
+
x1={model.startPoint.x}
|
|
32
|
+
y1={model.startPoint.y}
|
|
33
|
+
x2={model.endPoint.x}
|
|
34
|
+
y2={model.endPoint.y}
|
|
35
|
+
class-helper-line={true}
|
|
36
|
+
/>
|
|
37
|
+
</g>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@injectable()
|
|
43
|
+
export class SelectionBoundsView extends ShapeView {
|
|
44
|
+
override render(model: SelectionBounds, context: RenderingContext, args?: IViewArgs | undefined): VNode | undefined {
|
|
45
|
+
if (!this.isVisible(model, context)) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return (
|
|
49
|
+
<g>
|
|
50
|
+
<rect
|
|
51
|
+
class-selection-bounds={true}
|
|
52
|
+
x={0}
|
|
53
|
+
y={0}
|
|
54
|
+
width={Math.max(model.size.width, 0)}
|
|
55
|
+
height={Math.max(model.size.height, 0)}
|
|
56
|
+
/>
|
|
57
|
+
</g>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|