@eclipse-glsp/client 2.2.0-next.328 → 2.2.0-next.329

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/lib/base/action-dispatcher.js.map +1 -1
  2. package/lib/base/action-handler-registry.js.map +1 -1
  3. package/lib/base/args-feature.js.map +1 -1
  4. package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
  5. package/lib/base/auto-complete/validation-decorator.js.map +1 -1
  6. package/lib/base/command-stack.js.map +1 -1
  7. package/lib/base/drag-aware-mouse-listener.js.map +1 -1
  8. package/lib/base/editor-context-service.js.map +1 -1
  9. package/lib/base/feedback/css-feedback.js.map +1 -1
  10. package/lib/base/feedback/feedback-action-dispatcher.js.map +1 -1
  11. package/lib/base/focus/focus-tracker.js.map +1 -1
  12. package/lib/base/model/diagram-loader.js.map +1 -1
  13. package/lib/base/model/glsp-model-source.js.map +1 -1
  14. package/lib/base/model/model-initialization-constraint.js.map +1 -1
  15. package/lib/base/model/model-registry.js.map +1 -1
  16. package/lib/base/selection-clearing-mouse-listener.js.map +1 -1
  17. package/lib/base/selection-service.js.map +1 -1
  18. package/lib/base/tool-manager/index.d.ts +2 -2
  19. package/lib/base/tool-manager/index.d.ts.map +1 -1
  20. package/lib/base/tool-manager/index.js +2 -2
  21. package/lib/base/tool-manager/index.js.map +1 -1
  22. package/lib/base/tool-manager/tool-manager.js.map +1 -1
  23. package/lib/base/view/mouse-tool.js.map +1 -1
  24. package/lib/base/view/view-registry.js.map +1 -1
  25. package/lib/default-modules.d.ts +1 -1
  26. package/lib/default-modules.js +1 -1
  27. package/lib/default-modules.js.map +1 -1
  28. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-palette.js.map +1 -1
  29. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-tool.js.map +1 -1
  30. package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js.map +1 -1
  31. package/lib/features/accessibility/element-navigation/left-right-top-bottom-navigator.js.map +1 -1
  32. package/lib/features/accessibility/element-navigation/local-element-navigator.js.map +1 -1
  33. package/lib/features/accessibility/element-navigation/position-navigator.js.map +1 -1
  34. package/lib/features/accessibility/focus-tracker/focus-tracker-tool.js.map +1 -1
  35. package/lib/features/accessibility/global-keylistener-tool.js.map +1 -1
  36. package/lib/features/accessibility/key-shortcut/accessible-key-shortcut-tool.js.map +1 -1
  37. package/lib/features/accessibility/key-shortcut/accessible-key-shortcut.js.map +1 -1
  38. package/lib/features/accessibility/key-shortcut/index.d.ts +2 -2
  39. package/lib/features/accessibility/key-shortcut/index.d.ts.map +1 -1
  40. package/lib/features/accessibility/key-shortcut/index.js +2 -2
  41. package/lib/features/accessibility/key-shortcut/index.js.map +1 -1
  42. package/lib/features/accessibility/keyboard-grid/index.d.ts +2 -2
  43. package/lib/features/accessibility/keyboard-grid/index.d.ts.map +1 -1
  44. package/lib/features/accessibility/keyboard-grid/index.js +2 -2
  45. package/lib/features/accessibility/keyboard-grid/index.js.map +1 -1
  46. package/lib/features/accessibility/keyboard-grid/keyboard-grid.js.map +1 -1
  47. package/lib/features/accessibility/keyboard-grid/keyboard-node-grid.js.map +1 -1
  48. package/lib/features/accessibility/keyboard-pointer/index.d.ts +2 -2
  49. package/lib/features/accessibility/keyboard-pointer/index.d.ts.map +1 -1
  50. package/lib/features/accessibility/keyboard-pointer/index.js +2 -2
  51. package/lib/features/accessibility/keyboard-pointer/index.js.map +1 -1
  52. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer-listener.d.ts +1 -1
  53. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer-listener.d.ts.map +1 -1
  54. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer-listener.js +1 -1
  55. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer-listener.js.map +1 -1
  56. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.js.map +1 -1
  57. package/lib/features/accessibility/keyboard-tool-palette/index.d.ts +2 -2
  58. package/lib/features/accessibility/keyboard-tool-palette/index.d.ts.map +1 -1
  59. package/lib/features/accessibility/keyboard-tool-palette/index.js +2 -2
  60. package/lib/features/accessibility/keyboard-tool-palette/index.js.map +1 -1
  61. package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.js.map +1 -1
  62. package/lib/features/accessibility/move-zoom/move-handler.js.map +1 -1
  63. package/lib/features/accessibility/move-zoom/zoom-handler.js.map +1 -1
  64. package/lib/features/accessibility/resize-key-tool/resize-key-handler.js.map +1 -1
  65. package/lib/features/accessibility/resize-key-tool/resize-key-tool.js.map +1 -1
  66. package/lib/features/accessibility/search/index.d.ts +2 -2
  67. package/lib/features/accessibility/search/index.d.ts.map +1 -1
  68. package/lib/features/accessibility/search/index.js +2 -2
  69. package/lib/features/accessibility/search/index.js.map +1 -1
  70. package/lib/features/accessibility/search/search-palette.js.map +1 -1
  71. package/lib/features/accessibility/search/search-tool.js.map +1 -1
  72. package/lib/features/accessibility/toast/toast-tool.js.map +1 -1
  73. package/lib/features/accessibility/view-key-tools/deselect-key-tool.js.map +1 -1
  74. package/lib/features/accessibility/view-key-tools/movement-key-tool.js.map +1 -1
  75. package/lib/features/accessibility/view-key-tools/zoom-key-tool.js.map +1 -1
  76. package/lib/features/bounds/freeform-layout.js.map +1 -1
  77. package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -1
  78. package/lib/features/bounds/hbox-layout.js.map +1 -1
  79. package/lib/features/bounds/layouter.js.map +1 -1
  80. package/lib/features/bounds/local-bounds.js.map +1 -1
  81. package/lib/features/bounds/set-bounds-feedback-command.js.map +1 -1
  82. package/lib/features/bounds/vbox-layout.js.map +1 -1
  83. package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
  84. package/lib/features/change-bounds/point-position-updater.js.map +1 -1
  85. package/lib/features/change-bounds/position-snapper.js.map +1 -1
  86. package/lib/features/command-palette/command-palette-module.d.ts +1 -1
  87. package/lib/features/command-palette/command-palette-module.js +1 -1
  88. package/lib/features/command-palette/command-palette.js.map +1 -1
  89. package/lib/features/command-palette/index.d.ts +1 -1
  90. package/lib/features/command-palette/index.js +1 -1
  91. package/lib/features/command-palette/server-command-palette-provider.js.map +1 -1
  92. package/lib/features/context-menu/context-menu-module.js.map +1 -1
  93. package/lib/features/context-menu/glsp-context-menu-mouse-listener.js.map +1 -1
  94. package/lib/features/context-menu/server-context-menu-provider.js.map +1 -1
  95. package/lib/features/copy-paste/copy-paste-context-menu.js.map +1 -1
  96. package/lib/features/copy-paste/copy-paste-handler.js.map +1 -1
  97. package/lib/features/copy-paste/copy-paste-standalone.js.map +1 -1
  98. package/lib/features/decoration/decoration-placer.js.map +1 -1
  99. package/lib/features/element-template/add-template-element.js.map +1 -1
  100. package/lib/features/element-template/mouse-tracking-element-position-listener.js.map +1 -1
  101. package/lib/features/element-template/remove-template-element.js.map +1 -1
  102. package/lib/features/export/glsp-svg-exporter.js.map +1 -1
  103. package/lib/features/helper-lines/helper-line-feedback.js.map +1 -1
  104. package/lib/features/helper-lines/helper-line-manager-default.js.map +1 -1
  105. package/lib/features/helper-lines/index.d.ts +2 -2
  106. package/lib/features/helper-lines/index.d.ts.map +1 -1
  107. package/lib/features/helper-lines/index.js +2 -2
  108. package/lib/features/helper-lines/index.js.map +1 -1
  109. package/lib/features/helper-lines/model.js.map +1 -1
  110. package/lib/features/helper-lines/view.js.map +1 -1
  111. package/lib/features/hints/type-hint-provider.js.map +1 -1
  112. package/lib/features/hover/hover.js.map +1 -1
  113. package/lib/features/hover/index.d.ts +2 -2
  114. package/lib/features/hover/index.d.ts.map +1 -1
  115. package/lib/features/hover/index.js +2 -2
  116. package/lib/features/hover/index.js.map +1 -1
  117. package/lib/features/index.d.ts +2 -1
  118. package/lib/features/index.d.ts.map +1 -1
  119. package/lib/features/index.js +2 -1
  120. package/lib/features/index.js.map +1 -1
  121. package/lib/features/label-edit/edit-label-validator.js.map +1 -1
  122. package/lib/features/label-edit-ui/label-edit-ui.js.map +1 -1
  123. package/lib/features/layout/layout-elements-action.js.map +1 -1
  124. package/lib/features/navigation/navigation-action-handler.js.map +1 -1
  125. package/lib/features/navigation/navigation-target-resolver.js.map +1 -1
  126. package/lib/features/reconnect/model.js.map +1 -1
  127. package/lib/features/routing/glsp-manhattan-edge-router.js.map +1 -1
  128. package/lib/features/save/save-keylistener.js.map +1 -1
  129. package/lib/features/source-model-watcher/source-model-changed-action-handler.js.map +1 -1
  130. package/lib/features/status/status-overlay.js.map +1 -1
  131. package/lib/features/svg-metadata/metadata-placer.js.map +1 -1
  132. package/lib/features/tool-palette/index.d.ts +2 -2
  133. package/lib/features/tool-palette/index.d.ts.map +1 -1
  134. package/lib/features/tool-palette/index.js +2 -2
  135. package/lib/features/tool-palette/index.js.map +1 -1
  136. package/lib/features/tool-palette/tool-palette.js.map +1 -1
  137. package/lib/features/tools/base-tools.js.map +1 -1
  138. package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js.map +1 -1
  139. package/lib/features/tools/change-bounds/change-bounds-tool.js.map +1 -1
  140. package/lib/features/tools/change-bounds/index.d.ts +2 -2
  141. package/lib/features/tools/change-bounds/index.d.ts.map +1 -1
  142. package/lib/features/tools/change-bounds/index.js +2 -2
  143. package/lib/features/tools/change-bounds/index.js.map +1 -1
  144. package/lib/features/tools/change-bounds/view.js.map +1 -1
  145. package/lib/features/tools/deletion/delete-tool.js.map +1 -1
  146. package/lib/features/tools/edge-creation/dangling-edge-feedback.js.map +1 -1
  147. package/lib/features/tools/edge-creation/edge-creation-tool-feedback.d.ts +1 -1
  148. package/lib/features/tools/edge-creation/edge-creation-tool-feedback.d.ts.map +1 -1
  149. package/lib/features/tools/edge-creation/edge-creation-tool-feedback.js +1 -1
  150. package/lib/features/tools/edge-creation/edge-creation-tool-feedback.js.map +1 -1
  151. package/lib/features/tools/edge-creation/edge-creation-tool.js.map +1 -1
  152. package/lib/features/tools/edge-creation/index.d.ts +2 -2
  153. package/lib/features/tools/edge-creation/index.d.ts.map +1 -1
  154. package/lib/features/tools/edge-creation/index.js +2 -2
  155. package/lib/features/tools/edge-creation/index.js.map +1 -1
  156. package/lib/features/tools/edge-edit/edge-edit-tool-feedback.js.map +1 -1
  157. package/lib/features/tools/edge-edit/edge-edit-tool.js.map +1 -1
  158. package/lib/features/tools/edge-edit/index.d.ts +2 -2
  159. package/lib/features/tools/edge-edit/index.d.ts.map +1 -1
  160. package/lib/features/tools/edge-edit/index.js +2 -2
  161. package/lib/features/tools/edge-edit/index.js.map +1 -1
  162. package/lib/features/tools/marquee-selection/index.d.ts +2 -2
  163. package/lib/features/tools/marquee-selection/index.d.ts.map +1 -1
  164. package/lib/features/tools/marquee-selection/index.js +2 -2
  165. package/lib/features/tools/marquee-selection/index.js.map +1 -1
  166. package/lib/features/tools/marquee-selection/marquee-behavior.js.map +1 -1
  167. package/lib/features/tools/marquee-selection/marquee-mouse-tool.js.map +1 -1
  168. package/lib/features/tools/marquee-selection/marquee-tool-feedback.js.map +1 -1
  169. package/lib/features/tools/marquee-selection/marquee-tool.js.map +1 -1
  170. package/lib/features/tools/node-creation/node-creation-tool.js.map +1 -1
  171. package/lib/features/tools/tool-focus-loss-module.js.map +1 -1
  172. package/lib/features/undo-redo/undo-redo-key-listener.js.map +1 -1
  173. package/lib/features/validation/issue-marker.js.map +1 -1
  174. package/lib/features/validation/marker-navigator.js.map +1 -1
  175. package/lib/features/validation/validate.js.map +1 -1
  176. package/lib/features/viewport/glsp-scroll-mouse-listener.js.map +1 -1
  177. package/lib/features/viewport/reposition.js.map +1 -1
  178. package/lib/features/viewport/viewport-handler.js.map +1 -1
  179. package/lib/model.js.map +1 -1
  180. package/lib/standalone-modules.js.map +1 -1
  181. package/lib/utils/argument-utils.js.map +1 -1
  182. package/lib/utils/geometry-util.d.ts +1 -1
  183. package/lib/utils/geometry-util.d.ts.map +1 -1
  184. package/lib/utils/gmodel-util.js.map +1 -1
  185. package/lib/utils/html-utils.js.map +1 -1
  186. package/lib/utils/layout-utils.js.map +1 -1
  187. package/lib/utils/marker.js.map +1 -1
  188. package/lib/utils/viewpoint-util.js.map +1 -1
  189. package/lib/views/compartments.js.map +1 -1
  190. package/lib/views/gedge-view.js.map +1 -1
  191. package/lib/views/glsp-projection-view.js.map +1 -1
  192. package/lib/views/index.d.ts +2 -2
  193. package/lib/views/index.d.ts.map +1 -1
  194. package/lib/views/index.js +2 -2
  195. package/lib/views/index.js.map +1 -1
  196. package/lib/views/issue-marker-view.js.map +1 -1
  197. package/lib/views/rounded-corner-view.js.map +1 -1
  198. package/lib/views/rounded-corner.d.ts +1 -1
  199. package/lib/views/rounded-corner.d.ts.map +1 -1
  200. package/lib/views/rounded-corner.js.map +1 -1
  201. package/package.json +3 -3
  202. package/src/features/accessibility/move-zoom/move-handler.ts +1 -1
  203. package/src/features/change-bounds/movement-restrictor.ts +2 -19
  204. package/src/features/element-template/mouse-tracking-element-position-listener.ts +13 -3
  205. package/src/features/helper-lines/helper-line-feedback.ts +50 -57
  206. package/src/features/helper-lines/model.ts +6 -25
  207. package/src/features/layout/layout-elements-action.ts +10 -7
  208. package/src/features/viewport/reposition.ts +11 -14
  209. package/src/utils/geometry-util.ts +45 -64
  210. package/src/utils/gmodel-util.ts +1 -1
  211. package/src/utils/viewpoint-util.ts +10 -21
  212. package/lib/base/action-dispatcher.spec.d.ts +0 -2
  213. package/lib/base/action-dispatcher.spec.d.ts.map +0 -1
  214. package/lib/base/action-dispatcher.spec.js +0 -78
  215. package/lib/base/action-dispatcher.spec.js.map +0 -1
  216. package/lib/base/model/model-initialization-constraint.spec.d.ts +0 -2
  217. package/lib/base/model/model-initialization-constraint.spec.d.ts.map +0 -1
  218. package/lib/base/model/model-initialization-constraint.spec.js +0 -97
  219. package/lib/base/model/model-initialization-constraint.spec.js.map +0 -1
  220. package/lib/base/selection-service.spec.d.ts +0 -2
  221. package/lib/base/selection-service.spec.d.ts.map +0 -1
  222. package/lib/base/selection-service.spec.js +0 -287
  223. package/lib/base/selection-service.spec.js.map +0 -1
  224. package/lib/features/bounds/freeform-layout.spec.d.ts +0 -3
  225. package/lib/features/bounds/freeform-layout.spec.d.ts.map +0 -1
  226. package/lib/features/bounds/freeform-layout.spec.js +0 -201
  227. package/lib/features/bounds/freeform-layout.spec.js.map +0 -1
  228. package/lib/features/bounds/hbox-layout.spec.d.ts +0 -3
  229. package/lib/features/bounds/hbox-layout.spec.d.ts.map +0 -1
  230. package/lib/features/bounds/hbox-layout.spec.js +0 -160
  231. package/lib/features/bounds/hbox-layout.spec.js.map +0 -1
  232. package/lib/features/bounds/layouter-test-util.spec.d.ts +0 -32
  233. package/lib/features/bounds/layouter-test-util.spec.d.ts.map +0 -1
  234. package/lib/features/bounds/layouter-test-util.spec.js +0 -96
  235. package/lib/features/bounds/layouter-test-util.spec.js.map +0 -1
  236. package/lib/features/bounds/vbox-layout.spec.d.ts +0 -3
  237. package/lib/features/bounds/vbox-layout.spec.d.ts.map +0 -1
  238. package/lib/features/bounds/vbox-layout.spec.js +0 -160
  239. package/lib/features/bounds/vbox-layout.spec.js.map +0 -1
  240. package/lib/features/change-bounds/snap.spec.d.ts +0 -17
  241. package/lib/features/change-bounds/snap.spec.d.ts.map +0 -1
  242. package/lib/features/change-bounds/snap.spec.js +0 -83
  243. package/lib/features/change-bounds/snap.spec.js.map +0 -1
  244. package/lib/features/hints/type-hint-provider.spec.d.ts +0 -2
  245. package/lib/features/hints/type-hint-provider.spec.d.ts.map +0 -1
  246. package/lib/features/hints/type-hint-provider.spec.js +0 -333
  247. package/lib/features/hints/type-hint-provider.spec.js.map +0 -1
  248. package/lib/features/layout/layout-elements-action.spec.d.ts +0 -3
  249. package/lib/features/layout/layout-elements-action.spec.d.ts.map +0 -1
  250. package/lib/features/layout/layout-elements-action.spec.js +0 -329
  251. package/lib/features/layout/layout-elements-action.spec.js.map +0 -1
  252. package/lib/features/navigation/navigation-target-resolver.spec.d.ts +0 -3
  253. package/lib/features/navigation/navigation-target-resolver.spec.d.ts.map +0 -1
  254. package/lib/features/navigation/navigation-target-resolver.spec.js +0 -53
  255. package/lib/features/navigation/navigation-target-resolver.spec.js.map +0 -1
  256. package/lib/features/tools/marquee-selection/marquee-behavior.spec.d.ts +0 -17
  257. package/lib/features/tools/marquee-selection/marquee-behavior.spec.d.ts.map +0 -1
  258. package/lib/features/tools/marquee-selection/marquee-behavior.spec.js +0 -165
  259. package/lib/features/tools/marquee-selection/marquee-behavior.spec.js.map +0 -1
  260. package/lib/features/validation/marker-navigator.spec.d.ts +0 -3
  261. package/lib/features/validation/marker-navigator.spec.d.ts.map +0 -1
  262. package/lib/features/validation/marker-navigator.spec.js +0 -166
  263. package/lib/features/validation/marker-navigator.spec.js.map +0 -1
  264. package/lib/utils/gmodel-util.spec.d.ts +0 -2
  265. package/lib/utils/gmodel-util.spec.d.ts.map +0 -1
  266. package/lib/utils/gmodel-util.spec.js +0 -186
  267. package/lib/utils/gmodel-util.spec.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-glsp/client",
