@eclipse-glsp/client 2.1.0-next.304 → 2.1.0-next.306

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 (34) hide show
  1. package/lib/base/selection-service.d.ts +1 -1
  2. package/lib/base/selection-service.d.ts.map +1 -1
  3. package/lib/base/selection-service.js +15 -20
  4. package/lib/base/selection-service.js.map +1 -1
  5. package/lib/base/selection-service.spec.js +9 -7
  6. package/lib/base/selection-service.spec.js.map +1 -1
  7. package/lib/features/change-bounds/position-snapper.js +4 -4
  8. package/lib/features/change-bounds/position-snapper.js.map +1 -1
  9. package/lib/features/helper-lines/helper-line-feedback.d.ts +30 -11
  10. package/lib/features/helper-lines/helper-line-feedback.d.ts.map +1 -1
  11. package/lib/features/helper-lines/helper-line-feedback.js +93 -32
  12. package/lib/features/helper-lines/helper-line-feedback.js.map +1 -1
  13. package/lib/features/helper-lines/helper-line-manager-default.d.ts +42 -11
  14. package/lib/features/helper-lines/helper-line-manager-default.d.ts.map +1 -1
  15. package/lib/features/helper-lines/helper-line-manager-default.js +21 -16
  16. package/lib/features/helper-lines/helper-line-manager-default.js.map +1 -1
  17. package/lib/features/helper-lines/helper-line-manager.d.ts +8 -1
  18. package/lib/features/helper-lines/helper-line-manager.d.ts.map +1 -1
  19. package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js +1 -1
  20. package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js.map +1 -1
  21. package/lib/tsconfig.tsbuildinfo +1 -1
  22. package/lib/utils/gmodel-util.d.ts +1 -0
  23. package/lib/utils/gmodel-util.d.ts.map +1 -1
  24. package/lib/utils/gmodel-util.js +10 -1
  25. package/lib/utils/gmodel-util.js.map +1 -1
  26. package/package.json +3 -3
  27. package/src/base/selection-service.spec.ts +9 -7
  28. package/src/base/selection-service.ts +17 -21
  29. package/src/features/change-bounds/position-snapper.ts +4 -4
  30. package/src/features/helper-lines/helper-line-feedback.ts +127 -45
  31. package/src/features/helper-lines/helper-line-manager-default.ts +68 -20
  32. package/src/features/helper-lines/helper-line-manager.ts +8 -1
  33. package/src/features/tools/change-bounds/change-bounds-tool-feedback.ts +1 -1
  34. package/src/utils/gmodel-util.ts +12 -0
