@eclipse-glsp/client 2.2.0-next.328 → 2.2.0-next.330
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/change-bounds.css +15 -0
- package/css/glsp-sprotty.css +17 -0
- package/lib/base/action-dispatcher.js.map +1 -1
- package/lib/base/action-handler-registry.js.map +1 -1
- package/lib/base/args-feature.js.map +1 -1
- package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
- package/lib/base/auto-complete/validation-decorator.js.map +1 -1
- package/lib/base/command-stack.js.map +1 -1
- package/lib/base/drag-aware-mouse-listener.d.ts +5 -2
- package/lib/base/drag-aware-mouse-listener.d.ts.map +1 -1
- package/lib/base/drag-aware-mouse-listener.js +11 -0
- package/lib/base/drag-aware-mouse-listener.js.map +1 -1
- package/lib/base/editor-context-service.js.map +1 -1
- package/lib/base/feedback/css-feedback.d.ts +4 -0
- package/lib/base/feedback/css-feedback.d.ts.map +1 -1
- package/lib/base/feedback/css-feedback.js +4 -0
- package/lib/base/feedback/css-feedback.js.map +1 -1
- package/lib/base/feedback/feeback-emitter.d.ts +67 -0
- package/lib/base/feedback/feeback-emitter.d.ts.map +1 -0
- package/lib/base/feedback/feeback-emitter.js +109 -0
- package/lib/base/feedback/feeback-emitter.js.map +1 -0
- package/lib/base/feedback/feedback-action-dispatcher.d.ts +17 -5
- package/lib/base/feedback/feedback-action-dispatcher.d.ts.map +1 -1
- package/lib/base/feedback/feedback-action-dispatcher.js +23 -3
- package/lib/base/feedback/feedback-action-dispatcher.js.map +1 -1
- package/lib/base/feedback/index.d.ts +1 -0
- package/lib/base/feedback/index.d.ts.map +1 -1
- package/lib/base/feedback/index.js +1 -0
- package/lib/base/feedback/index.js.map +1 -1
- package/lib/base/focus/focus-tracker.js.map +1 -1
- package/lib/base/model/diagram-loader.js.map +1 -1
- package/lib/base/model/glsp-model-source.js.map +1 -1
- package/lib/base/model/model-initialization-constraint.js.map +1 -1
- package/lib/base/model/model-registry.js.map +1 -1
- package/lib/base/selection-clearing-mouse-listener.js.map +1 -1
- package/lib/base/selection-service.d.ts +3 -2
- package/lib/base/selection-service.d.ts.map +1 -1
- package/lib/base/selection-service.js.map +1 -1
- package/lib/base/tool-manager/index.d.ts +2 -2
- package/lib/base/tool-manager/index.d.ts.map +1 -1
- package/lib/base/tool-manager/index.js +2 -2
- package/lib/base/tool-manager/index.js.map +1 -1
- package/lib/base/tool-manager/tool-manager.js.map +1 -1
- package/lib/base/view/mouse-tool.js.map +1 -1
- package/lib/base/view/view-registry.js.map +1 -1
- package/lib/default-modules.d.ts +1 -1
- package/lib/default-modules.js +1 -1
- package/lib/default-modules.js.map +1 -1
- package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-palette.js.map +1 -1
- package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-tool.js.map +1 -1
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js.map +1 -1
- package/lib/features/accessibility/element-navigation/left-right-top-bottom-navigator.js.map +1 -1
- package/lib/features/accessibility/element-navigation/local-element-navigator.d.ts +3 -3
- package/lib/features/accessibility/element-navigation/local-element-navigator.d.ts.map +1 -1
- package/lib/features/accessibility/element-navigation/local-element-navigator.js.map +1 -1
- package/lib/features/accessibility/element-navigation/position-navigator.js.map +1 -1
- package/lib/features/accessibility/focus-tracker/focus-tracker-tool.js.map +1 -1
- package/lib/features/accessibility/global-keylistener-tool.js.map +1 -1
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut-tool.js.map +1 -1
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut.js.map +1 -1
- package/lib/features/accessibility/key-shortcut/index.d.ts +2 -2
- package/lib/features/accessibility/key-shortcut/index.d.ts.map +1 -1
- package/lib/features/accessibility/key-shortcut/index.js +2 -2
- package/lib/features/accessibility/key-shortcut/index.js.map +1 -1
- package/lib/features/accessibility/keyboard-grid/index.d.ts +2 -2
- package/lib/features/accessibility/keyboard-grid/index.d.ts.map +1 -1
- package/lib/features/accessibility/keyboard-grid/index.js +2 -2
- package/lib/features/accessibility/keyboard-grid/index.js.map +1 -1
- package/lib/features/accessibility/keyboard-grid/keyboard-grid.js.map +1 -1
- package/lib/features/accessibility/keyboard-grid/keyboard-node-grid.js.map +1 -1
- package/lib/features/accessibility/keyboard-pointer/index.d.ts +2 -2
- package/lib/features/accessibility/keyboard-pointer/index.d.ts.map +1 -1
- package/lib/features/accessibility/keyboard-pointer/index.js +2 -2
- package/lib/features/accessibility/keyboard-pointer/index.js.map +1 -1
- package/lib/features/accessibility/keyboard-pointer/keyboard-pointer-listener.d.ts +1 -1
- package/lib/features/accessibility/keyboard-pointer/keyboard-pointer-listener.d.ts.map +1 -1
- package/lib/features/accessibility/keyboard-pointer/keyboard-pointer-listener.js +1 -1
- package/lib/features/accessibility/keyboard-pointer/keyboard-pointer-listener.js.map +1 -1
- package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.js.map +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/index.d.ts +2 -2
- package/lib/features/accessibility/keyboard-tool-palette/index.d.ts.map +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/index.js +2 -2
- package/lib/features/accessibility/keyboard-tool-palette/index.js.map +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.js.map +1 -1
- package/lib/features/accessibility/move-zoom/move-handler.d.ts +4 -2
- package/lib/features/accessibility/move-zoom/move-handler.d.ts.map +1 -1
- package/lib/features/accessibility/move-zoom/move-handler.js +10 -4
- package/lib/features/accessibility/move-zoom/move-handler.js.map +1 -1
- package/lib/features/accessibility/move-zoom/zoom-handler.js.map +1 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-handler.d.ts +4 -2
- package/lib/features/accessibility/resize-key-tool/resize-key-handler.d.ts.map +1 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-handler.js +11 -3
- package/lib/features/accessibility/resize-key-tool/resize-key-handler.js.map +1 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-tool.js.map +1 -1
- package/lib/features/accessibility/search/index.d.ts +2 -2
- package/lib/features/accessibility/search/index.d.ts.map +1 -1
- package/lib/features/accessibility/search/index.js +2 -2
- package/lib/features/accessibility/search/index.js.map +1 -1
- package/lib/features/accessibility/search/search-palette.js.map +1 -1
- package/lib/features/accessibility/search/search-tool.js.map +1 -1
- package/lib/features/accessibility/toast/toast-tool.js.map +1 -1
- package/lib/features/accessibility/view-key-tools/deselect-key-tool.js.map +1 -1
- package/lib/features/accessibility/view-key-tools/movement-key-tool.js.map +1 -1
- package/lib/features/accessibility/view-key-tools/zoom-key-tool.js.map +1 -1
- package/lib/features/bounds/freeform-layout.js.map +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -1
- package/lib/features/bounds/hbox-layout.js.map +1 -1
- package/lib/features/bounds/layouter.js.map +1 -1
- package/lib/features/bounds/local-bounds.js.map +1 -1
- package/lib/features/bounds/set-bounds-feedback-command.js.map +1 -1
- package/lib/features/bounds/vbox-layout.js.map +1 -1
- package/lib/features/change-bounds/model.d.ts +8 -8
- package/lib/features/change-bounds/model.d.ts.map +1 -1
- package/lib/features/change-bounds/model.js +17 -5
- package/lib/features/change-bounds/model.js.map +1 -1
- package/lib/features/change-bounds/movement-restrictor.d.ts +3 -2
- package/lib/features/change-bounds/movement-restrictor.d.ts.map +1 -1
- package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
- package/lib/features/change-bounds/point-position-updater.js.map +1 -1
- package/lib/features/change-bounds/position-snapper.js.map +1 -1
- package/lib/features/command-palette/command-palette-module.d.ts +1 -1
- package/lib/features/command-palette/command-palette-module.js +1 -1
- package/lib/features/command-palette/command-palette.js.map +1 -1
- package/lib/features/command-palette/index.d.ts +1 -1
- package/lib/features/command-palette/index.js +1 -1
- package/lib/features/command-palette/server-command-palette-provider.js.map +1 -1
- package/lib/features/context-menu/context-menu-module.js.map +1 -1
- package/lib/features/context-menu/glsp-context-menu-mouse-listener.js.map +1 -1
- package/lib/features/context-menu/server-context-menu-provider.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-context-menu.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-handler.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-standalone.js.map +1 -1
- package/lib/features/decoration/decoration-placer.js.map +1 -1
- package/lib/features/element-template/add-template-element.js.map +1 -1
- package/lib/features/element-template/mouse-tracking-element-position-listener.d.ts +15 -5
- 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 +27 -38
- package/lib/features/element-template/mouse-tracking-element-position-listener.js.map +1 -1
- package/lib/features/element-template/remove-template-element.js.map +1 -1
- package/lib/features/export/glsp-svg-exporter.js.map +1 -1
- package/lib/features/helper-lines/helper-line-feedback.js.map +1 -1
- package/lib/features/helper-lines/helper-line-manager-default.d.ts +4 -2
- package/lib/features/helper-lines/helper-line-manager-default.d.ts.map +1 -1
- package/lib/features/helper-lines/helper-line-manager-default.js +8 -12
- package/lib/features/helper-lines/helper-line-manager-default.js.map +1 -1
- package/lib/features/helper-lines/index.d.ts +2 -2
- package/lib/features/helper-lines/index.d.ts.map +1 -1
- package/lib/features/helper-lines/index.js +2 -2
- package/lib/features/helper-lines/index.js.map +1 -1
- package/lib/features/helper-lines/model.js.map +1 -1
- package/lib/features/helper-lines/view.js.map +1 -1
- package/lib/features/hints/type-hint-provider.d.ts +3 -0
- package/lib/features/hints/type-hint-provider.d.ts.map +1 -1
- package/lib/features/hints/type-hint-provider.js +10 -1
- package/lib/features/hints/type-hint-provider.js.map +1 -1
- package/lib/features/hover/hover.js.map +1 -1
- package/lib/features/hover/index.d.ts +2 -2
- package/lib/features/hover/index.d.ts.map +1 -1
- package/lib/features/hover/index.js +2 -2
- package/lib/features/hover/index.js.map +1 -1
- package/lib/features/index.d.ts +2 -1
- package/lib/features/index.d.ts.map +1 -1
- package/lib/features/index.js +2 -1
- package/lib/features/index.js.map +1 -1
- package/lib/features/label-edit/edit-label-validator.js.map +1 -1
- package/lib/features/label-edit-ui/label-edit-ui.js.map +1 -1
- package/lib/features/layout/layout-elements-action.js.map +1 -1
- package/lib/features/navigation/navigation-action-handler.js.map +1 -1
- package/lib/features/navigation/navigation-target-resolver.js.map +1 -1
- package/lib/features/reconnect/model.js.map +1 -1
- package/lib/features/routing/glsp-manhattan-edge-router.js.map +1 -1
- package/lib/features/save/save-keylistener.js.map +1 -1
- package/lib/features/select/select-mouse-listener.d.ts +4 -3
- package/lib/features/select/select-mouse-listener.d.ts.map +1 -1
- package/lib/features/select/select-mouse-listener.js.map +1 -1
- package/lib/features/source-model-watcher/source-model-changed-action-handler.js.map +1 -1
- package/lib/features/status/status-overlay.js.map +1 -1
- package/lib/features/svg-metadata/metadata-placer.js.map +1 -1
- package/lib/features/tool-palette/index.d.ts +2 -2
- package/lib/features/tool-palette/index.d.ts.map +1 -1
- package/lib/features/tool-palette/index.js +2 -2
- package/lib/features/tool-palette/index.js.map +1 -1
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/tools/base-tools.d.ts +23 -4
- package/lib/features/tools/base-tools.d.ts.map +1 -1
- package/lib/features/tools/base-tools.js +11 -6
- package/lib/features/tools/base-tools.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.d.ts +1 -35
- 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 +5 -206
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-module.d.ts +1 -0
- package/lib/features/tools/change-bounds/change-bounds-tool-module.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-module.js +1 -0
- package/lib/features/tools/change-bounds/change-bounds-tool-module.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.d.ts +67 -0
- package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.d.ts.map +1 -0
- package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.js +227 -0
- package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.js.map +1 -0
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts +34 -24
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.js +172 -180
- package/lib/features/tools/change-bounds/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/change-bounds/index.d.ts +3 -2
- package/lib/features/tools/change-bounds/index.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/index.js +3 -2
- package/lib/features/tools/change-bounds/index.js.map +1 -1
- package/lib/features/tools/change-bounds/view.d.ts +1 -1
- package/lib/features/tools/change-bounds/view.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/view.js +3 -0
- package/lib/features/tools/change-bounds/view.js.map +1 -1
- package/lib/features/tools/deletion/delete-tool.d.ts +16 -1
- package/lib/features/tools/deletion/delete-tool.d.ts.map +1 -1
- package/lib/features/tools/deletion/delete-tool.js +5 -2
- package/lib/features/tools/deletion/delete-tool.js.map +1 -1
- package/lib/features/tools/edge-creation/dangling-edge-feedback.d.ts +17 -1
- package/lib/features/tools/edge-creation/dangling-edge-feedback.d.ts.map +1 -1
- package/lib/features/tools/edge-creation/dangling-edge-feedback.js +3 -1
- package/lib/features/tools/edge-creation/dangling-edge-feedback.js.map +1 -1
- package/lib/features/tools/edge-creation/edge-creation-tool-feedback.d.ts +4 -2
- package/lib/features/tools/edge-creation/edge-creation-tool-feedback.d.ts.map +1 -1
- package/lib/features/tools/edge-creation/edge-creation-tool-feedback.js +5 -8
- package/lib/features/tools/edge-creation/edge-creation-tool-feedback.js.map +1 -1
- package/lib/features/tools/edge-creation/edge-creation-tool.d.ts +20 -2
- package/lib/features/tools/edge-creation/edge-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-creation/edge-creation-tool.js +23 -18
- package/lib/features/tools/edge-creation/edge-creation-tool.js.map +1 -1
- package/lib/features/tools/edge-creation/index.d.ts +2 -2
- package/lib/features/tools/edge-creation/index.d.ts.map +1 -1
- package/lib/features/tools/edge-creation/index.js +2 -2
- package/lib/features/tools/edge-creation/index.js.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool-feedback.d.ts +3 -1
- 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 +5 -8
- 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 +4 -4
- package/lib/features/tools/edge-edit/edge-edit-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool.js +27 -44
- package/lib/features/tools/edge-edit/edge-edit-tool.js.map +1 -1
- package/lib/features/tools/edge-edit/index.d.ts +2 -2
- package/lib/features/tools/edge-edit/index.d.ts.map +1 -1
- package/lib/features/tools/edge-edit/index.js +2 -2
- package/lib/features/tools/edge-edit/index.js.map +1 -1
- package/lib/features/tools/marquee-selection/index.d.ts +2 -2
- package/lib/features/tools/marquee-selection/index.d.ts.map +1 -1
- package/lib/features/tools/marquee-selection/index.js +2 -2
- package/lib/features/tools/marquee-selection/index.js.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-behavior.js.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.d.ts +3 -2
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.d.ts.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.js +4 -2
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.js.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-tool-feedback.js.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-tool.js.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.d.ts +14 -5
- package/lib/features/tools/node-creation/node-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.js +58 -24
- package/lib/features/tools/node-creation/node-creation-tool.js.map +1 -1
- package/lib/features/tools/tool-focus-loss-module.js.map +1 -1
- package/lib/features/undo-redo/undo-redo-key-listener.js.map +1 -1
- package/lib/features/validation/issue-marker.js.map +1 -1
- package/lib/features/validation/marker-navigator.d.ts +7 -6
- package/lib/features/validation/marker-navigator.d.ts.map +1 -1
- package/lib/features/validation/marker-navigator.js.map +1 -1
- package/lib/features/validation/validate.d.ts +2 -5
- package/lib/features/validation/validate.d.ts.map +1 -1
- package/lib/features/validation/validate.js +4 -16
- package/lib/features/validation/validate.js.map +1 -1
- package/lib/features/viewport/glsp-scroll-mouse-listener.js.map +1 -1
- package/lib/features/viewport/reposition.js.map +1 -1
- package/lib/features/viewport/viewport-handler.js.map +1 -1
- package/lib/model.js.map +1 -1
- package/lib/standalone-modules.js.map +1 -1
- package/lib/utils/argument-utils.js.map +1 -1
- package/lib/utils/geometry-util.d.ts +1 -1
- package/lib/utils/geometry-util.d.ts.map +1 -1
- package/lib/utils/gmodel-util.d.ts +27 -2
- package/lib/utils/gmodel-util.d.ts.map +1 -1
- package/lib/utils/gmodel-util.js +30 -1
- package/lib/utils/gmodel-util.js.map +1 -1
- package/lib/utils/html-utils.js.map +1 -1
- package/lib/utils/layout-utils.d.ts +8 -7
- package/lib/utils/layout-utils.d.ts.map +1 -1
- package/lib/utils/layout-utils.js +2 -4
- package/lib/utils/layout-utils.js.map +1 -1
- package/lib/utils/marker.js.map +1 -1
- package/lib/utils/viewpoint-util.d.ts +4 -4
- package/lib/utils/viewpoint-util.d.ts.map +1 -1
- package/lib/utils/viewpoint-util.js.map +1 -1
- package/lib/views/compartments.js.map +1 -1
- package/lib/views/gedge-view.js.map +1 -1
- package/lib/views/glsp-projection-view.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/lib/views/issue-marker-view.js.map +1 -1
- package/lib/views/rounded-corner-view.js.map +1 -1
- package/lib/views/rounded-corner.d.ts +1 -1
- package/lib/views/rounded-corner.d.ts.map +1 -1
- package/lib/views/rounded-corner.js.map +1 -1
- package/package.json +3 -3
- package/src/base/drag-aware-mouse-listener.ts +16 -2
- package/src/base/feedback/css-feedback.ts +4 -0
- package/src/base/feedback/feeback-emitter.ts +112 -0
- package/src/base/feedback/feedback-action-dispatcher.ts +41 -6
- package/src/base/feedback/index.ts +1 -0
- package/src/base/selection-service.spec.ts +5 -0
- package/src/base/selection-service.ts +2 -3
- package/src/features/accessibility/element-navigation/local-element-navigator.ts +4 -4
- package/src/features/accessibility/move-zoom/move-handler.ts +11 -6
- package/src/features/accessibility/resize-key-tool/resize-key-handler.ts +11 -7
- package/src/features/change-bounds/model.ts +25 -13
- package/src/features/change-bounds/movement-restrictor.ts +6 -22
- package/src/features/element-template/mouse-tracking-element-position-listener.ts +55 -45
- package/src/features/helper-lines/helper-line-feedback.ts +50 -57
- package/src/features/helper-lines/helper-line-manager-default.ts +12 -21
- package/src/features/helper-lines/model.ts +6 -25
- package/src/features/hints/type-hint-provider.spec.ts +4 -1
- package/src/features/hints/type-hint-provider.ts +9 -2
- package/src/features/layout/layout-elements-action.ts +10 -7
- package/src/features/select/select-mouse-listener.ts +4 -3
- package/src/features/tools/base-tools.ts +15 -8
- package/src/features/tools/change-bounds/change-bounds-tool-feedback.ts +6 -232
- package/src/features/tools/change-bounds/change-bounds-tool-module.ts +1 -0
- package/src/features/tools/change-bounds/change-bounds-tool-move-feedback.ts +254 -0
- package/src/features/tools/change-bounds/change-bounds-tool.ts +217 -226
- package/src/features/tools/change-bounds/index.ts +1 -0
- package/src/features/tools/change-bounds/view.tsx +4 -1
- package/src/features/tools/deletion/delete-tool.ts +6 -6
- package/src/features/tools/edge-creation/dangling-edge-feedback.ts +7 -4
- package/src/features/tools/edge-creation/edge-creation-tool-feedback.ts +9 -9
- package/src/features/tools/edge-creation/edge-creation-tool.ts +33 -23
- package/src/features/tools/edge-edit/edge-edit-tool-feedback.ts +8 -8
- package/src/features/tools/edge-edit/edge-edit-tool.ts +42 -49
- package/src/features/tools/marquee-selection/marquee-mouse-tool.ts +7 -6
- package/src/features/tools/node-creation/node-creation-tool.ts +69 -25
- package/src/features/validation/marker-navigator.ts +6 -8
- package/src/features/validation/validate.ts +5 -20
- package/src/features/viewport/reposition.ts +11 -14
- package/src/utils/geometry-util.ts +45 -64
- package/src/utils/gmodel-util.ts +45 -2
- package/src/utils/layout-utils.ts +9 -20
- package/src/utils/viewpoint-util.ts +13 -25
- package/lib/base/action-dispatcher.spec.d.ts +0 -2
- package/lib/base/action-dispatcher.spec.d.ts.map +0 -1
- package/lib/base/action-dispatcher.spec.js +0 -78
- package/lib/base/action-dispatcher.spec.js.map +0 -1
- package/lib/base/model/model-initialization-constraint.spec.d.ts +0 -2
- package/lib/base/model/model-initialization-constraint.spec.d.ts.map +0 -1
- package/lib/base/model/model-initialization-constraint.spec.js +0 -97
- package/lib/base/model/model-initialization-constraint.spec.js.map +0 -1
- package/lib/base/selection-service.spec.d.ts +0 -2
- package/lib/base/selection-service.spec.d.ts.map +0 -1
- package/lib/base/selection-service.spec.js +0 -287
- package/lib/base/selection-service.spec.js.map +0 -1
- package/lib/features/bounds/freeform-layout.spec.d.ts +0 -3
- package/lib/features/bounds/freeform-layout.spec.d.ts.map +0 -1
- package/lib/features/bounds/freeform-layout.spec.js +0 -201
- package/lib/features/bounds/freeform-layout.spec.js.map +0 -1
- package/lib/features/bounds/hbox-layout.spec.d.ts +0 -3
- package/lib/features/bounds/hbox-layout.spec.d.ts.map +0 -1
- package/lib/features/bounds/hbox-layout.spec.js +0 -160
- package/lib/features/bounds/hbox-layout.spec.js.map +0 -1
- package/lib/features/bounds/layouter-test-util.spec.d.ts +0 -32
- package/lib/features/bounds/layouter-test-util.spec.d.ts.map +0 -1
- package/lib/features/bounds/layouter-test-util.spec.js +0 -96
- package/lib/features/bounds/layouter-test-util.spec.js.map +0 -1
- package/lib/features/bounds/vbox-layout.spec.d.ts +0 -3
- package/lib/features/bounds/vbox-layout.spec.d.ts.map +0 -1
- package/lib/features/bounds/vbox-layout.spec.js +0 -160
- package/lib/features/bounds/vbox-layout.spec.js.map +0 -1
- package/lib/features/change-bounds/snap.spec.d.ts +0 -17
- package/lib/features/change-bounds/snap.spec.d.ts.map +0 -1
- package/lib/features/change-bounds/snap.spec.js +0 -83
- package/lib/features/change-bounds/snap.spec.js.map +0 -1
- package/lib/features/hints/type-hint-provider.spec.d.ts +0 -2
- package/lib/features/hints/type-hint-provider.spec.d.ts.map +0 -1
- package/lib/features/hints/type-hint-provider.spec.js +0 -333
- package/lib/features/hints/type-hint-provider.spec.js.map +0 -1
- package/lib/features/layout/layout-elements-action.spec.d.ts +0 -3
- package/lib/features/layout/layout-elements-action.spec.d.ts.map +0 -1
- package/lib/features/layout/layout-elements-action.spec.js +0 -329
- package/lib/features/layout/layout-elements-action.spec.js.map +0 -1
- package/lib/features/navigation/navigation-target-resolver.spec.d.ts +0 -3
- package/lib/features/navigation/navigation-target-resolver.spec.d.ts.map +0 -1
- package/lib/features/navigation/navigation-target-resolver.spec.js +0 -53
- package/lib/features/navigation/navigation-target-resolver.spec.js.map +0 -1
- package/lib/features/tools/marquee-selection/marquee-behavior.spec.d.ts +0 -17
- package/lib/features/tools/marquee-selection/marquee-behavior.spec.d.ts.map +0 -1
- package/lib/features/tools/marquee-selection/marquee-behavior.spec.js +0 -165
- package/lib/features/tools/marquee-selection/marquee-behavior.spec.js.map +0 -1
- package/lib/features/validation/marker-navigator.spec.d.ts +0 -3
- package/lib/features/validation/marker-navigator.spec.d.ts.map +0 -1
- package/lib/features/validation/marker-navigator.spec.js +0 -166
- package/lib/features/validation/marker-navigator.spec.js.map +0 -1
- package/lib/utils/gmodel-util.spec.d.ts +0 -2
- package/lib/utils/gmodel-util.spec.d.ts.map +0 -1
- package/lib/utils/gmodel-util.spec.js +0 -186
- package/lib/utils/gmodel-util.spec.js.map +0 -1
|
@@ -18,20 +18,25 @@ import {
|
|
|
18
18
|
CreateNodeOperation,
|
|
19
19
|
GModelElement,
|
|
20
20
|
GNode,
|
|
21
|
+
GhostElement,
|
|
21
22
|
Point,
|
|
22
23
|
TYPES,
|
|
23
24
|
TriggerNodeCreationAction,
|
|
24
25
|
findParentByFeature,
|
|
25
|
-
isCtrlOrCmd
|
|
26
|
+
isCtrlOrCmd,
|
|
27
|
+
isMoveable
|
|
26
28
|
} from '@eclipse-glsp/sprotty';
|
|
27
29
|
import { inject, injectable, optional } from 'inversify';
|
|
28
30
|
import '../../../../css/ghost-element.css';
|
|
31
|
+
import { FeedbackEmitter } from '../../../base';
|
|
29
32
|
import { DragAwareMouseListener } from '../../../base/drag-aware-mouse-listener';
|
|
30
33
|
import { CSS_GHOST_ELEMENT, CSS_HIDDEN, CursorCSS, cursorFeedbackAction } from '../../../base/feedback/css-feedback';
|
|
31
34
|
import { EnableDefaultToolsAction } from '../../../base/tool-manager/tool';
|
|
35
|
+
import { MoveableElement, isValidMove } from '../../../utils';
|
|
32
36
|
import { getAbsolutePosition } from '../../../utils/viewpoint-util';
|
|
33
37
|
import { IMovementRestrictor } from '../../change-bounds/movement-restrictor';
|
|
34
38
|
import { PositionSnapper } from '../../change-bounds/position-snapper';
|
|
39
|
+
import { RemoveTemplateElementsAction } from '../../element-template';
|
|
35
40
|
import { AddTemplateElementsAction, getTemplateElementId } from '../../element-template/add-template-element';
|
|
36
41
|
import { MouseTrackingElementPositionListener, PositioningTool } from '../../element-template/mouse-tracking-element-position-listener';
|
|
37
42
|
import { Containable, isContainable } from '../../hints/model';
|
|
@@ -53,34 +58,39 @@ export class NodeCreationTool extends BaseCreationTool<TriggerNodeCreationAction
|
|
|
53
58
|
doEnable(): void {
|
|
54
59
|
let trackingListener: MouseTrackingElementPositionListener | undefined;
|
|
55
60
|
const ghostElement = this.triggerAction.ghostElement;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this
|
|
59
|
-
|
|
60
|
-
[AddTemplateElementsAction.create({ templates: [ghostElement.template], addClasses: [CSS_HIDDEN, CSS_GHOST_ELEMENT] })],
|
|
61
|
-
ghostElement
|
|
62
|
-
),
|
|
63
|
-
this.mouseTool.registerListener(trackingListener)
|
|
64
|
-
);
|
|
61
|
+
const ghostElementId = ghostElement ? getTemplateElementId(ghostElement.template) : undefined;
|
|
62
|
+
if (ghostElement && ghostElementId) {
|
|
63
|
+
trackingListener = new MouseTrackingElementPositionListener(ghostElementId, this, 'middle');
|
|
64
|
+
this.toDisposeOnDisable.push(trackingListener, this.mouseTool.registerListener(trackingListener));
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
const toolListener = new NodeCreationToolMouseListener(this.triggerAction, this, ghostElement);
|
|
67
68
|
this.toDisposeOnDisable.push(
|
|
68
|
-
|
|
69
|
-
this.
|
|
69
|
+
toolListener,
|
|
70
|
+
this.mouseTool.registerListener(toolListener),
|
|
71
|
+
this.createFeedbackEmitter().add(cursorFeedbackAction(CursorCSS.NODE_CREATION), cursorFeedbackAction()).submit()
|
|
70
72
|
);
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
@injectable()
|
|
75
76
|
export class NodeCreationToolMouseListener extends DragAwareMouseListener {
|
|
76
77
|
protected container?: GModelElement & Containable;
|
|
78
|
+
protected cursorFeedback: FeedbackEmitter;
|
|
79
|
+
protected ghostElementFeedback: FeedbackEmitter;
|
|
80
|
+
protected ghostElementId?: string;
|
|
77
81
|
|
|
78
82
|
constructor(
|
|
79
83
|
protected triggerAction: TriggerNodeCreationAction,
|
|
80
84
|
protected tool: NodeCreationTool,
|
|
81
|
-
protected
|
|
85
|
+
protected ghostElement?: GhostElement
|
|
82
86
|
) {
|
|
83
87
|
super();
|
|
88
|
+
this.cursorFeedback = tool.createFeedbackEmitter();
|
|
89
|
+
this.ghostElementFeedback = tool.createFeedbackEmitter();
|
|
90
|
+
if (ghostElement) {
|
|
91
|
+
this.ghostElementId = getTemplateElementId(ghostElement.template);
|
|
92
|
+
}
|
|
93
|
+
this.createGhostElement();
|
|
84
94
|
}
|
|
85
95
|
|
|
86
96
|
protected creationAllowed(elementTypeId: string): boolean | undefined {
|
|
@@ -98,24 +108,48 @@ export class NodeCreationToolMouseListener extends DragAwareMouseListener {
|
|
|
98
108
|
}
|
|
99
109
|
|
|
100
110
|
if (this.creationAllowed(this.elementTypeId)) {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
111
|
+
const location = this.getValidInsertPosition(target, event);
|
|
112
|
+
if (location) {
|
|
113
|
+
const containerId = this.container?.id;
|
|
114
|
+
result.push(CreateNodeOperation.create(this.elementTypeId, { location, containerId, args: this.triggerAction.args }));
|
|
115
|
+
}
|
|
104
116
|
if (!isCtrlOrCmd(event)) {
|
|
117
|
+
// we no longer want to show the ghost element AFTER the next update
|
|
118
|
+
this.ghostElementFeedback.discard();
|
|
105
119
|
result.push(EnableDefaultToolsAction.create());
|
|
106
120
|
} else {
|
|
107
|
-
|
|
121
|
+
// we continue in stamp mode so we keep the ghost but dispose everything else
|
|
122
|
+
this.disposeAllButGhostElement();
|
|
108
123
|
}
|
|
109
124
|
}
|
|
110
125
|
return result;
|
|
111
126
|
}
|
|
112
127
|
|
|
113
|
-
protected
|
|
114
|
-
if (this.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
128
|
+
protected createGhostElement(): void {
|
|
129
|
+
if (!this.ghostElement) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const templates = [this.ghostElement.template];
|
|
133
|
+
this.ghostElementFeedback
|
|
134
|
+
.add(
|
|
135
|
+
AddTemplateElementsAction.create({ templates, addClasses: [CSS_HIDDEN, CSS_GHOST_ELEMENT] }),
|
|
136
|
+
RemoveTemplateElementsAction.create({ templates })
|
|
137
|
+
)
|
|
138
|
+
.submit();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
protected getGhostElement(): MoveableElement | undefined {
|
|
142
|
+
if (!this.ghostElementId) {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
const ghostElement = this.container?.index.getById(this.ghostElementId);
|
|
146
|
+
return ghostElement && isMoveable(ghostElement) ? ghostElement : undefined;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
protected getValidInsertPosition(target: GModelElement, event: MouseEvent): Point | undefined {
|
|
150
|
+
const ghostElement = this.getGhostElement();
|
|
151
|
+
if (ghostElement) {
|
|
152
|
+
return isValidMove(ghostElement, ghostElement.position, this.tool.movementRestrictor) ? ghostElement.position : undefined;
|
|
119
153
|
}
|
|
120
154
|
const location = getAbsolutePosition(target, event);
|
|
121
155
|
|
|
@@ -132,8 +166,18 @@ export class NodeCreationToolMouseListener extends DragAwareMouseListener {
|
|
|
132
166
|
const feedback = this.creationAllowed(this.elementTypeId)
|
|
133
167
|
? cursorFeedbackAction(CursorCSS.NODE_CREATION)
|
|
134
168
|
: cursorFeedbackAction(CursorCSS.OPERATION_NOT_ALLOWED);
|
|
135
|
-
this.
|
|
169
|
+
this.cursorFeedback.add(feedback).submit();
|
|
136
170
|
}
|
|
137
171
|
return [];
|
|
138
172
|
}
|
|
173
|
+
|
|
174
|
+
protected disposeAllButGhostElement(): void {
|
|
175
|
+
this.cursorFeedback.dispose();
|
|
176
|
+
super.dispose();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
override dispose(): void {
|
|
180
|
+
this.ghostElementFeedback.dispose();
|
|
181
|
+
this.disposeAllButGhostElement();
|
|
182
|
+
}
|
|
139
183
|
}
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import {
|
|
17
17
|
Action,
|
|
18
|
-
BoundsAware,
|
|
19
18
|
CenterAction,
|
|
20
19
|
GIssueSeverity,
|
|
21
20
|
GModelElement,
|
|
@@ -26,7 +25,6 @@ import {
|
|
|
26
25
|
MenuItem,
|
|
27
26
|
Point,
|
|
28
27
|
SelectAction,
|
|
29
|
-
Selectable,
|
|
30
28
|
TYPES,
|
|
31
29
|
findParentByFeature,
|
|
32
30
|
hasArrayProp,
|
|
@@ -38,7 +36,7 @@ import {
|
|
|
38
36
|
import { inject, injectable } from 'inversify';
|
|
39
37
|
import { GLSPActionDispatcher } from '../../base/action-dispatcher';
|
|
40
38
|
import { SelectionService } from '../../base/selection-service';
|
|
41
|
-
import { getElements, isSelectableAndBoundsAware } from '../../utils/gmodel-util';
|
|
39
|
+
import { BoundsAwareModelElement, SelectableElement, getElements, isSelectableAndBoundsAware } from '../../utils/gmodel-util';
|
|
42
40
|
import { MarkerPredicates, collectIssueMarkers } from '../../utils/marker';
|
|
43
41
|
import { GIssueMarker } from './issue-marker';
|
|
44
42
|
|
|
@@ -110,7 +108,7 @@ export class MarkerNavigator {
|
|
|
110
108
|
|
|
111
109
|
next(
|
|
112
110
|
root: Readonly<GModelRoot>,
|
|
113
|
-
current?:
|
|
111
|
+
current?: BoundsAwareModelElement,
|
|
114
112
|
predicate: (marker: GIssueMarker) => boolean = MarkerPredicates.ALL
|
|
115
113
|
): GIssueMarker | undefined {
|
|
116
114
|
const markers = this.getMarkers(root, predicate);
|
|
@@ -122,7 +120,7 @@ export class MarkerNavigator {
|
|
|
122
120
|
|
|
123
121
|
previous(
|
|
124
122
|
root: Readonly<GModelRoot>,
|
|
125
|
-
current?:
|
|
123
|
+
current?: BoundsAwareModelElement,
|
|
126
124
|
predicate: (marker: GIssueMarker) => boolean = MarkerPredicates.ALL
|
|
127
125
|
): GIssueMarker | undefined {
|
|
128
126
|
const markers = this.getMarkers(root, predicate);
|
|
@@ -137,7 +135,7 @@ export class MarkerNavigator {
|
|
|
137
135
|
return markers.filter(predicate).sort(this.markerComparator.compare);
|
|
138
136
|
}
|
|
139
137
|
|
|
140
|
-
protected getNextIndex(current:
|
|
138
|
+
protected getNextIndex(current: BoundsAwareModelElement, markers: GIssueMarker[]): number {
|
|
141
139
|
for (let index = 0; index < markers.length; index++) {
|
|
142
140
|
if (this.markerComparator.compare(markers[index], current) > 0) {
|
|
143
141
|
return index;
|
|
@@ -146,7 +144,7 @@ export class MarkerNavigator {
|
|
|
146
144
|
return 0;
|
|
147
145
|
}
|
|
148
146
|
|
|
149
|
-
protected getPreviousIndex(current:
|
|
147
|
+
protected getPreviousIndex(current: BoundsAwareModelElement, markers: GIssueMarker[]): number {
|
|
150
148
|
for (let index = markers.length - 1; index >= 0; index--) {
|
|
151
149
|
if (this.markerComparator.compare(markers[index], current) < 0) {
|
|
152
150
|
return index;
|
|
@@ -182,7 +180,7 @@ export class NavigateToMarkerActionHandler implements IActionHandler {
|
|
|
182
180
|
}
|
|
183
181
|
}
|
|
184
182
|
|
|
185
|
-
protected getSelectedElements(action: NavigateToMarkerAction):
|
|
183
|
+
protected getSelectedElements(action: NavigateToMarkerAction): SelectableElement[] {
|
|
186
184
|
if (action.selectedElementIds && action.selectedElementIds.length > 0) {
|
|
187
185
|
return getElements(this.selectionService.getModelRoot().index, action.selectedElementIds, isSelectable);
|
|
188
186
|
}
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
hasArrayProp
|
|
29
29
|
} from '@eclipse-glsp/sprotty';
|
|
30
30
|
import { inject, injectable, optional } from 'inversify';
|
|
31
|
+
import { FeedbackEmitter } from '../../base';
|
|
31
32
|
import { EditorContextService } from '../../base/editor-context-service';
|
|
32
33
|
import { IFeedbackActionDispatcher, IFeedbackEmitter } from '../../base/feedback/feedback-action-dispatcher';
|
|
33
34
|
import { FeedbackCommand } from '../../base/feedback/feedback-command';
|
|
@@ -42,7 +43,7 @@ import { GIssueMarker, createGIssue, getGIssueMarker, getOrCreateGIssueMarker, g
|
|
|
42
43
|
export class ValidationFeedbackEmitter implements IFeedbackEmitter {
|
|
43
44
|
@inject(TYPES.IFeedbackActionDispatcher) protected feedbackActionDispatcher: IFeedbackActionDispatcher;
|
|
44
45
|
|
|
45
|
-
protected registeredFeedbackByReason: Map<string,
|
|
46
|
+
protected registeredFeedbackByReason: Map<string, FeedbackEmitter> = new Map();
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
49
|
* Register the action that should be emitted for visualizing validation feedback.
|
|
@@ -51,25 +52,9 @@ export class ValidationFeedbackEmitter implements IFeedbackEmitter {
|
|
|
51
52
|
*/
|
|
52
53
|
registerValidationFeedbackAction(action: ApplyMarkersAction, reason = ''): void {
|
|
53
54
|
// De-register feedback and clear existing markers with the same reason
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
emitter = previousFeedbackWithSameReason.emitter;
|
|
58
|
-
const deleteMarkersAction = DeleteMarkersAction.create(previousFeedbackWithSameReason.action.markers);
|
|
59
|
-
this.feedbackActionDispatcher.deregisterFeedback(emitter, [deleteMarkersAction]);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (!emitter) {
|
|
63
|
-
emitter = this.createEmitter(reason);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Register new action responsible for applying markers and re-applying them when the model is updated
|
|
67
|
-
this.registeredFeedbackByReason.set(reason, { action, emitter });
|
|
68
|
-
this.feedbackActionDispatcher.registerFeedback(emitter, [action]);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
protected createEmitter(reason: string): IFeedbackEmitter {
|
|
72
|
-
return { id: 'validationFeedbackEmitter_' + reason };
|
|
55
|
+
const emitter = this.registeredFeedbackByReason.get(reason)?.dispose() ?? this.feedbackActionDispatcher.createEmitter();
|
|
56
|
+
emitter.add(action, () => DeleteMarkersAction.create(action.markers)).submit();
|
|
57
|
+
this.registeredFeedbackByReason.set(reason, emitter);
|
|
73
58
|
}
|
|
74
59
|
}
|
|
75
60
|
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { inject, injectable } from 'inversify';
|
|
18
17
|
import {
|
|
19
18
|
Action,
|
|
20
19
|
Bounds,
|
|
@@ -23,14 +22,16 @@ import {
|
|
|
23
22
|
GChildElement,
|
|
24
23
|
GModelElement,
|
|
25
24
|
GModelRoot,
|
|
25
|
+
Point,
|
|
26
26
|
TYPES,
|
|
27
27
|
Viewport,
|
|
28
28
|
getRouteBounds,
|
|
29
29
|
hasArrayProp,
|
|
30
30
|
isViewport
|
|
31
31
|
} from '@eclipse-glsp/sprotty';
|
|
32
|
-
import {
|
|
32
|
+
import { inject, injectable } from 'inversify';
|
|
33
33
|
import { GEdge } from '../../model';
|
|
34
|
+
import { calcElementAndRoute } from '../../utils/gmodel-util';
|
|
34
35
|
|
|
35
36
|
export interface RepositionAction extends Action {
|
|
36
37
|
kind: typeof RepositionAction.KIND;
|
|
@@ -83,25 +84,21 @@ export class RepositionCommand extends BoundsAwareViewportCommand {
|
|
|
83
84
|
return this.action.elementIDs;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
getNewViewport(
|
|
87
|
+
getNewViewport(combinedElementBounds: Bounds, model: GModelRoot): Viewport | undefined {
|
|
87
88
|
if (!Dimension.isValid(model.canvasBounds)) {
|
|
88
89
|
return undefined;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
if (isViewport(model)) {
|
|
92
|
-
|
|
93
|
-
const c = Bounds.center(bounds);
|
|
94
|
-
|
|
95
|
-
if (this.isFullyVisible(bounds, model)) {
|
|
93
|
+
if (this.isFullyVisible(combinedElementBounds, model)) {
|
|
96
94
|
return undefined;
|
|
97
95
|
} else {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
};
|
|
96
|
+
const zoom = model.zoom;
|
|
97
|
+
const centerOfElements = Bounds.center(combinedElementBounds);
|
|
98
|
+
const canvasCenter = Dimension.center(model.canvasBounds);
|
|
99
|
+
const scrollCenter = Point.subtract(centerOfElements, canvasCenter);
|
|
100
|
+
const scroll = Point.map(scrollCenter, coordinate => coordinate / zoom);
|
|
101
|
+
return { scroll, zoom };
|
|
105
102
|
}
|
|
106
103
|
}
|
|
107
104
|
|
|
@@ -14,88 +14,69 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { Bounds
|
|
17
|
+
import { Bounds } from '@eclipse-glsp/sprotty';
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
19
|
+
/** @deprecated Use {@link Bounds.left} */
|
|
20
|
+
export const left = Bounds.left;
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
22
|
+
/** @deprecated Use {@link Bounds.centerX} */
|
|
23
|
+
export const center = Bounds.center;
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
25
|
+
/** @deprecated Use {@link Bounds.right} */
|
|
26
|
+
export const right = Bounds.right;
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
28
|
+
/** @deprecated Use {@link Bounds.top} */
|
|
29
|
+
export const top = Bounds.top;
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
31
|
+
/** @deprecated Use {@link Bounds.middle} */
|
|
32
|
+
export const middle = Bounds.middle;
|
|
38
33
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
34
|
+
/** @deprecated Use {@link Bounds.bottom} */
|
|
35
|
+
export const bottom = Bounds.bottom;
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
37
|
+
/** @deprecated Use {@link Bounds.topLeft} */
|
|
38
|
+
export const topLeft = Bounds.topLeft;
|
|
46
39
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
40
|
+
/** @deprecated Use {@link Bounds.topCenter} */
|
|
41
|
+
export const topCenter = Bounds.topCenter;
|
|
50
42
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
43
|
+
/** @deprecated Use {@link Bounds.topRight} */
|
|
44
|
+
export const topRight = Bounds.topRight;
|
|
54
45
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
46
|
+
/** @deprecated Use {@link Bounds.middleLeft} */
|
|
47
|
+
export const middleLeft = Bounds.middleLeft;
|
|
58
48
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
49
|
+
/** @deprecated Use {@link Bounds.middleCenter} */
|
|
50
|
+
export const middleCenter = Bounds.middleCenter;
|
|
62
51
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
52
|
+
/** @deprecated Use {@link Bounds.middleRight} */
|
|
53
|
+
export const middleRight = Bounds.middleRight;
|
|
66
54
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
55
|
+
/** @deprecated Use {@link Bounds.bottomLeft} */
|
|
56
|
+
export const bottomLeft = Bounds.bottomLeft;
|
|
70
57
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
58
|
+
/** @deprecated Use {@link Bounds.bottomCenter} */
|
|
59
|
+
export const bottomCenter = Bounds.bottomCenter;
|
|
74
60
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
61
|
+
/** @deprecated Use {@link Bounds.bottomRight} */
|
|
62
|
+
export const bottomRight = Bounds.bottomRight;
|
|
78
63
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
64
|
+
/** @deprecated Use {@link Bounds.left} */
|
|
65
|
+
export const sortBy = Bounds.sortBy;
|
|
82
66
|
|
|
83
|
-
export
|
|
84
|
-
|
|
85
|
-
|
|
67
|
+
export const compareFunction =
|
|
68
|
+
<T>(rankFunc: (elem: T) => number): ((x: T, y: T) => number) =>
|
|
69
|
+
(x, y) =>
|
|
70
|
+
rankFunc(x) - rankFunc(y);
|
|
86
71
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
72
|
+
/** @deprecated Use {@link Bounds.isAbove} */
|
|
73
|
+
export const isAbove = Bounds.isAbove;
|
|
90
74
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
75
|
+
/** @deprecated Use {@link Bounds.isBelow} */
|
|
76
|
+
export const isBelow = Bounds.isBelow;
|
|
94
77
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
78
|
+
/** @deprecated Use {@link Bounds.isBefore} */
|
|
79
|
+
export const isBefore = Bounds.isBefore;
|
|
98
80
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
81
|
+
/** @deprecated Use {@link Bounds.isAfter} */
|
|
82
|
+
export const isAfter = Bounds.isAfter;
|
package/src/utils/gmodel-util.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
GParentElement,
|
|
26
26
|
GRoutableElement,
|
|
27
27
|
GRoutingHandle,
|
|
28
|
+
Locateable,
|
|
28
29
|
ModelIndexImpl,
|
|
29
30
|
Point,
|
|
30
31
|
RoutedPoint,
|
|
@@ -194,17 +195,30 @@ export function isRoutingHandle(element: GModelElement | undefined): element is
|
|
|
194
195
|
export function isSelectableAndBoundsAware(element: GModelElement): element is SelectableBoundsAware {
|
|
195
196
|
return isSelectable(element) && isBoundsAware(element);
|
|
196
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Union type to describe {@link GModelElement}s that implement the {@link Selectable} feature.
|
|
200
|
+
*/
|
|
201
|
+
export type SelectableElement = GModelElement & Selectable;
|
|
197
202
|
|
|
198
203
|
/**
|
|
199
204
|
* Union type to describe {@link GModelElement}s that implement the {@link Selectable} and {@link BoundsAware} feature.
|
|
200
205
|
*/
|
|
201
|
-
export type SelectableBoundsAware =
|
|
206
|
+
export type SelectableBoundsAware = SelectableElement & BoundsAware;
|
|
202
207
|
|
|
203
208
|
/**
|
|
204
209
|
* Union type to describe {@link GModelElement}s that implement the {@link BoundsAware} feature.
|
|
205
210
|
*/
|
|
206
211
|
export type BoundsAwareModelElement = GModelElement & BoundsAware;
|
|
207
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Union type to describe {@link GModelElement}s that implement the {@link Locateable} feature.
|
|
215
|
+
*/
|
|
216
|
+
export type MoveableElement = GModelElement & Locateable;
|
|
217
|
+
|
|
218
|
+
export interface Resizable extends BoundsAware, Selectable {}
|
|
219
|
+
|
|
220
|
+
export interface ResizableModelElement extends GParentElement, Resizable {}
|
|
221
|
+
|
|
208
222
|
/**
|
|
209
223
|
* Helper function to translate a given {@link GModelElement} into its corresponding {@link ElementAndBounds} representation.
|
|
210
224
|
* @param element The element to translate.
|
|
@@ -347,7 +361,7 @@ export function findTopLevelElementByFeature<T>(
|
|
|
347
361
|
export function calculateDeltaBetweenPoints(target: Point, source: Point, element: GModelElement): Point {
|
|
348
362
|
const delta = Point.subtract(target, source);
|
|
349
363
|
const zoom = getZoom(element);
|
|
350
|
-
const adaptedDelta =
|
|
364
|
+
const adaptedDelta = Point.divideScalar(delta, zoom);
|
|
351
365
|
return adaptedDelta;
|
|
352
366
|
}
|
|
353
367
|
|
|
@@ -373,3 +387,32 @@ export function getDescendantIds(element?: GModelElement, skip?: (t: GModelEleme
|
|
|
373
387
|
}
|
|
374
388
|
return ids;
|
|
375
389
|
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Returns a filter function that checks if the given element is not a descendant of any of the given elements.
|
|
393
|
+
*
|
|
394
|
+
* @param elements The elements that the element should not be a descendant of.
|
|
395
|
+
* @returns the filter function
|
|
396
|
+
*/
|
|
397
|
+
export function isNotDescendantOfAnyElement<T extends GModelElement>(elements: FluentIterable<T>): (element: T) => boolean {
|
|
398
|
+
const elementsSet = new Set<GModelElement>(elements);
|
|
399
|
+
return (element: T): boolean => {
|
|
400
|
+
let parent: GModelElement = element;
|
|
401
|
+
while (parent instanceof GChildElement) {
|
|
402
|
+
parent = parent.parent;
|
|
403
|
+
if (elementsSet.has(parent)) {
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return true;
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Removes any descendants of the given elements from the given elements.
|
|
413
|
+
* @param elements The elements to filter.
|
|
414
|
+
* @returns the filtered elements
|
|
415
|
+
*/
|
|
416
|
+
export function removeDescendants<T extends GModelElement>(elements: FluentIterable<T>): FluentIterable<T> {
|
|
417
|
+
return elements.filter(isNotDescendantOfAnyElement(elements));
|
|
418
|
+
}
|
|
@@ -13,19 +13,11 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
17
|
-
BoundsAware,
|
|
18
|
-
Dimension,
|
|
19
|
-
ElementAndBounds,
|
|
20
|
-
ElementMove,
|
|
21
|
-
ModelLayoutOptions,
|
|
22
|
-
Point,
|
|
23
|
-
GModelElement,
|
|
24
|
-
Writable
|
|
25
|
-
} from '@eclipse-glsp/sprotty';
|
|
16
|
+
import { Dimension, ElementAndBounds, ElementMove, GModelElement, ModelLayoutOptions, Point, Writable } from '@eclipse-glsp/sprotty';
|
|
26
17
|
import { IMovementRestrictor } from '../features/change-bounds/movement-restrictor';
|
|
18
|
+
import { BoundsAwareModelElement } from './gmodel-util';
|
|
27
19
|
|
|
28
|
-
export function minWidth(element:
|
|
20
|
+
export function minWidth(element: BoundsAwareModelElement): number {
|
|
29
21
|
const layoutOptions = getLayoutOptions(element);
|
|
30
22
|
if (layoutOptions !== undefined && typeof layoutOptions.minWidth === 'number') {
|
|
31
23
|
return layoutOptions.minWidth;
|
|
@@ -33,7 +25,7 @@ export function minWidth(element: GModelElement & BoundsAware): number {
|
|
|
33
25
|
return 1;
|
|
34
26
|
}
|
|
35
27
|
|
|
36
|
-
export function minHeight(element:
|
|
28
|
+
export function minHeight(element: BoundsAwareModelElement): number {
|
|
37
29
|
const layoutOptions = getLayoutOptions(element);
|
|
38
30
|
if (layoutOptions !== undefined && typeof layoutOptions.minHeight === 'number') {
|
|
39
31
|
return layoutOptions.minHeight;
|
|
@@ -49,19 +41,16 @@ export function getLayoutOptions(element: GModelElement): ModelLayoutOptions | u
|
|
|
49
41
|
return undefined;
|
|
50
42
|
}
|
|
51
43
|
|
|
52
|
-
export function isValidSize(element:
|
|
44
|
+
export function isValidSize(element: BoundsAwareModelElement, size: Dimension): boolean {
|
|
53
45
|
return size.width >= minWidth(element) && size.height >= minHeight(element);
|
|
54
46
|
}
|
|
55
47
|
|
|
56
|
-
export function isValidMove(element: GModelElement
|
|
57
|
-
|
|
58
|
-
return movementRestrictor.validate(element, newPosition);
|
|
59
|
-
}
|
|
60
|
-
return true;
|
|
48
|
+
export function isValidMove(element: GModelElement, newPosition?: Point, movementRestrictor?: IMovementRestrictor): boolean {
|
|
49
|
+
return movementRestrictor?.validate(element, newPosition) ?? true;
|
|
61
50
|
}
|
|
62
51
|
|
|
63
52
|
export function toValidElementMove(
|
|
64
|
-
element:
|
|
53
|
+
element: BoundsAwareModelElement,
|
|
65
54
|
move: ElementMove,
|
|
66
55
|
movementRestrictor?: IMovementRestrictor
|
|
67
56
|
): ElementMove | undefined {
|
|
@@ -72,7 +61,7 @@ export function toValidElementMove(
|
|
|
72
61
|
}
|
|
73
62
|
|
|
74
63
|
export function toValidElementAndBounds(
|
|
75
|
-
element:
|
|
64
|
+
element: BoundsAwareModelElement,
|
|
76
65
|
bounds: Writable<ElementAndBounds>,
|
|
77
66
|
movementRestrictor?: IMovementRestrictor
|
|
78
67
|
): ElementAndBounds | undefined {
|