3
- "version": "2.2.0-next.328+c2ca345",
3
+ "version": "2.2.0-next.329+d53e2e2",
4
4
  "description": "A sprotty-based client for GLSP",
5
5
  "keywords": [
6
6
  "eclipse",
@@ -46,7 +46,7 @@
46
46
  "watch": "tsc -w"
47
47
  },
48
48
  "dependencies": {
49
- "@eclipse-glsp/sprotty": "2.2.0-next.328+c2ca345",
49
+ "@eclipse-glsp/sprotty": "2.2.0-next.329+d53e2e2",
50
50
  "autocompleter": "^9.1.0",
51
51
  "file-saver": "^2.0.5",
52
52
  "lodash": "4.17.21"
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "c2ca34551f9d9268eae3be66de23e3782e880af1"
64
+ "gitHead": "d53e2e2ab356951621fb85eea3d0a32541ff9b23"
65
65
  }
@@ -205,7 +205,7 @@ export class MoveElementHandler implements IActionHandler {
205
205
  }
206
206
 
207
207
  protected getTargetBounds(element: SelectableBoundsAware, action: MoveElementAction): Point {
208
- let position = { x: element.bounds.x + action.moveX, y: element.bounds.y + action.moveY };
208
+ let position = Point.add(element.bounds, { x: action.moveX, y: action.moveY });
209
209
  if (this.snapper && action.snap) {
210
210
  position = this.snapper.snap(position, element);
211
211
  }
@@ -13,8 +13,8 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
+ import { Bounds, BoundsAware, GModelElement, GNode, GParentElement, Point } from '@eclipse-glsp/sprotty';
16
17
  import { injectable } from 'inversify';
17
- import { BoundsAware, Point, GModelElement, GNode, GParentElement } from '@eclipse-glsp/sprotty';
18
18
  import { ModifyCSSFeedbackAction } from '../../base/feedback/css-feedback';
19
19
  import { toAbsoluteBounds } from '../../utils/viewpoint-util';
20
20
  import { SResizeHandle, isBoundsAwareMoveable } from './model';
@@ -69,24 +69,7 @@ export class NoOverlapMovementRestrictor implements IMovementRestrictor {
69
69
  }
70
70
 
71
71
  protected areOverlapping(element1: GModelElement & BoundsAware, element2: GModelElement & BoundsAware): boolean {
72
- const b1 = toAbsoluteBounds(element1);
73
- const b2 = toAbsoluteBounds(element2);
74
- const r1TopLeft: Point = b1;
75
- const r1BottomRight = { x: b1.x + b1.width, y: b1.y + b1.height };
76
- const r2TopLeft: Point = b2;
77
- const r2BottomRight = { x: b2.x + b2.width, y: b2.y + b2.height };
78
-
79
- // If one rectangle is on left side of other
80
- if (r1TopLeft.x > r2BottomRight.x || r2TopLeft.x > r1BottomRight.x) {
81
- return false;
82
- }
83
-
84
- // If one rectangle is above other
85
- if (r1BottomRight.y < r2TopLeft.y || r2BottomRight.y < r1TopLeft.y) {
86
- return false;
87
- }
88
-
89
- return true;
72
+ return Bounds.overlap(toAbsoluteBounds(element1), toAbsoluteBounds(element2));
90
73
  }
91
74
  }
