@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,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/********************************************************************************
|
|
18
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
19
|
+
*
|
|
20
|
+
* This program and the accompanying materials are made available under the
|
|
21
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
22
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
23
|
+
*
|
|
24
|
+
* This Source Code may also be made available under the following Secondary
|
|
25
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
26
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
27
|
+
* with the GNU Classpath Exception which is available at
|
|
28
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
29
|
+
*
|
|
30
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
31
|
+
********************************************************************************/
|
|
32
|
+
__exportStar(require("./model"), exports);
|
|
33
|
+
__exportStar(require("./movement-restrictor"), exports);
|
|
34
|
+
__exportStar(require("./point-position-updater"), exports);
|
|
35
|
+
__exportStar(require("./position-snapper"), exports);
|
|
36
|
+
__exportStar(require("./snap"), exports);
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/change-bounds/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,0CAAwB;AACxB,wDAAsC;AACtC,2DAAyC;AACzC,qDAAmC;AACnC,yCAAuB"}
|
|
@@ -32,6 +32,10 @@ export declare class SResizeHandle extends GChildElement implements Hoverable {
|
|
|
32
32
|
static readonly TYPE = "resize-handle";
|
|
33
33
|
constructor(location?: ResizeHandleLocation | undefined, type?: string, hoverFeedback?: boolean);
|
|
34
34
|
hasFeature(feature: symbol): boolean;
|
|
35
|
+
isNwResize(): boolean;
|
|
36
|
+
isSeResize(): boolean;
|
|
37
|
+
isNeResize(): boolean;
|
|
38
|
+
isSwResize(): boolean;
|
|
35
39
|
isNwSeResize(): boolean;
|
|
36
40
|
isNeSwResize(): boolean;
|
|
37
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/features/change-bounds/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,WAAW,EACX,aAAa,EACb,aAAa,EACb,cAAc,EACd,SAAS,EACT,UAAU,EACV,UAAU,EAKb,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,aAAa,eAA0B,CAAC;AAErD,MAAM,WAAW,SAAU,SAAQ,WAAW,EAAE,UAAU;CAAG;AAE7D,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,IAAI,cAAc,GAAG,SAAS,CAEzF;AAGD,oBAAY,oBAAoB;IAC5B,OAAO,aAAa;IACpB,QAAQ,cAAc;IACtB,UAAU,gBAAgB;IAC1B,WAAW,iBAAiB;CAC/B;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,IAAI,aAAa,GAAG,UAAU,GAAG,WAAW,CAEjH;AAED,qBAAa,aAAc,SAAQ,aAAc,YAAW,SAAS;IAI7D,QAAQ,CAAC,QAAQ,CAAC;aACA,IAAI,EAAE,MAAM;IAC9B,QAAQ,CAAC,aAAa,EAAE,OAAO;IALnC,MAAM,CAAC,QAAQ,CAAC,IAAI,mBAAmB;gBAG1B,QAAQ,CAAC,kCAAsB,EACtB,IAAI,GAAE,MAA2B,EAC1C,aAAa,GAAE,OAAe;IAKlC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAI7C,YAAY,IAAI,OAAO;IAIvB,YAAY,IAAI,OAAO;CAG1B;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAK9D;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAEjE"}
|
|
1
|
+
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23 @@ class SResizeHandle extends sprotty_1.GChildElement {
|
|
|
44
44
|
hasFeature(feature) {
|
|
45
45
|
return feature === sprotty_1.hoverFeedbackFeature;
|
|
46
46
|
}
|
|
47
|
+
isNwResize() {
|
|
48
|
+
return this.location === ResizeHandleLocation.TopLeft;
|
|
49
|
+
}
|
|
50
|
+
isSeResize() {
|
|
51
|
+
return this.location === ResizeHandleLocation.BottomRight;
|
|
52
|
+
}
|
|
53
|
+
isNeResize() {
|
|
54
|
+
return this.location === ResizeHandleLocation.TopRight;
|
|
55
|
+
}
|
|
56
|
+
isSwResize() {
|
|
57
|
+
return this.location === ResizeHandleLocation.BottomLeft;
|
|
58
|
+
}
|
|
47
59
|
isNwSeResize() {
|
|
48
|
-
return this.
|
|
60
|
+
return this.isNwResize() || this.isSeResize();
|
|
49
61
|
}
|
|
50
62
|
isNeSwResize() {
|
|
51
|
-
return this.
|
|
63
|
+
return this.isNeResize() || this.isSwResize();
|
|
52
64
|
}
|
|
53
65
|
}
|
|
54
66
|
exports.SResizeHandle = SResizeHandle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/features/change-bounds/model.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAY+B;AAElB,QAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAIrD,SAAgB,WAAW,CAAC,OAAsB;IAC9C,OAAO,IAAA,uBAAa,EAAC,OAAO,CAAC,IAAI,IAAA,sBAAY,EAAC,OAAO,CAAC,IAAI,OAAO,YAAY,wBAAc,IAAI,OAAO,CAAC,UAAU,CAAC,qBAAa,CAAC,CAAC;AACrI,CAAC;AAFD,kCAEC;AAED,qCAAqC;AACrC,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC5B,4CAAoB,CAAA;IACpB,8CAAsB,CAAA;IACtB,kDAA0B,CAAA;IAC1B,oDAA4B,CAAA;AAChC,CAAC,EALW,oBAAoB,o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AAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC;AACrE,CAAC;AALD,4CAKC;AAED,SAAgB,mBAAmB,CAAC,OAAuB;IACvD,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,YAAY,aAAa,CAAC,CAAC;AAC/D,CAAC;AAFD,kDAEC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2020-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, ISnapper, Point, Writable } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { IHelperLineManager } from '../helper-lines/helper-line-manager';
|
|
18
|
+
import { Direction } from '../helper-lines/model';
|
|
19
|
+
import { PositionSnapper } from './position-snapper';
|
|
20
|
+
/**
|
|
21
|
+
* This class can be used to calculate the current position, when an element is
|
|
22
|
+
* moved. This includes node movements, node resizing (resize handle movement)
|
|
23
|
+
* or edge routing-point movements.
|
|
24
|
+
*
|
|
25
|
+
* You can initialize a this class with a optional {@link ISnapper}. If a
|
|
26
|
+
* snapper is present, the positions will be snapped to the defined grid.
|
|
27
|
+
*/
|
|
28
|
+
export declare class PointPositionUpdater {
|
|
29
|
+
protected positionSnapper: PositionSnapper;
|
|
30
|
+
protected lastDragPosition?: Point;
|
|
31
|
+
protected positionDelta: Writable<Point>;
|
|
32
|
+
constructor(snapper?: PositionSnapper);
|
|
33
|
+
constructor(snapper?: ISnapper, helperLineManager?: IHelperLineManager);
|
|
34
|
+
/**
|
|
35
|
+
* Init the position with the {@link Point} of your mouse cursor.
|
|
36
|
+
* This method is normally called in the `mouseDown` event.
|
|
37
|
+
* @param mousePosition current mouse position e.g `{x: event.pageX, y: event.pageY }`
|
|
38
|
+
*/
|
|
39
|
+
updateLastDragPosition(mousePosition: Point): void;
|
|
40
|
+
updateLastDragPosition(mouseEvent: MouseEvent): void;
|
|
41
|
+
/**
|
|
42
|
+
* Check if the mouse is currently not in a drag mode.
|
|
43
|
+
* @returns true if the last drag position is undefined
|
|
44
|
+
*/
|
|
45
|
+
isLastDragPositionUndefined(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Reset the updater for new movements.
|
|
48
|
+
* This method is normally called in the `mouseUp` event.
|
|
49
|
+
*/
|
|
50
|
+
resetPosition(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Calculate the current position of your movement.
|
|
53
|
+
* This method is normally called in the `mouseMove` event.
|
|
54
|
+
* @param target node which is moved around
|
|
55
|
+
* @param mousePosition current mouse position e.g `{x: event.pageX, y: event.pageY }`
|
|
56
|
+
* @param useSnap if a snapper is defined you can disable it, e.g when a specific key is pressed `!event.shiftKey`
|
|
57
|
+
* @param direction the direction in which the position is updated, will be calculated if not provided
|
|
58
|
+
* @returns delta to previous position or undefined if no delta should be applied
|
|
59
|
+
*/
|
|
60
|
+
updatePosition(target: GModelElement, mousePosition: Point, useSnap: boolean, direction?: Direction[]): Point | undefined;
|
|
61
|
+
updatePosition(target: GModelElement, mouseEvent: MouseEvent, direction?: Direction[]): Point | undefined;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=point-position-updater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"point-position-updater.d.ts","sourceRoot":"","sources":["../../../src/features/change-bounds/point-position-updater.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAkB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD;;;;;;;GAOG;AACH,qBAAa,oBAAoB;IAC7B,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAC3C,SAAS,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACnC,SAAS,CAAC,aAAa,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAkB;gBAE9C,OAAO,CAAC,EAAE,eAAe;gBACzB,OAAO,CAAC,EAAE,QAAQ,EAAE,iBAAiB,CAAC,EAAE,kBAAkB;IAKtE;;;;OAIG;IACI,sBAAsB,CAAC,aAAa,EAAE,KAAK,GAAG,IAAI;IAClD,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAK3D;;;OAGG;IACI,2BAA2B,IAAI,OAAO;IAI7C;;;OAGG;IACI,aAAa,IAAI,IAAI;IAK5B;;;;;;;;OAQG;IACI,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,GAAG,SAAS;IACzH,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,GAAG,SAAS;CAsCnH"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PointPositionUpdater = void 0;
|
|
4
|
+
/********************************************************************************
|
|
5
|
+
* Copyright (c) 2020-2023 EclipseSource and others.
|
|
6
|
+
*
|
|
7
|
+
* This program and the accompanying materials are made available under the
|
|
8
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
9
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
10
|
+
*
|
|
11
|
+
* This Source Code may also be made available under the following Secondary
|
|
12
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
13
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
14
|
+
* with the GNU Classpath Exception which is available at
|
|
15
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
16
|
+
*
|
|
17
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
18
|
+
********************************************************************************/
|
|
19
|
+
/* eslint-disable @typescript-eslint/no-shadow */
|
|
20
|
+
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
21
|
+
const gmodel_util_1 = require("../../utils/gmodel-util");
|
|
22
|
+
const html_utils_1 = require("../../utils/html-utils");
|
|
23
|
+
const model_1 = require("../helper-lines/model");
|
|
24
|
+
const position_snapper_1 = require("./position-snapper");
|
|
25
|
+
const snap_1 = require("./snap");
|
|
26
|
+
/**
|
|
27
|
+
* This class can be used to calculate the current position, when an element is
|
|
28
|
+
* moved. This includes node movements, node resizing (resize handle movement)
|
|
29
|
+
* or edge routing-point movements.
|
|
30
|
+
*
|
|
31
|
+
* You can initialize a this class with a optional {@link ISnapper}. If a
|
|
32
|
+
* snapper is present, the positions will be snapped to the defined grid.
|
|
33
|
+
*/
|
|
34
|
+
class PointPositionUpdater {
|
|
35
|
+
constructor(first, helperLineManager) {
|
|
36
|
+
this.positionDelta = { x: 0, y: 0 };
|
|
37
|
+
this.positionSnapper = first instanceof position_snapper_1.PositionSnapper ? first : new position_snapper_1.PositionSnapper(first, helperLineManager);
|
|
38
|
+
}
|
|
39
|
+
updateLastDragPosition(first) {
|
|
40
|
+
this.lastDragPosition = (0, html_utils_1.isMouseEvent)(first) ? { x: first.pageX, y: first.pageY } : first;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Check if the mouse is currently not in a drag mode.
|
|
44
|
+
* @returns true if the last drag position is undefined
|
|
45
|
+
*/
|
|
46
|
+
isLastDragPositionUndefined() {
|
|
47
|
+
return this.lastDragPosition === undefined;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Reset the updater for new movements.
|
|
51
|
+
* This method is normally called in the `mouseUp` event.
|
|
52
|
+
*/
|
|
53
|
+
resetPosition() {
|
|
54
|
+
this.lastDragPosition = undefined;
|
|
55
|
+
this.positionDelta = { x: 0, y: 0 };
|
|
56
|
+
}
|
|
57
|
+
updatePosition(target, second, third, fourth) {
|
|
58
|
+
if (!this.lastDragPosition) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const mousePosition = (0, html_utils_1.isMouseEvent)(second) ? { x: second.pageX, y: second.pageY } : second;
|
|
62
|
+
const shouldSnap = typeof third === 'boolean' ? third : (0, snap_1.useSnap)(second);
|
|
63
|
+
const direction = typeof third !== 'boolean' ? third : fourth;
|
|
64
|
+
// calculate update to last drag position
|
|
65
|
+
const deltaToLastPosition = (0, gmodel_util_1.calculateDeltaBetweenPoints)(mousePosition, this.lastDragPosition, target);
|
|
66
|
+
this.lastDragPosition = mousePosition;
|
|
67
|
+
if (sprotty_1.Point.equals(deltaToLastPosition, sprotty_1.Point.ORIGIN)) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
// accumulate position delta with latest delta
|
|
71
|
+
this.positionDelta.x += deltaToLastPosition.x;
|
|
72
|
+
this.positionDelta.y += deltaToLastPosition.y;
|
|
73
|
+
const directions = direction !== null && direction !== void 0 ? direction : (0, model_1.getDirectionOf)(this.positionDelta);
|
|
74
|
+
// only send update if the position actually changes
|
|
75
|
+
// otherwise accumulate delta until we get to an update
|
|
76
|
+
const positionUpdate = this.positionSnapper.snapDelta(this.positionDelta, target, shouldSnap, directions);
|
|
77
|
+
if (sprotty_1.Point.equals(positionUpdate, sprotty_1.Point.ORIGIN)) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
// we update our position so we update our delta by the snapped position
|
|
81
|
+
this.positionDelta.x -= positionUpdate.x;
|
|
82
|
+
this.positionDelta.y -= positionUpdate.y;
|
|
83
|
+
return positionUpdate;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.PointPositionUpdater = PointPositionUpdater;
|
|
87
|
+
//# sourceMappingURL=point-position-updater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"point-position-updater.js","sourceRoot":"","sources":["../../../src/features/change-bounds/point-position-updater.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAAiD;AACjD,mDAAiF;AACjF,yDAAsE;AACtE,uDAAsD;AAEtD,iDAAkE;AAClE,yDAAqD;AACrD,iCAAiC;AAEjC;;;;;;;GAOG;AACH,MAAa,oBAAoB;IAO7B,YAAY,KAAkC,EAAE,iBAAsC;QAJ5E,kBAAa,GAAoB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAKtD,IAAI,CAAC,eAAe,GAAG,KAAK,YAAY,kCAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,kCAAe,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;IACpH,CAAC;IASM,sBAAsB,CAAC,KAAyB;QACnD,IAAI,CAAC,gBAAgB,GAAG,IAAA,yBAAY,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAC7F,CAAC;IAED;;;OAGG;IACI,2BAA2B;QAC9B,OAAO,IAAI,CAAC,gBAAgB,KAAK,SA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AAI,IAAA,sBAAc,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAEnE,oDAAoD;QACpD,uDAAuD;QACvD,MAAM,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAC1G,IAAI,eAAK,CAAC,MAAM,CAAC,cAAc,EAAE,eAAK,CAAC,MAAM,CAAC,EAAE;YAC5C,OAAO,SAAS,CAAC;SACpB;QACD,wEAAwE;QACxE,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC;QACzC,OAAO,cAAc,CAAC;IAC1B,CAAC;CACJ;AAvFD,oDAuFC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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, ISnapper, Point } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { IHelperLineManager } from '../helper-lines/helper-line-manager';
|
|
18
|
+
import { Direction } from '../helper-lines/model';
|
|
19
|
+
export declare class PositionSnapper {
|
|
20
|
+
protected snapper?: ISnapper | undefined;
|
|
21
|
+
protected helperLineManager?: IHelperLineManager | undefined;
|
|
22
|
+
constructor(snapper?: ISnapper | undefined, helperLineManager?: IHelperLineManager | undefined);
|
|
23
|
+
snapPosition(position: Point, element: GModelElement, isSnap?: boolean): Point;
|
|
24
|
+
snapDelta(positionDelta: Point, element: GModelElement, isSnap: boolean, directions: Direction[]): Point;
|
|
25
|
+
protected getMinimumDelta(target: GModelElement, isSnap: boolean, directions: Direction[]): Point | undefined;
|
|
26
|
+
protected getHelperLineMinimum(target: GModelElement, isSnap: boolean, directions: Direction[]): Point | undefined;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=position-snapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position-snapper.d.ts","sourceRoot":"","sources":["../../../src/features/change-bounds/position-snapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAmB,MAAM,uBAAuB,CAAC;AAExF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,SAAS,EAA4B,MAAM,uBAAuB,CAAC;AAE5E,qBACa,eAAe;IAEgB,SAAS,CAAC,OAAO,CAAC;IACR,SAAS,CAAC,iBAAiB,CAAC;gBAD5B,OAAO,CAAC,sBAAU,EACR,iBAAiB,CAAC,gCAAoB;IAGlG,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,GAAE,OAAc,GAAG,KAAK;IAIpF,SAAS,CAAC,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK;IAWxG,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,GAAG,SAAS;IAI7G,SAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,GAAG,SAAS;CAsBrH"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PositionSnapper = void 0;
|
|
16
|
+
/********************************************************************************
|
|
17
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
18
|
+
*
|
|
19
|
+
* This program and the accompanying materials are made available under the
|
|
20
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
21
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
22
|
+
*
|
|
23
|
+
* This Source Code may also be made available under the following Secondary
|
|
24
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
25
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
26
|
+
* with the GNU Classpath Exception which is available at
|
|
27
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
28
|
+
*
|
|
29
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
30
|
+
********************************************************************************/
|
|
31
|
+
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
32
|
+
const inversify_1 = require("inversify");
|
|
33
|
+
const model_1 = require("../helper-lines/model");
|
|
34
|
+
let PositionSnapper = class PositionSnapper {
|
|
35
|
+
constructor(snapper, helperLineManager) {
|
|
36
|
+
this.snapper = snapper;
|
|
37
|
+
this.helperLineManager = helperLineManager;
|
|
38
|
+
}
|
|
39
|
+
snapPosition(position, element, isSnap = true) {
|
|
40
|
+
return isSnap && this.snapper ? this.snapper.snap(position, element) : { x: position.x, y: position.y };
|
|
41
|
+
}
|
|
42
|
+
snapDelta(positionDelta, element, isSnap, directions) {
|
|
43
|
+
const delta = this.snapPosition(positionDelta, element, isSnap);
|
|
44
|
+
const minimumDelta = this.getMinimumDelta(element, isSnap, directions);
|
|
45
|
+
if (!minimumDelta) {
|
|
46
|
+
return delta;
|
|
47
|
+
}
|
|
48
|
+
delta.x = Math.abs(delta.x) >= minimumDelta.x ? delta.x : 0;
|
|
49
|
+
delta.y = Math.abs(delta.y) >= minimumDelta.y ? delta.y : 0;
|
|
50
|
+
return delta;
|
|
51
|
+
}
|
|
52
|
+
getMinimumDelta(target, isSnap, directions) {
|
|
53
|
+
return this.getHelperLineMinimum(target, isSnap, directions);
|
|
54
|
+
}
|
|
55
|
+
getHelperLineMinimum(target, isSnap, directions) {
|
|
56
|
+
if (!this.helperLineManager) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const helperLines = target.root.children.filter(child => (0, model_1.isHelperLine)(child));
|
|
60
|
+
if (helperLines.length === 0) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const minimum = { x: 0, y: 0 };
|
|
64
|
+
if (directions.includes(model_1.Direction.Left) && helperLines.some(line => line.isLeft || line.isCenter)) {
|
|
65
|
+
minimum.x = this.helperLineManager.getHelperLineSnapping(target, isSnap, model_1.Direction.Left);
|
|
66
|
+
}
|
|
67
|
+
else if (directions.includes(model_1.Direction.Right) && helperLines.some(line => line.isRight || line.isCenter)) {
|
|
68
|
+
minimum.x = this.helperLineManager.getHelperLineSnapping(target, isSnap, model_1.Direction.Right);
|
|
69
|
+
}
|
|
70
|
+
if (directions.includes(model_1.Direction.Up) && helperLines.some(line => line.isTop || line.isMiddle)) {
|
|
71
|
+
minimum.y = this.helperLineManager.getHelperLineSnapping(target, isSnap, model_1.Direction.Up);
|
|
72
|
+
}
|
|
73
|
+
else if (directions.includes(model_1.Direction.Down) && helperLines.some(line => line.isBottom || line.isMiddle)) {
|
|
74
|
+
minimum.y = this.helperLineManager.getHelperLineSnapping(target, isSnap, model_1.Direction.Down);
|
|
75
|
+
}
|
|
76
|
+
return minimum;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
exports.PositionSnapper = PositionSnapper;
|
|
80
|
+
exports.PositionSnapper = PositionSnapper = __decorate([
|
|
81
|
+
(0, inversify_1.injectable)(),
|
|
82
|
+
__param(0, (0, inversify_1.optional)()),
|
|
83
|
+
__param(0, (0, inversify_1.inject)(sprotty_1.TYPES.ISnapper)),
|
|
84
|
+
__param(1, (0, inversify_1.optional)()),
|
|
85
|
+
__param(1, (0, inversify_1.inject)(sprotty_1.TYPES.IHelperLineManager)),
|
|
86
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
87
|
+
], PositionSnapper);
|
|
88
|
+
//# sourceMappingURL=position-snapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position-snapper.js","sourceRoot":"","sources":["../../../src/features/change-bounds/position-snapper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAAwF;AACxF,yCAAyD;AAEzD,iDAA4E;AAGrE,IAAM,eAAe,GAArB,MAAM,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,CAAC,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,iBAAS,CAAC,EAAE,CAAC,CAAC;SAC1F;aAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,iBAAS,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE;YACxG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,iBAAS,CAAC,IAAI,CAAC,CAAC;SAC5F;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ,CAAA;AA/CY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,sBAAU,GAAE;IAGJ,WAAA,IAAA,oBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,kBAAM,EAAC,eAAK,CAAC,QAAQ,CAAC,CAAA;IAClC,WAAA,IAAA,oBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,kBAAM,EAAC,eAAK,CAAC,kBAAkB,CAAC,CAAA;;GAHxC,eAAe,CA+C3B"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2020-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, ISnapper, KeyboardModifier, Point } from '@eclipse-glsp/sprotty';
|
|
2
17
|
/**
|
|
3
18
|
* A {@link ISnapper} implementation that snaps all elements onto a fixed gride size.
|
|
4
19
|
* The default grid size is 10x10 pixel.
|
|
@@ -18,46 +33,8 @@ export declare class GridSnapper implements ISnapper {
|
|
|
18
33
|
x: number;
|
|
19
34
|
y: number;
|
|
20
35
|
});
|
|
21
|
-
snap(position: Point,
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* This class can be used to calculate the current position, when an element is
|
|
25
|
-
* moved. This includes node movements, node resizing (resize handle movement)
|
|
26
|
-
* or edge routing-point movements.
|
|
27
|
-
*
|
|
28
|
-
* You can initialize a this class with a optional {@link ISnapper}. If a
|
|
29
|
-
* snapper is present, the positions will be snapped to the defined grid.
|
|
30
|
-
*/
|
|
31
|
-
export declare class PointPositionUpdater {
|
|
32
|
-
protected snapper?: ISnapper | undefined;
|
|
33
|
-
protected lastDragPosition?: Point;
|
|
34
|
-
protected positionDelta: Writable<Point>;
|
|
35
|
-
constructor(snapper?: ISnapper | undefined);
|
|
36
|
-
/**
|
|
37
|
-
* Init the position with the {@link Point} of your mouse cursor.
|
|
38
|
-
* This method is normally called in the `mouseDown` event.
|
|
39
|
-
* @param mousePosition current mouse position e.g `{x: event.pageX, y: event.pageY }`
|
|
40
|
-
*/
|
|
41
|
-
updateLastDragPosition(mousePosition: Point): void;
|
|
42
|
-
/**
|
|
43
|
-
* Check if the mouse is currently not in a drag mode.
|
|
44
|
-
* @returns true if the last drag position is undefined
|
|
45
|
-
*/
|
|
46
|
-
isLastDragPositionUndefined(): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Reset the updater for new movements.
|
|
49
|
-
* This method is normally called in the `mouseUp` event.
|
|
50
|
-
*/
|
|
51
|
-
resetPosition(): void;
|
|
52
|
-
/**
|
|
53
|
-
* Calculate the current position of your movement.
|
|
54
|
-
* This method is normally called in the `mouseMove` event.
|
|
55
|
-
* @param target node which is moved around
|
|
56
|
-
* @param mousePosition current mouse position e.g `{x: event.pageX, y: event.pageY }`
|
|
57
|
-
* @param isSnapEnabled if a snapper is defined you can disable it, e.g when a specific key is pressed `!event.altKey`
|
|
58
|
-
* @returns current position or undefined if updater has no last drag position initialized
|
|
59
|
-
*/
|
|
60
|
-
updatePosition(target: GModelElement, mousePosition: Point, isSnapEnabled: boolean): Point | undefined;
|
|
61
|
-
protected snap(position: Point, element: GModelElement, isSnap: boolean): Point;
|
|
36
|
+
snap(position: Point, _element: GModelElement): Point;
|
|
62
37
|
}
|
|
38
|
+
export declare function useSnap(event: MouseEvent | KeyboardEvent): boolean;
|
|
39
|
+
export declare function unsnapModifier(): KeyboardModifier;
|
|
63
40
|
//# sourceMappingURL=snap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snap.d.ts","sourceRoot":"","sources":["../../../src/features/change-bounds/snap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"snap.d.ts","sourceRoot":"","sources":["../../../src/features/change-bounds/snap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGzF;;;;;;;;;GASG;AACH,qBACa,WAAY,YAAW,QAAQ;IACrB,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;gBAA9B,IAAI,GAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAqB;IAEpE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,GAAG,KAAK;CAMxD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,GAAG,OAAO,CAElE;AAED,wBAAgB,cAAc,IAAI,gBAAgB,CAEjD"}
|
|
@@ -9,24 +9,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
/********************************************************************************
|
|
14
|
-
* Copyright (c) 2020-2023 EclipseSource and others.
|
|
15
|
-
*
|
|
16
|
-
* This program and the accompanying materials are made available under the
|
|
17
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
18
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
19
|
-
*
|
|
20
|
-
* This Source Code may also be made available under the following Secondary
|
|
21
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
22
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
23
|
-
* with the GNU Classpath Exception which is available at
|
|
24
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
25
|
-
*
|
|
26
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
27
|
-
********************************************************************************/
|
|
12
|
+
exports.unsnapModifier = exports.useSnap = exports.GridSnapper = void 0;
|
|
28
13
|
const inversify_1 = require("inversify");
|
|
29
|
-
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
30
14
|
/**
|
|
31
15
|
* A {@link ISnapper} implementation that snaps all elements onto a fixed gride size.
|
|
32
16
|
* The default grid size is 10x10 pixel.
|
|
@@ -41,7 +25,7 @@ let GridSnapper = class GridSnapper {
|
|
|
41
25
|
constructor(grid = { x: 10, y: 10 }) {
|
|
42
26
|
this.grid = grid;
|
|
43
27
|
}
|
|
44
|
-
snap(position,
|
|
28
|
+
snap(position, _element) {
|
|
45
29
|
return {
|
|
46
30
|
x: Math.round(position.x / this.grid.x) * this.grid.x,
|
|
47
31
|
y: Math.round(position.y / this.grid.y) * this.grid.y
|
|
@@ -53,79 +37,12 @@ exports.GridSnapper = GridSnapper = __decorate([
|
|
|
53
37
|
(0, inversify_1.injectable)(),
|
|
54
38
|
__metadata("design:paramtypes", [Object])
|
|
55
39
|
], GridSnapper);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* snapper is present, the positions will be snapped to the defined grid.
|
|
63
|
-
*/
|
|
64
|
-
class PointPositionUpdater {
|
|
65
|
-
constructor(snapper) {
|
|
66
|
-
this.snapper = snapper;
|
|
67
|
-
this.positionDelta = { x: 0, y: 0 };
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Init the position with the {@link Point} of your mouse cursor.
|
|
71
|
-
* This method is normally called in the `mouseDown` event.
|
|
72
|
-
* @param mousePosition current mouse position e.g `{x: event.pageX, y: event.pageY }`
|
|
73
|
-
*/
|
|
74
|
-
updateLastDragPosition(mousePosition) {
|
|
75
|
-
this.lastDragPosition = mousePosition;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Check if the mouse is currently not in a drag mode.
|
|
79
|
-
* @returns true if the last drag position is undefined
|
|
80
|
-
*/
|
|
81
|
-
isLastDragPositionUndefined() {
|
|
82
|
-
return this.lastDragPosition === undefined;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Reset the updater for new movements.
|
|
86
|
-
* This method is normally called in the `mouseUp` event.
|
|
87
|
-
*/
|
|
88
|
-
resetPosition() {
|
|
89
|
-
this.lastDragPosition = undefined;
|
|
90
|
-
this.positionDelta = { x: 0, y: 0 };
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Calculate the current position of your movement.
|
|
94
|
-
* This method is normally called in the `mouseMove` event.
|
|
95
|
-
* @param target node which is moved around
|
|
96
|
-
* @param mousePosition current mouse position e.g `{x: event.pageX, y: event.pageY }`
|
|
97
|
-
* @param isSnapEnabled if a snapper is defined you can disable it, e.g when a specific key is pressed `!event.altKey`
|
|
98
|
-
* @returns current position or undefined if updater has no last drag position initialized
|
|
99
|
-
*/
|
|
100
|
-
updatePosition(target, mousePosition, isSnapEnabled) {
|
|
101
|
-
var _a;
|
|
102
|
-
if (this.lastDragPosition) {
|
|
103
|
-
const newDragPosition = mousePosition;
|
|
104
|
-
const viewport = (0, sprotty_1.findParentByFeature)(target, sprotty_1.isViewport);
|
|
105
|
-
const zoom = (_a = viewport === null || viewport === void 0 ? void 0 : viewport.zoom) !== null && _a !== void 0 ? _a : 1;
|
|
106
|
-
const dx = (mousePosition.x - this.lastDragPosition.x) / zoom;
|
|
107
|
-
const dy = (mousePosition.y - this.lastDragPosition.y) / zoom;
|
|
108
|
-
const deltaToLastPosition = { x: dx, y: dy };
|
|
109
|
-
this.lastDragPosition = newDragPosition;
|
|
110
|
-
// update position delta with latest delta
|
|
111
|
-
this.positionDelta.x += deltaToLastPosition.x;
|
|
112
|
-
this.positionDelta.y += deltaToLastPosition.y;
|
|
113
|
-
// snap our delta and only send update if the position actually changes
|
|
114
|
-
// otherwise accumulate delta until we do snap to an update
|
|
115
|
-
const positionUpdate = this.snap(this.positionDelta, target, isSnapEnabled);
|
|
116
|
-
if (positionUpdate.x === 0 && positionUpdate.y === 0) {
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
119
|
-
// we update our position so we update our delta by the snapped position
|
|
120
|
-
this.positionDelta.x -= positionUpdate.x;
|
|
121
|
-
this.positionDelta.y -= positionUpdate.y;
|
|
122
|
-
return positionUpdate;
|
|
123
|
-
}
|
|
124
|
-
return undefined;
|
|
125
|
-
}
|
|
126
|
-
snap(position, element, isSnap) {
|
|
127
|
-
return isSnap && this.snapper ? this.snapper.snap(position, element) : { x: position.x, y: position.y };
|
|
128
|
-
}
|
|
40
|
+
function useSnap(event) {
|
|
41
|
+
return !event.shiftKey;
|
|
42
|
+
}
|
|
43
|
+
exports.useSnap = useSnap;
|
|
44
|
+
function unsnapModifier() {
|
|
45
|
+
return 'shift';
|
|
129
46
|
}
|
|
130
|
-
exports.
|
|
47
|
+
exports.unsnapModifier = unsnapModifier;
|
|
131
48
|
//# sourceMappingURL=snap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snap.js","sourceRoot":"","sources":["../../../src/features/change-bounds/snap.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"snap.js","sourceRoot":"","sources":["../../../src/features/change-bounds/snap.ts"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,yCAAuC;AAEvC;;;;;;;;;GASG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAW;IACpB,YAAmB,OAAiC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;QAAjD,SAAI,GAAJ,IAAI,CAA6C;IAAG,CAAC;IAExE,IAAI,CAAC,QAAe,EAAE,QAAuB;QACzC,OAAO;YACH,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;SACxD,CAAC;IACN,CAAC;CACJ,CAAA;AATY,kCAAW;sBAAX,WAAW;IADvB,IAAA,sBAAU,GAAE;;GACA,WAAW,CASvB;AAED,SAAgB,OAAO,CAAC,KAAiC;IACrD,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;AAC3B,CAAC;AAFD,0BAEC;AAED,SAAgB,cAAc;IAC1B,OAAO,OAAO,CAAC;AACnB,CAAC;AAFD,wCAEC"}
|