@@ -172,4 +172,5 @@ export declare function calcRoute(element: GRoutableElement, routerRegistry: Edg
172
172
  export declare function getElementTypeId(input: GModelElement | GModelElementSchema | string): string;
173
173
  export declare function findTopLevelElementByFeature<T>(element: GModelElement, predicate: (t: GModelElement) => t is GModelElement & T, skip?: (t: GModelElement) => boolean): (GModelElement & T) | undefined;
174
174
  export declare function calculateDeltaBetweenPoints(target: Point, source: Point, element: GModelElement): Point;
175
+ export declare function isVisibleOnCanvas(model: BoundsAwareModelElement): boolean;
175
176
  //# sourceMappingURL=gmodel-util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gmodel-util.d.ts","sourceRoot":"","sources":["../../src/utils/gmodel-util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EAEd,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,KAAK,EACL,WAAW,EACX,UAAU,EACV,SAAS,EASZ,MAAM,uBAAuB,CAAC;AAE/B;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,aAAa,KAAK,YAAY,IAAI,aAAa,GAAG,CAAC,CAAC;AAEzG;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,aAAa,GAAG,CAAC,CAAC,CAEtH;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC5B,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,oBAAoB,CAAC,CAAC,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CAAC,CAAC,EAAE,aAAa,KAAK,OAAqB,GAClD,CAAC,aAAa,GAAG,CAAC,CAAC,GAAG,SAAS,CAcjC;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAMvG;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CASzE"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calculateDeltaBetweenPoints = exports.findTopLevelElementByFeature = exports.getElementTypeId = exports.calcRoute = exports.calcElementAndRoute = exports.calcElementAndRoutingPoints = exports.ROUTE_KINDS = exports.ROUTING_POINT_KINDS = exports.ALL_ROUTING_POINTS = exports.toElementAndRoutingPoints = exports.toElementAndBounds = exports.isSelectableAndBoundsAware = exports.isRoutingHandle = exports.isRoutable = exports.isNonRoutableSelectedBoundsAware = exports.isNonRoutableSelectedMovableBoundsAware = exports.removeCssClasses = exports.addCssClasses = exports.isNotUndefined = exports.hasSelectedElements = exports.getSelectedElementCount = exports.getElements = exports.getMatchingElements = exports.forEachElement = exports.filter = void 0;
3
+ exports.isVisibleOnCanvas = exports.calculateDeltaBetweenPoints = exports.findTopLevelElementByFeature = exports.getElementTypeId = exports.calcRoute = exports.calcElementAndRoute = exports.calcElementAndRoutingPoints = exports.ROUTE_KINDS = exports.ROUTING_POINT_KINDS = exports.ALL_ROUTING_POINTS = exports.toElementAndRoutingPoints = exports.toElementAndBounds = exports.isSelectableAndBoundsAware = exports.isRoutingHandle = exports.isRoutable = exports.isNonRoutableSelectedBoundsAware = exports.isNonRoutableSelectedMovableBoundsAware = exports.removeCssClasses = exports.addCssClasses = exports.isNotUndefined = exports.hasSelectedElements = exports.getSelectedElementCount = exports.getElements = exports.getMatchingElements = exports.forEachElement = exports.filter = void 0;
4
4
  /********************************************************************************
5
5
  * Copyright (c) 2019-2023 EclipseSource and others.
6
6
  *
@@ -301,4 +301,13 @@ function calculateDeltaBetweenPoints(target, source, element) {
301
301
  return adaptedDelta;
302
302
  }
303
303
  exports.calculateDeltaBetweenPoints = calculateDeltaBetweenPoints;
304
+ function isVisibleOnCanvas(model) {
305
+ const modelBounds = (0, sprotty_1.getAbsoluteBounds)(model);
306
+ const canvasBounds = model.root.canvasBounds;
307
+ return (modelBounds.x <= canvasBounds.width &&
308
+ modelBounds.x + modelBounds.width >= 0 &&
309
+ modelBounds.y <= canvasBounds.height &&
310
+ modelBounds.y + modelBounds.height >= 0);
311
+ }
312
+ exports.isVisibleOnCanvas = isVisibleOnCanvas;
304
313
  //# sourceMappingURL=gmodel-util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gmodel-util.js","sourceRoot":"","sources":["../../src/utils/gmodel-util.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAwB+B;AAS/B;;;;;;GAMG;AACH,SAAgB,MAAM,CAAI,KAAqB,EAAE,SAAkC;IAC/E,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAsC,CAAC;AAC9E,CAAC;AAFD,wBAEC;AAED;;;;;;GAMG;AACH,SAAgB,cAAc,CAC1B,KAAqB,EACrB,SAAkC,EAClC,QAAmD;IAEnD,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC/C,CAAC;AAND,wCAMC;AAED;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAI,KAAqB,EAAE,SAAkC;IAC5F,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;AAChD,CAAC;AAFD,kDAEC;AAED;;;;;;;GAOG;AACH,SAAgB,WAAW,CAA0B,KAAqB,EAAE,WAAqB,EAAE,KAAoB;IACnH,2GAA2G;IAC3G,MAAM,QAAQ,GAAG,CAAC,OAAuB,EAAgB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AC,CAAC,GAAG,IAAI,EAAE,CAAC;IAC9D,OAAO,YAAY,CAAC;AACxB,CAAC;AAND,kEAMC;AAED,SAAgB,iBAAiB,CAAC,KAA8B;IAC5D,MAAM,WAAW,GAAG,IAAA,2BAAiB,EAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC;IAC7C,OAAO,CACH,WAAW,CAAC,CAAC,IAAI,YAAY,CAAC,KAAK;QACnC,WAAW,CAAC,CAAC,GAAG,WAAW,CAAC,KAAK,IAAI,CAAC;QACtC,WAAW,CAAC,CAAC,IAAI,YAAY,CAAC,MAAM;QACpC,WAAW,CAAC,CAAC,GAAG,WAAW,CAAC,MAAM,IAAI,CAAC,CAC1C,CAAC;AACN,CAAC;AATD,8CASC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-glsp/client",
3
- "version": "2.1.0-next.304+159e69f",
3
+ "version": "2.1.0-next.306+45e896a",
4
4
  "description": "A sprotty-based client for GLSP",
5
5
  "keywords": [
6
6
  "eclipse",
@@ -47,7 +47,7 @@
47
47
  "watch": "tsc -w"
48
48
  },
49
49
  "dependencies": {
50
- "@eclipse-glsp/sprotty": "2.1.0-next.304+159e69f",
50
+ "@eclipse-glsp/sprotty": "2.1.0-next.306+45e896a",
51
51
  "autocompleter": "^9.1.0",
52
52
  "file-saver": "^2.0.5",
53
53
  "lodash": "4.17.21"
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "159e69f7132b801cf03b3352e617db4ea9ec67aa"
62
+ "gitHead": "45e896a12e39a220635b5c4f1d165165d0c07c86"
63
63
  }
@@ -13,10 +13,10 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
+ import { Action, Disposable, GModelRoot, GNode, TYPES, initializeContainer } from '@eclipse-glsp/sprotty';
16
17
  import { AssertionError, expect } from 'chai';
17
18
  import { Container, injectable } from 'inversify';
18
19
  import * as sinon from 'sinon';
19
- import { Action, Disposable, GModelRoot, GNode, TYPES, initializeContainer } from '@eclipse-glsp/sprotty';
20
20
  import { defaultModule } from './default.module';
21
21
  import { IFeedbackActionDispatcher, IFeedbackEmitter } from './feedback/feedback-action-dispatcher';
22
22
  import { ISelectionListener, SelectFeedbackAction, SelectionService } from './selection-service';
@@ -217,13 +217,13 @@ describe('SelectionService', () => {
217
217
  selectionService.updateSelection(root, [], ['node4']);
218
218
  assertListener(listener, root, ['node2', 'node3'], ['node4'], 4);
219
219
  });
220
- it('A registered listener should be notified of root changes.', () => {
220
+ it('A registered listener should NOT be notified of root changes.', () => {
221
221
  selectionService.updateSelection(root, [], []);
222
- assertListener(listener, root, [], [], 1);
222
+ assertListener(listener, root, [], [], 0);
223
223
 
224
224
  const newRoot = createRoot('node1', 'newNode2', 'newNode3');
225
225
  selectionService.updateSelection(newRoot, [], []);
226
- assertListener(listener, newRoot, [], [], 2);
226
+ assertListener(listener, newRoot, [], [], 0);
227
227
  });
228
228
  it('Selecting the same elements consecutively should not trigger a listener update.', () => {
229
229
  selectionService.updateSelection(root, ['node1'], []);
@@ -290,8 +290,10 @@ describe('SelectionService', () => {
290
290
  expectedCalled: number
291
291
  ): void {
292
292
  expect(listener.selectionChanged.callCount).to.be.equal(expectedCalled);
293
- expect(listener.selectionChanged.lastCall.args[0]).to.be.deep.equals(expectedRoot);
294
- expect(listener.selectionChanged.lastCall.args[1]).to.be.deep.equals(expectedSelection);
295
- expect(listener.selectionChanged.lastCall.args[2]).to.be.deep.equals(expectedDeselection);
293
+ if (expectedCalled > 0) {
294
+ expect(listener.selectionChanged.lastCall.args[0]).to.be.deep.equals(expectedRoot);
295
+ expect(listener.selectionChanged.lastCall.args[1]).to.be.deep.equals(expectedSelection);
296
+ expect(listener.selectionChanged.lastCall.args[2]).to.be.deep.equals(expectedDeselection);
297
+ }
296
298
  }
297
299
  });
@@ -96,41 +96,41 @@ export class SelectionService implements IGModelRootListener, Disposable {
96
96
  this.updateSelection(root, [], []);
97
97
  }
98
98
 
99
- updateSelection(root: Readonly<GModelRoot>, select: string[], deselect: string[]): void {
100
- if (root === undefined && select.length === 0 && deselect.length === 0) {
99
+ updateSelection(newRoot: Readonly<GModelRoot>, select: string[], deselect: string[]): void {
100
+ if (newRoot === undefined && select.length === 0 && deselect.length === 0) {
101
101
  return;
102
102
  }
103
103
  const prevRoot = this.root;
104
104
  const prevSelectedElementIDs = new Set(this.selectedElementIDs);
105
105
 
106
- // update root
107
- this.root = root;
106
+ this.root = newRoot;
108
107
 
109
- // update selected element IDs and collect deselected elements
110
- // - select all elements that are not deselected at the same time (no-op)
111
- // - deselect all elements that are not selected at the same time (no-op) but was selected
108
+ // We only select elements that are not part of the deselection
112
109
  const toSelect = [...select].filter(selectId => deselect.indexOf(selectId) === -1);
110
+
111
+ // We only need to deselect elements that are not part of the selection
112
+ // If an element is part of both the select and deselect, it's state is not changed
113
113
  const toDeselect = [...deselect].filter(deselectId => select.indexOf(deselectId) === -1 && this.selectedElementIDs.has(deselectId));
114
- for (const id of toDeselect) {
115
- this.selectedElementIDs.delete(id);
116
- }
117
- for (const id of toSelect) {
118
- this.selectedElementIDs.add(id);
119
- }
120
114
 
115
+ // update selected element ids
116
+ toDeselect.forEach(toDeselectId => this.selectedElementIDs.delete(toDeselectId));
117
+ toSelect.forEach(toSelectId => this.selectedElementIDs.add(toSelectId));
118
+
119
+ // check if the newly or previously selected elements still exist in the updated root
121
120
  const deselectedElementIDs = new Set(toDeselect);
122
- // see if selected elements still exist in the updated root
123
121
  for (const id of this.selectedElementIDs) {
124
- const element = root.index.getById(id);
122
+ const element = newRoot.index.getById(id);
125
123
  if (element === undefined) {
124
+ // element to be selected does not exist in the root...
126
125
  this.selectedElementIDs.delete(id);
127
- if (prevRoot !== undefined && prevRoot.index.getById(id)) {
126
+ if (prevRoot?.index.getById(id)) {
127
+ // ...but existed in the previous root, so we want to consider it deselected
128
128
  deselectedElementIDs.add(id);
129
129
  }
130
130
  }
131
131
  }
132
132
 
133
- // only send out changes if there actually are changes, i.e., the root or the selected elements changed
133
+ // only send out changes if there actually are changes, i.e., any of the selected elements ids has changed
134
134
  const selectionChanged =
135
135
  prevSelectedElementIDs.size !== this.selectedElementIDs.size ||
136
136
  ![...prevSelectedElementIDs].every(value => this.selectedElementIDs.has(value));
@@ -142,10 +142,6 @@ export class SelectionService implements IGModelRootListener, Disposable {
142
142
  deselectedElementsIDs: [...deselectedElementIDs]
143
143
  })
144
144
  ]);
145
- }
146
-
147
- const rootChanged = prevRoot !== root;
148
- if (rootChanged || selectionChanged) {
149
145
  // notify listeners after the feedback action
150
146
  this.notifyListeners(this.root, this.selectedElementIDs, deselectedElementIDs);
151
147
  }
@@ -55,14 +55,14 @@ export class PositionSnapper {
55
55
 
56
56
  const minimum: Writable<Point> = { x: 0, y: 0 };
57
57
  if (directions.includes(Direction.Left) && helperLines.some(line => line.isLeft || line.isCenter)) {
58
- minimum.x = this.helperLineManager.getHelperLineSnapping(target, isSnap, Direction.Left);
58
+ minimum.x = this.helperLineManager.getMinimumMoveDelta(target, isSnap, Direction.Left);
59
59
  } else if (directions.includes(Direction.Right) && helperLines.some(line => line.isRight || line.isCenter)) {
60
- minimum.x = this.helperLineManager.getHelperLineSnapping(target, isSnap, Direction.Right);
60
+ minimum.x = this.helperLineManager.getMinimumMoveDelta(target, isSnap, Direction.Right);
61
61
  }
62
62
  if (directions.includes(Direction.Up) && helperLines.some(line => line.isTop || line.isMiddle)) {
63
- minimum.y = this.helperLineManager.getHelperLineSnapping(target, isSnap, Direction.Up);
63
+ minimum.y = this.helperLineManager.getMinimumMoveDelta(target, isSnap, Direction.Up);
64
64
  } else if (directions.includes(Direction.Down) && helperLines.some(line => line.isBottom || line.isMiddle)) {
65
- minimum.y = this.helperLineManager.getHelperLineSnapping(target, isSnap, Direction.Down);
65
+ minimum.y = this.helperLineManager.getMinimumMoveDelta(target, isSnap, Direction.Down);
66
66
  }
67
67
  return minimum;
68
68
  }
@@ -19,12 +19,17 @@ import {
19
19
  Bounds,
20
20
  CommandExecutionContext,
21
21
  CommandReturn,
22
+ GChildElement,
23
+ GLabel,
22
24
  GModelElement,
23
25
  GModelRoot,
26
+ ILogger,
27
+ Point,
24
28
  TYPES,
25
29
  Viewport,
26
30
  findParentByFeature,
27
31
  isBoundsAware,
32
+ isDecoration,
28
33
  isViewport
29
34
  } from '@eclipse-glsp/sprotty';
30
35
  import { inject, injectable } from 'inversify';
@@ -50,14 +55,23 @@ import {
50
55
  topLeft,
51
56
  topRight
52
57
  } from '../../utils/geometry-util';
53
- import { BoundsAwareModelElement, findTopLevelElementByFeature, forEachElement, getMatchingElements } from '../../utils/gmodel-util';
54
- import { getViewportBounds } from '../../utils/viewpoint-util';
58
+ import {
59
+ BoundsAwareModelElement,
60
+ findTopLevelElementByFeature,
61
+ forEachElement,
62
+ getMatchingElements,
63
+ isRoutable,
64
+ isVisibleOnCanvas
65
+ } from '../../utils/gmodel-util';
66
+ import { getViewportBounds, toAbsoluteBounds } from '../../utils/viewpoint-util';
55
67
  import { HelperLine, HelperLineType, SelectionBounds, isHelperLine, isSelectionBounds } from './model';
56
68
 
57
69
  export type ViewportLineType = typeof HelperLineType.Center | typeof HelperLineType.Middle | string;
58
70
 
59
- export const ALL_ELEMENT_LINE_TYPES = Object.values(HelperLineType);
60
- export const ALL_VIEWPORT_LINE_TYPES = [HelperLineType.Center, HelperLineType.Middle];
71
+ export type AlignmentElementFilter = (element: BoundsAwareModelElement, referenceElementIds: string[]) => boolean;
72
+
73
+ export const isTopLevelBoundsAwareElement: AlignmentElementFilter = element =>
74
+ findTopLevelElementByFeature(element, isBoundsAware, isViewport) === element;
61
75
 
62
76
  export interface DrawHelperLinesFeedbackAction extends Action {
63
77
  kind: typeof DrawHelperLinesFeedbackAction.KIND;
@@ -65,8 +79,20 @@ export interface DrawHelperLinesFeedbackAction extends Action {
65
79
  elementLines?: HelperLineType[];
66
80
  viewportLines?: ViewportLineType[];
67
81
  alignmentEpsilon?: number;
82
+ alignmentElementFilter?: AlignmentElementFilter;
83
+ debug?: boolean;
68
84
  }
69
85
 
86
+ export const ALL_ELEMENT_LINE_TYPES = Object.values(HelperLineType);
87
+ export const ALL_VIEWPORT_LINE_TYPES = [HelperLineType.Center, HelperLineType.Middle];
88
+
89
+ export const DEFAULT_ELEMENT_LINES = ALL_ELEMENT_LINE_TYPES;
90
+ export const DEFAULT_VIEWPORT_LINES = ALL_VIEWPORT_LINE_TYPES;
91
+ export const DEFAULT_EPSILON = 1;
92
+ export const DEFAULT_ALIGNABLE_ELEMENT_FILTER = (element: BoundsAwareModelElement): boolean =>
93
+ isVisibleOnCanvas(element) && !isRoutable(element) && !(element instanceof GLabel) && !isDecoration(element);
94
+ export const DEFAULT_DEBUG = false;
95
+
70
96
  export namespace DrawHelperLinesFeedbackAction {
71
97
  export const KIND = 'drawHelperLines';
72
98
 
@@ -82,153 +108,200 @@ export namespace DrawHelperLinesFeedbackAction {
82
108
  export class DrawHelperLinesFeedbackCommand extends FeedbackCommand {
83
109
  static readonly KIND = DrawHelperLinesFeedbackAction.KIND;
84
110
 
85
- constructor(@inject(TYPES.Action) public action: DrawHelperLinesFeedbackAction) {
111
+ protected elementIds: string[];
112
+ protected elementLines: HelperLineType[];
113
+ protected viewportLines: ViewportLineType[];
114
+ protected alignmentEpsilon: number;
115
+ protected alignableElementFilter: AlignmentElementFilter;
116
+ protected isAlignableElementPredicate: (element: GModelElement) => element is BoundsAwareModelElement;
117
+ protected debug: boolean;
118
+
119
+ constructor(
120
+ @inject(TYPES.Action) action: DrawHelperLinesFeedbackAction,
121
+ @inject(TYPES.ILogger) protected logger: ILogger
122
+ ) {
86
123
  super();
124
+ this.elementIds = action.elementIds;
125
+ this.elementLines = action.elementLines ?? DEFAULT_ELEMENT_LINES;
126
+ this.viewportLines = action.viewportLines ?? DEFAULT_VIEWPORT_LINES;
127
+ this.alignmentEpsilon = action.alignmentEpsilon ?? DEFAULT_EPSILON;
128
+ this.alignableElementFilter = action.alignmentElementFilter ?? DEFAULT_ALIGNABLE_ELEMENT_FILTER;
129
+ this.isAlignableElementPredicate = this.isAlignableElement.bind(this);
130
+ this.debug = action.debug ?? DEFAULT_DEBUG;
87
131
  }
88
132
 
89
133
  execute(context: CommandExecutionContext): CommandReturn {
90
134
  removeHelperLines(context.root);
91
135
  removeSelectionBounds(context.root);
92
- const boundsAwareElements = getMatchingElements(context.root.index, this.isCompareElement);
93
- const [referenceElements, elements] = partition(boundsAwareElements, element => this.action.elementIds.includes(element.id));
136
+ const alignableElements = getMatchingElements(context.root.index, this.isAlignableElementPredicate);
137
+ this.log('All alignable elements: ', alignableElements);
138
+ const [referenceElements, elements] = partition(alignableElements, element => this.elementIds.includes(element.id));
139
+ this.log('Split alignable elements into reference elements and other elements: ', referenceElements, elements);
94
140
  if (referenceElements.length === 0) {
141
+ this.log('--> No helper lines as we do not have any reference elements.');
95
142
  return context.root;
96
143
  }
97
144
  const referenceBounds = this.calcReferenceBounds(referenceElements);
145
+ this.log('Bounds encompasing all reference elements: ', referenceBounds);
98
146
  const helperLines = this.calcHelperLines(elements, referenceBounds, context);
99
147
  if (referenceElements.length > 1) {
100
148
  context.root.add(new SelectionBounds(referenceBounds));
149
+ this.log('Render selection bounds for more than one reference element:', referenceBounds);
101
150
  }
102
151
  helperLines.forEach(helperLine => context.root.add(helperLine));
152
+ if (helperLines.length > 0) {
153
+ this.log(`--> Add ${helperLines.length} helper lines to root:`, helperLines);
154
+ } else {
155
+ this.log('--> Add no helper lines to root.');
156
+ }
103
157
  return context.root;
104
158
  }
105
159
 
106
- protected isCompareElement(element: GModelElement): element is BoundsAwareModelElement {
107
- return isBoundsAware(element) && findTopLevelElementByFeature(element, isBoundsAware, isViewport) === element;
160
+ protected isAlignableElement(element: GModelElement): element is BoundsAwareModelElement {
161
+ return isBoundsAware(element) && this.alignableElementFilter(element, this.elementIds);
108
162
  }
109
163
 
110
164
  protected calcReferenceBounds(referenceElements: BoundsAwareModelElement[]): Bounds {
111
- return referenceElements.map(element => element.bounds).reduce((combined, next) => Bounds.combine(combined, next), Bounds.EMPTY);
165
+ return referenceElements.map(element => this.calcBounds(element)).reduce(Bounds.combine, Bounds.EMPTY);
166
+ }
167
+
168
+ protected calcBounds(element: BoundsAwareModelElement): Bounds {
169
+ return toAbsoluteBounds(element);
112
170
  }
113
171
 
114
172
  protected calcHelperLines(elements: BoundsAwareModelElement[], bounds: Bounds, context: CommandExecutionContext): HelperLine[] {
115
173
  const helperLines: HelperLine[] = [];
116
174
  const viewport = findParentByFeature(context.root, isViewport);
117
175
  if (viewport) {
118
- helperLines.push(...this.calcHelperLinesForViewport(viewport, bounds));
176
+ helperLines.push(...this.calcHelperLinesForViewport(viewport, bounds, this.viewportLines));
119
177
  }
120
- elements.flatMap(element => this.calcHelperLinesForElement(element, bounds)).forEach(line => helperLines.push(line));
178
+ elements
179
+ .flatMap(element => this.calcHelperLinesForElement(element, bounds, this.elementLines))
180
+ .forEach(line => helperLines.push(line));
121
181
  return helperLines;
122
182
  }
123
183
 
124
- protected calcHelperLinesForViewport(
125
- root: Viewport & GModelRoot,
126
- bounds: Bounds,
127
- lineTypes: HelperLineType[] = this.action.viewportLines ?? ALL_VIEWPORT_LINE_TYPES
128
- ): HelperLine[] {
184
+ protected calcHelperLinesForViewport(root: Viewport & GModelRoot, bounds: Bounds, lineTypes: HelperLineType[]): HelperLine[] {
129
185
  const helperLines: HelperLine[] = [];
186
+ this.log('Find helperlines for viewport:', root);
130
187
  const viewportBounds = getViewportBounds(root, root.canvasBounds);
131
188
  if (lineTypes.includes(HelperLineType.Center) && this.isAligned(center, viewportBounds, bounds, 2)) {
132
189
  helperLines.push(new HelperLine(topCenter(viewportBounds), bottomCenter(viewportBounds), HelperLineType.Center));
190
+ this.log('- Reference bounds center align with viewport.', viewportBounds);
133
191
  }
134
192
  if (lineTypes.includes(HelperLineType.Middle) && this.isAligned(middle, viewportBounds, bounds, 2)) {
135
193
  helperLines.push(new HelperLine(middleLeft(viewportBounds), middleRight(viewportBounds), HelperLineType.Middle));
194
+ this.log('- Reference bounds middle align with viewport.', viewportBounds);
195
+ }
196
+ if (helperLines.length > 0) {
197
+ this.log(`--> Add ${helperLines.length} helperlines for viewport:`, helperLines);
136
198
  }
137
199
  return helperLines;
138
200
  }
139
201
 
140
- protected calcHelperLinesForElement(
141
- element: BoundsAwareModelElement,
142
- bounds: Bounds,
143
- lineTypes: HelperLineType[] = this.action.elementLines ?? ALL_ELEMENT_LINE_TYPES
144
- ): HelperLine[] {
145
- return this.calcHelperLinesForBounds(element.bounds, bounds, lineTypes);
202
+ protected calcHelperLinesForElement(element: BoundsAwareModelElement, bounds: Bounds, lineTypes: HelperLineType[]): HelperLine[] {
203
+ this.log('Find helperlines for element:', element);
204
+ return this.calcHelperLinesForBounds(this.calcBounds(element), bounds, lineTypes);
146
205
  }
147
206
 
148
- protected calcHelperLinesForBounds(
149
- elementBounds: Bounds,
150
- bounds: Bounds,
151
- lineTypes: HelperLineType[] = this.action.elementLines ?? ALL_ELEMENT_LINE_TYPES
152
- ): HelperLine[] {
207
+ protected calcHelperLinesForBounds(elementBounds: Bounds, bounds: Bounds, lineTypes: HelperLineType[]): HelperLine[] {
153
208
  const helperLines: HelperLine[] = [];
154
209
 
155
- if (lineTypes.includes(HelperLineType.Left) && this.isAligned(left, elementBounds, bounds)) {
210
+ if (lineTypes.includes(HelperLineType.Left) && this.isAligned(left, elementBounds, bounds, this.alignmentEpsilon)) {
156
211
  const [above, below] = sortBy(top, elementBounds, bounds); // higher top-value ==> lower
157
212
  helperLines.push(new HelperLine(bottomLeft(below), topLeft(above), HelperLineType.Left));
213
+ this.log('- Reference bounds left align with element', elementBounds);
158
214
  }
159
215
 
160
- if (lineTypes.includes(HelperLineType.Center) && this.isAligned(center, elementBounds, bounds)) {
216
+ if (lineTypes.includes(HelperLineType.Center) && this.isAligned(center, elementBounds, bounds, this.alignmentEpsilon)) {
161
217
  const [above, below] = sortBy(top, elementBounds, bounds); // higher top-value ==> lower
162
218
  helperLines.push(new HelperLine(topCenter(above), bottomCenter(below), HelperLineType.Center));
219
+ this.log('- Reference bounds center align with element', elementBounds);
163
220
  }
164
221
 
165
- if (lineTypes.includes(HelperLineType.Right) && this.isAligned(right, elementBounds, bounds)) {
222
+ if (lineTypes.includes(HelperLineType.Right) && this.isAligned(right, elementBounds, bounds, this.alignmentEpsilon)) {
166
223
  const [above, below] = sortBy(top, elementBounds, bounds); // higher top-value ==> lower
167
224
  helperLines.push(new HelperLine(bottomRight(below), topRight(above), HelperLineType.Right));
225
+ this.log('- Reference bounds right align with element', elementBounds);
168
226
  }
169
227
 
170
- if (lineTypes.includes(HelperLineType.Bottom) && this.isAligned(bottom, elementBounds, bounds)) {
228
+ if (lineTypes.includes(HelperLineType.Bottom) && this.isAligned(bottom, elementBounds, bounds, this.alignmentEpsilon)) {
171
229
  const [before, after] = sortBy(left, elementBounds, bounds); // higher left-value ==> more to the right
172
230
  helperLines.push(new HelperLine(bottomLeft(before), bottomRight(after), HelperLineType.Bottom));
231
+ this.log('- Reference bounds bottom align with element', elementBounds);
173
232
  }
174
233
 
175
- if (lineTypes.includes(HelperLineType.Middle) && this.isAligned(middle, elementBounds, bounds)) {
234
+ if (lineTypes.includes(HelperLineType.Middle) && this.isAligned(middle, elementBounds, bounds, this.alignmentEpsilon)) {
176
235
  const [before, after] = sortBy(left, elementBounds, bounds); // higher left-value ==> more to the right
177
236
  helperLines.push(new HelperLine(middleLeft(before), middleRight(after), HelperLineType.Middle));
237
+ this.log('- Reference bounds middle align with element', elementBounds);
178
238
  }
179
239
 
180
- if (lineTypes.includes(HelperLineType.Top) && this.isAligned(top, elementBounds, bounds)) {
240
+ if (lineTypes.includes(HelperLineType.Top) && this.isAligned(top, elementBounds, bounds, this.alignmentEpsilon)) {
181
241
  const [before, after] = sortBy(left, elementBounds, bounds); // higher left-value ==> more to the right
182
242
  helperLines.push(new HelperLine(topLeft(before), topRight(after), HelperLineType.Top));
243
+ this.log('- Reference bounds top align with element', elementBounds);
183
244
  }
184
245
 
185
- if (lineTypes.includes(HelperLineType.LeftRight) && this.isMatch(left(elementBounds), right(bounds), 2)) {
246
+ if (lineTypes.includes(HelperLineType.LeftRight) && this.isMatch(left(elementBounds), right(bounds), this.alignmentEpsilon)) {
186
247
  if (isAbove(bounds, elementBounds)) {
187
248
  helperLines.push(new HelperLine(bottomLeft(elementBounds), topRight(bounds), HelperLineType.RightLeft));
249
+ this.log('- Reference bounds right aligns with element left', elementBounds);
188
250
  } else {
189
251
  helperLines.push(new HelperLine(topLeft(elementBounds), bottomRight(bounds), HelperLineType.RightLeft));
252
+ this.log('- Reference bounds right aligns with element left', elementBounds);
190
253
  }
191
254
  }
192
255
 
193
- if (lineTypes.includes(HelperLineType.LeftRight) && this.isMatch(right(elementBounds), left(bounds), 2)) {
256
+ if (lineTypes.includes(HelperLineType.LeftRight) && this.isMatch(right(elementBounds), left(bounds), this.alignmentEpsilon)) {
194
257
  if (isAbove(bounds, elementBounds)) {
195
258
  helperLines.push(new HelperLine(bottomRight(elementBounds), topLeft(bounds), HelperLineType.LeftRight));
259
+ this.log('- Reference bounds left aligns with element right', elementBounds);
196
260
  } else {
197
261
  helperLines.push(new HelperLine(topRight(elementBounds), bottomLeft(bounds), HelperLineType.LeftRight));
262
+ this.log('- Reference bounds left aligns with element right', elementBounds);
198
263
  }
199
264
  }
200
265
 
201
- if (lineTypes.includes(HelperLineType.TopBottom) && this.isMatch(top(elementBounds), bottom(bounds), 2)) {
266
+ if (lineTypes.includes(HelperLineType.TopBottom) && this.isMatch(top(elementBounds), bottom(bounds), this.alignmentEpsilon)) {
202
267
  if (isBefore(bounds, elementBounds)) {
203
268
  helperLines.push(new HelperLine(topRight(elementBounds), bottomLeft(bounds), HelperLineType.BottomTop));
269
+ this.log('- Reference bounds bottom aligns with element top', elementBounds);
204
270
  } else {
205
271
  helperLines.push(new HelperLine(topLeft(elementBounds), bottomRight(bounds), HelperLineType.BottomTop));
272
+ this.log('- Reference bounds bottom aligns with element top', elementBounds);
206
273
  }
207
274
  }
208
275
 
209
- if (lineTypes.includes(HelperLineType.TopBottom) && this.isMatch(bottom(elementBounds), top(bounds), 2)) {
276
+ if (lineTypes.includes(HelperLineType.TopBottom) && this.isMatch(bottom(elementBounds), top(bounds), this.alignmentEpsilon)) {
210
277
  if (isBefore(bounds, elementBounds)) {
211
278
  helperLines.push(new HelperLine(bottomRight(elementBounds), topLeft(bounds), HelperLineType.TopBottom));
279
+ this.log('- Reference bounds top aligns with element bottom', elementBounds);
212
280
  } else {
213
281
  helperLines.push(new HelperLine(bottomLeft(elementBounds), topRight(bounds), HelperLineType.TopBottom));
282
+ this.log('- Reference bounds top aligns with element bottom', elementBounds);
214
283
  }
215
284
  }
285
+ if (helperLines.length > 0) {
286
+ this.log(`--> Add ${helperLines.length} helperlines for element:`, helperLines);
287
+ }
216
288
 
217
289
  return helperLines;
218
290
  }
219
291
 
220
- protected isAligned(
221
- coordinate: (elem: Bounds) => number,
222
- leftBounds: Bounds,
223
- rightBounds: Bounds,
224
- epsilon = this.action.alignmentEpsilon ?? 1
225
- ): boolean {
292
+ protected isAligned(coordinate: (elem: Bounds) => number, leftBounds: Bounds, rightBounds: Bounds, epsilon: number): boolean {
226
293
  return this.isMatch(coordinate(leftBounds), coordinate(rightBounds), epsilon);
227
294
  }
228
295
 
229
- protected isMatch(leftCoordinate: number, rightCoordinate: number, epsilon = this.action.alignmentEpsilon ?? 1): boolean {
296
+ protected isMatch(leftCoordinate: number, rightCoordinate: number, epsilon: number): boolean {
230
297
  return Math.abs(leftCoordinate - rightCoordinate) < epsilon;
231
298
  }
299
+
300
+ protected log(message: string, ...params: any[]): void {
301
+ if (this.debug) {
302
+ this.logger.log(this, message, params);
303
+ }
304
+ }
232
305
  }
233
306
 
234
307
  export interface RemoveHelperLinesFeedbackAction extends Action {
@@ -253,6 +326,7 @@ export class RemoveHelperLinesFeedbackCommand extends FeedbackCommand {
253
326
  constructor(@inject(TYPES.Action) public action: RemoveHelperLinesFeedbackAction) {
254
327
  super();
255
328
  }
329
+
256
330
  override execute(context: CommandExecutionContext): CommandReturn {
257
331
  removeHelperLines(context.root);
258
332
  removeSelectionBounds(context.root);
@@ -267,3 +341,11 @@ export function removeHelperLines(root: GModelRoot): void {
267
341
  export function removeSelectionBounds(root: GModelRoot): void {
268
342
  forEachElement(root.index, isSelectionBounds, line => root.remove(line));
269
343
  }
344
+
345
+ export function boundsInViewport(element: GModelElement, bounds: Bounds | Point): Bounds | Point {
346
+ if (element instanceof GChildElement && !isViewport(element.parent)) {
347
+ return boundsInViewport(element.parent, element.parent.localToParent(bounds) as Bounds);
348
+ } else {
349
+ return bounds;
350
+ }
351
+ }