92
75
 
@@ -14,7 +14,17 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
- import { Action, Disposable, GModelElement, Locateable, MoveAction, Point, isBoundsAware, isMoveable } from '@eclipse-glsp/sprotty';
17
+ import {
18
+ Action,
19
+ Dimension,
20
+ Disposable,
21
+ GModelElement,
22
+ Locateable,
23
+ MoveAction,
24
+ Point,
25
+ isBoundsAware,
26
+ isMoveable
27
+ } from '@eclipse-glsp/sprotty';
18
28
  import { injectable } from 'inversify';
19
29
  import { DragAwareMouseListener } from '../../base/drag-aware-mouse-listener';
20
30
  import { CSS_HIDDEN, ModifyCSSFeedbackAction } from '../../base/feedback/css-feedback';
@@ -26,8 +36,8 @@ import {
26
36
  createMovementRestrictionFeedback,
27
37
  removeMovementRestrictionFeedback
28
38
  } from '../change-bounds/movement-restrictor';
29
- import { PositionSnapper } from '../change-bounds/position-snapper';
30
39
  import { PointPositionUpdater } from '../change-bounds/point-position-updater';
40
+ import { PositionSnapper } from '../change-bounds/position-snapper';
31
41
  import { useSnap } from '../change-bounds/snap';
32
42
 
33
43
  export interface PositioningTool extends Tool {
@@ -88,7 +98,7 @@ export class MouseTrackingElementPositionListener extends DragAwareMouseListener
88
98
  protected getTargetPosition(target: GModelElement, event: MouseEvent, element: GModelElement & Locateable): Point {
89
99
  let targetPosition = getAbsolutePosition(target, event);
90
100
  if (this.cursorPosition === 'middle' && isBoundsAware(element)) {
91
- targetPosition = Point.subtract(targetPosition, { x: element.bounds.width / 2, y: element.bounds.height / 2 });
101
+ targetPosition = Point.subtract(targetPosition, Dimension.center(element.bounds));
92
102
  }
93
103
  return targetPosition;
94
104
  }
@@ -36,25 +36,6 @@ import { inject, injectable } from 'inversify';
36
36
  import { partition } from 'lodash';
37
37
  import '../../../css/helper-lines.css';
38
38
  import { FeedbackCommand } from '../../base/feedback/feedback-command';
39
- import {
40
- bottom,
41
- bottomCenter,
42
- bottomLeft,
43
- bottomRight,
44
- center,
45
- isAbove,
46
- isBefore,
47
- left,
48
- middle,
49
- middleLeft,
50
- middleRight,
51
- right,
52
- sortBy,
53
- top,
54
- topCenter,
55
- topLeft,
56
- topRight
57
- } from '../../utils/geometry-util';
58
39
  import {
59
40
  BoundsAwareModelElement,
60
41
  findTopLevelElementByFeature,
@@ -191,12 +172,12 @@ export class DrawHelperLinesFeedbackCommand extends FeedbackCommand {
191
172
  const helperLines: HelperLine[] = [];
192
173
  this.log('Find helperlines for viewport:', root);
193
174
  const viewportBounds = getViewportBounds(root, root.canvasBounds);
194
- if (lineTypes.includes(HelperLineType.Center) && this.isAligned(center, viewportBounds, bounds, 2)) {
195
- helperLines.push(new HelperLine(topCenter(viewportBounds), bottomCenter(viewportBounds), HelperLineType.Center));
175
+ if (lineTypes.includes(HelperLineType.Center) && this.isAligned(Bounds.centerX, viewportBounds, bounds, 2)) {
176
+ helperLines.push(new HelperLine(Bounds.topCenter(viewportBounds), Bounds.bottomCenter(viewportBounds), HelperLineType.Center));
196
177
  this.log('- Reference bounds center align with viewport.', viewportBounds);
197
178
  }
198
- if (lineTypes.includes(HelperLineType.Middle) && this.isAligned(middle, viewportBounds, bounds, 2)) {
199
- helperLines.push(new HelperLine(middleLeft(viewportBounds), middleRight(viewportBounds), HelperLineType.Middle));
179
+ if (lineTypes.includes(HelperLineType.Middle) && this.isAligned(Bounds.middle, viewportBounds, bounds, 2)) {
180
+ helperLines.push(new HelperLine(Bounds.middleLeft(viewportBounds), Bounds.middleRight(viewportBounds), HelperLineType.Middle));
200
181
  this.log('- Reference bounds middle align with viewport.', viewportBounds);
201
182
  }
202
183
  if (helperLines.length > 0) {
@@ -213,78 +194,90 @@ export class DrawHelperLinesFeedbackCommand extends FeedbackCommand {
213
194
  protected calcHelperLinesForBounds(elementBounds: Bounds, bounds: Bounds, lineTypes: HelperLineType[]): HelperLine[] {
214
195
  const helperLines: HelperLine[] = [];
215
196
 
216
- if (lineTypes.includes(HelperLineType.Left) && this.isAligned(left, elementBounds, bounds, this.alignmentEpsilon)) {
217
- const [above, below] = sortBy(top, elementBounds, bounds); // higher top-value ==> lower
218
- helperLines.push(new HelperLine(bottomLeft(below), topLeft(above), HelperLineType.Left));
197
+ if (lineTypes.includes(HelperLineType.Left) && this.isAligned(Bounds.left, elementBounds, bounds, this.alignmentEpsilon)) {
198
+ const [above, below] = Bounds.sortBy(Bounds.top, elementBounds, bounds); // higher top-value ==> lower
199
+ helperLines.push(new HelperLine(Bounds.bottomLeft(below), Bounds.topLeft(above), HelperLineType.Left));
219
200
  this.log('- Reference bounds left align with element', elementBounds);
220
201
  }
221
202
 
222
- if (lineTypes.includes(HelperLineType.Center) && this.isAligned(center, elementBounds, bounds, this.alignmentEpsilon)) {
223
- const [above, below] = sortBy(top, elementBounds, bounds); // higher top-value ==> lower
224
- helperLines.push(new HelperLine(topCenter(above), bottomCenter(below), HelperLineType.Center));
203
+ if (lineTypes.includes(HelperLineType.Center) && this.isAligned(Bounds.centerX, elementBounds, bounds, this.alignmentEpsilon)) {
204
+ const [above, below] = Bounds.sortBy(Bounds.top, elementBounds, bounds); // higher top-value ==> lower
205
+ helperLines.push(new HelperLine(Bounds.topCenter(above), Bounds.bottomCenter(below), HelperLineType.Center));
225
206
  this.log('- Reference bounds center align with element', elementBounds);
226
207
  }
227
208
 
228
- if (lineTypes.includes(HelperLineType.Right) && this.isAligned(right, elementBounds, bounds, this.alignmentEpsilon)) {
229
- const [above, below] = sortBy(top, elementBounds, bounds); // higher top-value ==> lower
230
- helperLines.push(new HelperLine(bottomRight(below), topRight(above), HelperLineType.Right));
209
+ if (lineTypes.includes(HelperLineType.Right) && this.isAligned(Bounds.right, elementBounds, bounds, this.alignmentEpsilon)) {
210
+ const [above, below] = Bounds.sortBy(Bounds.top, elementBounds, bounds); // higher top-value ==> lower
211
+ helperLines.push(new HelperLine(Bounds.bottomRight(below), Bounds.topRight(above), HelperLineType.Right));
231
212
  this.log('- Reference bounds right align with element', elementBounds);
232
213
  }
233
214
 
234
- if (lineTypes.includes(HelperLineType.Bottom) && this.isAligned(bottom, elementBounds, bounds, this.alignmentEpsilon)) {
235
- const [before, after] = sortBy(left, elementBounds, bounds); // higher left-value ==> more to the right
236
- helperLines.push(new HelperLine(bottomLeft(before), bottomRight(after), HelperLineType.Bottom));
215
+ if (lineTypes.includes(HelperLineType.Bottom) && this.isAligned(Bounds.bottom, elementBounds, bounds, this.alignmentEpsilon)) {
216
+ const [before, after] = Bounds.sortBy(Bounds.left, elementBounds, bounds); // higher left-value ==> more to the right
217
+ helperLines.push(new HelperLine(Bounds.bottomLeft(before), Bounds.bottomRight(after), HelperLineType.Bottom));
237
218
  this.log('- Reference bounds bottom align with element', elementBounds);
238
219
  }
239
220
 
240
- if (lineTypes.includes(HelperLineType.Middle) && this.isAligned(middle, elementBounds, bounds, this.alignmentEpsilon)) {
241
- const [before, after] = sortBy(left, elementBounds, bounds); // higher left-value ==> more to the right
242
- helperLines.push(new HelperLine(middleLeft(before), middleRight(after), HelperLineType.Middle));
221
+ if (lineTypes.includes(HelperLineType.Middle) && this.isAligned(Bounds.centerY, elementBounds, bounds, this.alignmentEpsilon)) {
222
+ const [before, after] = Bounds.sortBy(Bounds.left, elementBounds, bounds); // higher left-value ==> more to the right
223
+ helperLines.push(new HelperLine(Bounds.middleLeft(before), Bounds.middleRight(after), HelperLineType.Middle));
243
224
  this.log('- Reference bounds middle align with element', elementBounds);
244
225
  }
245
226
 
246
- if (lineTypes.includes(HelperLineType.Top) && this.isAligned(top, elementBounds, bounds, this.alignmentEpsilon)) {
247
- const [before, after] = sortBy(left, elementBounds, bounds); // higher left-value ==> more to the right
248
- helperLines.push(new HelperLine(topLeft(before), topRight(after), HelperLineType.Top));
227
+ if (lineTypes.includes(HelperLineType.Top) && this.isAligned(Bounds.top, elementBounds, bounds, this.alignmentEpsilon)) {
228
+ const [before, after] = Bounds.sortBy(Bounds.left, elementBounds, bounds); // higher left-value ==> more to the right
229
+ helperLines.push(new HelperLine(Bounds.topLeft(before), Bounds.topRight(after), HelperLineType.Top));
249
230
  this.log('- Reference bounds top align with element', elementBounds);
250
231
  }
251
232
 
252
- if (lineTypes.includes(HelperLineType.LeftRight) && this.isMatch(left(elementBounds), right(bounds), this.alignmentEpsilon)) {
253
- if (isAbove(bounds, elementBounds)) {
254
- helperLines.push(new HelperLine(bottomLeft(elementBounds), topRight(bounds), HelperLineType.RightLeft));
233
+ if (
234
+ lineTypes.includes(HelperLineType.LeftRight) &&
235
+ this.isMatch(Bounds.left(elementBounds), Bounds.right(bounds), this.alignmentEpsilon)
236
+ ) {
237
+ if (Bounds.isAbove(bounds, elementBounds)) {
238
+ helperLines.push(new HelperLine(Bounds.bottomLeft(elementBounds), Bounds.topRight(bounds), HelperLineType.RightLeft));
255
239
  this.log('- Reference bounds right aligns with element left', elementBounds);
256
240
  } else {
257
- helperLines.push(new HelperLine(topLeft(elementBounds), bottomRight(bounds), HelperLineType.RightLeft));
241
+ helperLines.push(new HelperLine(Bounds.topLeft(elementBounds), Bounds.bottomRight(bounds), HelperLineType.RightLeft));
258
242
  this.log('- Reference bounds right aligns with element left', elementBounds);
259
243
  }
260
244
  }
261
245
 
262
- if (lineTypes.includes(HelperLineType.LeftRight) && this.isMatch(right(elementBounds), left(bounds), this.alignmentEpsilon)) {
263
- if (isAbove(bounds, elementBounds)) {
264
- helperLines.push(new HelperLine(bottomRight(elementBounds), topLeft(bounds), HelperLineType.LeftRight));
246
+ if (
247
+ lineTypes.includes(HelperLineType.LeftRight) &&
248
+ this.isMatch(Bounds.right(elementBounds), Bounds.left(bounds), this.alignmentEpsilon)
249
+ ) {
250
+ if (Bounds.isAbove(bounds, elementBounds)) {
251
+ helperLines.push(new HelperLine(Bounds.bottomRight(elementBounds), Bounds.topLeft(bounds), HelperLineType.LeftRight));
265
252
  this.log('- Reference bounds left aligns with element right', elementBounds);
266
253
  } else {
267
- helperLines.push(new HelperLine(topRight(elementBounds), bottomLeft(bounds), HelperLineType.LeftRight));
254
+ helperLines.push(new HelperLine(Bounds.topRight(elementBounds), Bounds.bottomLeft(bounds), HelperLineType.LeftRight));
268
255
  this.log('- Reference bounds left aligns with element right', elementBounds);
269
256
  }
270
257
  }
271
258
 
272
- if (lineTypes.includes(HelperLineType.TopBottom) && this.isMatch(top(elementBounds), bottom(bounds), this.alignmentEpsilon)) {
273
- if (isBefore(bounds, elementBounds)) {
274
- helperLines.push(new HelperLine(topRight(elementBounds), bottomLeft(bounds), HelperLineType.BottomTop));
259
+ if (
260
+ lineTypes.includes(HelperLineType.TopBottom) &&
261
+ this.isMatch(Bounds.top(elementBounds), Bounds.bottom(bounds), this.alignmentEpsilon)
262
+ ) {
263
+ if (Bounds.isBefore(bounds, elementBounds)) {
264
+ helperLines.push(new HelperLine(Bounds.topRight(elementBounds), Bounds.bottomLeft(bounds), HelperLineType.BottomTop));
275
265
  this.log('- Reference bounds bottom aligns with element top', elementBounds);
276
266
  } else {
277
- helperLines.push(new HelperLine(topLeft(elementBounds), bottomRight(bounds), HelperLineType.BottomTop));
267
+ helperLines.push(new HelperLine(Bounds.topLeft(elementBounds), Bounds.bottomRight(bounds), HelperLineType.BottomTop));
278
268
  this.log('- Reference bounds bottom aligns with element top', elementBounds);
279
269
  }
280
270
  }
281
271
 
282
- if (lineTypes.includes(HelperLineType.TopBottom) && this.isMatch(bottom(elementBounds), top(bounds), this.alignmentEpsilon)) {
283
- if (isBefore(bounds, elementBounds)) {
284
- helperLines.push(new HelperLine(bottomRight(elementBounds), topLeft(bounds), HelperLineType.TopBottom));
272
+ if (
273
+ lineTypes.includes(HelperLineType.TopBottom) &&
274
+ this.isMatch(Bounds.bottom(elementBounds), Bounds.top(bounds), this.alignmentEpsilon)
275
+ ) {
276
+ if (Bounds.isBefore(bounds, elementBounds)) {
277
+ helperLines.push(new HelperLine(Bounds.bottomRight(elementBounds), Bounds.topLeft(bounds), HelperLineType.TopBottom));
285
278
  this.log('- Reference bounds top aligns with element bottom', elementBounds);
286
279
  } else {
287
- helperLines.push(new HelperLine(bottomLeft(elementBounds), topRight(bounds), HelperLineType.TopBottom));
280
+ helperLines.push(new HelperLine(Bounds.bottomLeft(elementBounds), Bounds.topRight(bounds), HelperLineType.TopBottom));
288
281
  this.log('- Reference bounds top aligns with element bottom', elementBounds);
289
282
  }
290
283
  }
@@ -14,7 +14,7 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
- import { Args, Bounds, GChildElement, GModelElement, GShapeElement, Point } from '@eclipse-glsp/sprotty';
17
+ import { Args, Bounds, Direction, GChildElement, GModelElement, GShapeElement, Point, Vector } from '@eclipse-glsp/sprotty';
18
18
  import { v4 as uuid } from 'uuid';
19
19
  import { ArgsAware } from '../../base/args-feature';
20
20
  import { ResizeHandleLocation } from '../change-bounds/model';
@@ -98,30 +98,8 @@ export function isSelectionBounds(element: GModelElement): element is SelectionB
98
98
  return element.type === SELECTION_BOUNDS;
99
99
  }
100
100
 
101
- export const Direction = {
102
- Left: 'left',
103
- Right: 'right',
104
- Up: 'up',
105
- Down: 'down'
106
- } as const;
107
-
108
- // allow any string to be set as helper line type to support customization
109
- export type Direction = (typeof Direction)[keyof typeof Direction];
110
-
111
- export function getDirectionOf(point: Point): Direction[] {
112
- const directions: Direction[] = [];
113
- if (point.x < 0) {
114
- directions.push(Direction.Left);
115
- } else if (point.x > 0) {
116
- directions.push(Direction.Right);
117
- }
118
- if (point.y < 0) {
119
- directions.push(Direction.Up);
120
- } else if (point.y > 0) {
121
- directions.push(Direction.Down);
122
- }
123
- return directions;
124
- }
101
+ // kept for backwards compatibility after moving the definition
102
+ export const getDirectionOf = Vector.direction;
125
103
 
126
104
  export function getDirectionFrom(resize?: ResizeHandleLocation): Direction[] {
127
105
  if (resize === ResizeHandleLocation.TopLeft) {
@@ -138,3 +116,6 @@ export function getDirectionFrom(resize?: ResizeHandleLocation): Direction[] {
138
116
  }
139
117
  return [];
140
118
  }
119
+
120
+ // re-export for backwards compatibility after moving the definition
121
+ export { Direction } from '@eclipse-glsp/sprotty';
@@ -13,17 +13,18 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { inject, injectable, optional } from 'inversify';
17
16
  import {
18
17
  Action,
19
18
  ChangeBoundsOperation,
19
+ Dimension,
20
20
  ElementAndBounds,
21
21
  ElementMove,
22
+ GModelElement,
22
23
  IActionDispatcher,
23
24
  IActionHandler,
24
25
  ICommand,
25
26
  MoveAction,
26
- GModelElement,
27
+ Point,
27
28
  SetBoundsAction,
28
29
  TYPES,
29
30
  Writable,
@@ -31,9 +32,10 @@ import {
31
32
  hasNumberProp,
32
33
  hasStringProp
33
34
  } from '@eclipse-glsp/sprotty';
35
+ import { inject, injectable, optional } from 'inversify';
34
36
  import { SelectionService } from '../../base/selection-service';
35
- import { toValidElementAndBounds, toValidElementMove } from '../../utils/layout-utils';
36
37
  import { BoundsAwareModelElement, getElements } from '../../utils/gmodel-util';
38
+ import { toValidElementAndBounds, toValidElementMove } from '../../utils/layout-utils';
37
39
  import { isBoundsAwareMoveable, isResizable } from '../change-bounds/model';
38
40
  import { IMovementRestrictor } from '../change-bounds/movement-restrictor';
39
41
 
@@ -227,12 +229,13 @@ export class ResizeElementsActionHandler extends LayoutElementsActionHandler {
227
229
  resizeWidthAndHeight(elements: BoundsAwareModelElement[], reduceFn: ReduceFunction): void {
228
230
  const targetWidth = reduceFn(...elements.map(element => element.bounds.width));
229
231
  const targetHeight = reduceFn(...elements.map(element => element.bounds.height));
232
+ const targetDimension: Dimension = { width: targetWidth, height: targetHeight };
230
233
  this.dispatchResizeActions(elements, (element, bounds) => {
231
234
  // resize around center and middle (horizontal & vertical)
232
- const halfDiffWidth = 0.5 * (targetWidth - element.bounds.width);
233
- const halfDiffHeight = 0.5 * (targetHeight - element.bounds.height);
234
- bounds.newPosition = { x: element.bounds.x - halfDiffWidth, y: element.bounds.y - halfDiffHeight };
235
- bounds.newSize = { width: targetWidth, height: targetHeight };
235
+ const difference = Dimension.subtract(targetDimension, element.bounds);
236
+ const center = Dimension.center(difference);
237
+ bounds.newPosition = Point.subtract(element.bounds, center);
238
+ bounds.newSize = targetDimension;
236
239
  });
237
240
  }
238
241
 
@@ -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 { calcElementAndRoute } from '../../utils/gmodel-util';
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(bounds: Bounds, model: GModelRoot): Viewport | undefined {
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
- const zoom = model.zoom;
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
- return {
99
- scroll: {
100
- x: c.x - (0.5 * model.canvasBounds.width) / zoom,
101
- y: c.y - (0.5 * model.canvasBounds.height) / zoom
102
- },
103
- zoom: zoom
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, Point } from '@eclipse-glsp/sprotty';
17
+ import { Bounds } from '@eclipse-glsp/sprotty';
18
18
 
19
- export function left(bounds: Bounds): number {
20
- return bounds.x;
21
- }
19
+ /** @deprecated Use {@link Bounds.left} */
20
+ export const left = Bounds.left;
22
21
 
23
- export function center(bounds: Bounds): number {
24
- return bounds.x + (bounds.width >= 0 ? bounds.width * 0.5 : 0);
25
- }
22
+ /** @deprecated Use {@link Bounds.centerX} */
23
+ export const center = Bounds.center;
26
24
 
27
- export function right(bounds: Bounds): number {
28
- return bounds.x + bounds.width;
29
- }
25
+ /** @deprecated Use {@link Bounds.right} */
26
+ export const right = Bounds.right;
30
27
 
31
- export function top(bounds: Bounds): number {
32
- return bounds.y;
33
- }
28
+ /** @deprecated Use {@link Bounds.top} */
29
+ export const top = Bounds.top;
34
30
 
35
- export function middle(bounds: Bounds): number {
36
- return bounds.y + (bounds.height >= 0 ? bounds.height * 0.5 : 0);
37
- }
31
+ /** @deprecated Use {@link Bounds.middle} */
32
+ export const middle = Bounds.middle;
38
33
 
39
- export function bottom(bounds: Bounds): number {
40
- return bounds.y + bounds.height;
41
- }
34
+ /** @deprecated Use {@link Bounds.bottom} */
35
+ export const bottom = Bounds.bottom;
42
36
 
43
- export function topLeft(bounds: Bounds): Point {
44
- return { x: left(bounds), y: top(bounds) };
45
- }
37
+ /** @deprecated Use {@link Bounds.topLeft} */
38
+ export const topLeft = Bounds.topLeft;
46
39
 
47
- export function topCenter(bounds: Bounds): Point {
48
- return { x: center(bounds), y: top(bounds) };
49
- }
40
+ /** @deprecated Use {@link Bounds.topCenter} */
41
+ export const topCenter = Bounds.topCenter;
50
42
 
51
- export function topRight(bounds: Bounds): Point {
52
- return { x: right(bounds), y: top(bounds) };
53
- }
43
+ /** @deprecated Use {@link Bounds.topRight} */
44
+ export const topRight = Bounds.topRight;
54
45
 
55
- export function middleLeft(bounds: Bounds): Point {
56
- return { x: left(bounds), y: middle(bounds) };
57
- }
46
+ /** @deprecated Use {@link Bounds.middleLeft} */
47
+ export const middleLeft = Bounds.middleLeft;
58
48
 
59
- export function middleCenter(bounds: Bounds): Point {
60
- return { x: center(bounds), y: middle(bounds) };
61
- }
49
+ /** @deprecated Use {@link Bounds.middleCenter} */
50
+ export const middleCenter = Bounds.middleCenter;
62
51
 
63
- export function middleRight(bounds: Bounds): Point {
64
- return { x: right(bounds), y: middle(bounds) };
65
- }
52
+ /** @deprecated Use {@link Bounds.middleRight} */
53
+ export const middleRight = Bounds.middleRight;
66
54
 
67
- export function bottomLeft(bounds: Bounds): Point {
68
- return { x: left(bounds), y: bottom(bounds) };
69
- }
55
+ /** @deprecated Use {@link Bounds.bottomLeft} */
56
+ export const bottomLeft = Bounds.bottomLeft;
70
57
 
71
- export function bottomCenter(bounds: Bounds): Point {
72
- return { x: center(bounds), y: bottom(bounds) };
73
- }
58
+ /** @deprecated Use {@link Bounds.bottomCenter} */
59
+ export const bottomCenter = Bounds.bottomCenter;
74
60
 
75
- export function bottomRight(bounds: Bounds): Point {
76
- return { x: right(bounds), y: bottom(bounds) };
77
- }
61
+ /** @deprecated Use {@link Bounds.bottomRight} */
62
+ export const bottomRight = Bounds.bottomRight;
78
63
 
79
- export function sortBy(rankFunc: (elem: Bounds) => number, ...points: Bounds[]): Bounds[] {
80
- return points.sort(compareFunction(rankFunc));
81
- }
64
+ /** @deprecated Use {@link Bounds.left} */
65
+ export const sortBy = Bounds.sortBy;
82
66
 
83
- export function compareFunction<T>(rankFunc: (elem: T) => number): (left: T, right: T) => number {
84
- return (elemLeft, elemRight) => rankFunc(elemLeft) - rankFunc(elemRight);
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
- export function isAbove(leftBounds: Bounds, rightBounds: Bounds): boolean {
88
- return top(leftBounds) <= top(rightBounds);
89
- }
72
+ /** @deprecated Use {@link Bounds.isAbove} */
73
+ export const isAbove = Bounds.isAbove;
90
74
 
91
- export function isBelow(leftBounds: Bounds, rightBounds: Bounds): boolean {
92
- return top(leftBounds) >= top(rightBounds);
93
- }
75
+ /** @deprecated Use {@link Bounds.isBelow} */
76
+ export const isBelow = Bounds.isBelow;
94
77
 
95
- export function isBefore(leftBounds: Bounds, rightBounds: Bounds): boolean {
96
- return left(leftBounds) < left(rightBounds);
97
- }
78
+ /** @deprecated Use {@link Bounds.isBefore} */
79
+ export const isBefore = Bounds.isBefore;
98
80
 
99
- export function isAfter(leftBounds: Bounds, rightBounds: Bounds): boolean {
100
- return left(leftBounds) >= left(rightBounds);
101
- }
81
+ /** @deprecated Use {@link Bounds.isAfter} */
82
+ export const isAfter = Bounds.isAfter;
@@ -347,7 +347,7 @@ export function findTopLevelElementByFeature<T>(
347
347
  export function calculateDeltaBetweenPoints(target: Point, source: Point, element: GModelElement): Point {
348
348
  const delta = Point.subtract(target, source);
349
349
  const zoom = getZoom(element);
350
- const adaptedDelta = { x: delta.x / zoom, y: delta.y / zoom };
350
+ const adaptedDelta = Point.divideScalar(delta, zoom);
351
351
  return adaptedDelta;
352
352
  }
353
353