@eclipse-glsp/client 2.8.0-next.0 → 2.8.0-next.8
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/lib/features/accessibility/keyboard-pointer/keyboard-pointer.d.ts +9 -1
- package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.d.ts.map +1 -1
- package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.js +12 -4
- package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.js.map +1 -1
- package/lib/features/command-palette/command-palette.d.ts.map +1 -1
- package/lib/features/command-palette/command-palette.js +4 -2
- package/lib/features/command-palette/command-palette.js.map +1 -1
- package/lib/utils/viewpoint-util.d.ts +13 -1
- package/lib/utils/viewpoint-util.d.ts.map +1 -1
- package/lib/utils/viewpoint-util.js +22 -1
- package/lib/utils/viewpoint-util.js.map +1 -1
- package/lib/views/glsp-projection-view.d.ts +12 -1
- package/lib/views/glsp-projection-view.d.ts.map +1 -1
- package/lib/views/glsp-projection-view.js +52 -1
- package/lib/views/glsp-projection-view.js.map +1 -1
- package/package.json +3 -3
- package/src/features/accessibility/keyboard-pointer/keyboard-pointer.ts +12 -3
- package/src/features/command-palette/command-palette.ts +4 -2
- package/src/utils/viewpoint-util.ts +23 -1
- package/src/views/glsp-projection-view.tsx +58 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2023-
|
|
2
|
+
* Copyright (c) 2023-2026 Business Informatics Group (TU Wien) and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -28,6 +28,10 @@ export declare class KeyboardPointer extends GLSPAbstractUIExtension implements
|
|
|
28
28
|
protected keyListener: KeyboardPointerKeyboardListener;
|
|
29
29
|
constructor(actionDispatcher: IActionDispatcher);
|
|
30
30
|
get triggerAction(): TriggerNodeCreationAction;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the pointer is currently shown. Reflects the `hidden` css class toggled by
|
|
33
|
+
* {@link GLSPAbstractUIExtension}, not the inline `visibility` style.
|
|
34
|
+
*/
|
|
31
35
|
get isVisible(): boolean;
|
|
32
36
|
get getPosition(): KeyboardPointerPosition;
|
|
33
37
|
get getKeyListener(): KeyboardPointerKeyboardListener;
|
|
@@ -36,6 +40,10 @@ export declare class KeyboardPointer extends GLSPAbstractUIExtension implements
|
|
|
36
40
|
protected initializeContents(containerElement: HTMLElement): void;
|
|
37
41
|
protected onBeforeShow(containerElement: HTMLElement, root: Readonly<GModelRoot>, ...selectedElementIds: string[]): void;
|
|
38
42
|
handle(action: Action): Action | void;
|
|
43
|
+
/**
|
|
44
|
+
* Positions the pointer on the selected grid cell and colors it to indicate whether node creation
|
|
45
|
+
* is allowed at that location.
|
|
46
|
+
*/
|
|
39
47
|
render(): void;
|
|
40
48
|
}
|
|
41
49
|
//# sourceMappingURL=keyboard-pointer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-pointer.d.ts","sourceRoot":"","sources":["../../../../src/features/accessibility/keyboard-pointer/keyboard-pointer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,cAAc,EAAS,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEhI,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"keyboard-pointer.d.ts","sourceRoot":"","sources":["../../../../src/features/accessibility/keyboard-pointer/keyboard-pointer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,cAAc,EAAS,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;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value: true });
|
|
15
15
|
exports.KeyboardPointer = void 0;
|
|
16
16
|
/********************************************************************************
|
|
17
|
-
* Copyright (c) 2023-
|
|
17
|
+
* Copyright (c) 2023-2026 Business Informatics Group (TU Wien) and others.
|
|
18
18
|
*
|
|
19
19
|
* This program and the accompanying materials are made available under the
|
|
20
20
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -33,6 +33,7 @@ const inversify_1 = require("inversify");
|
|
|
33
33
|
const editor_context_service_1 = require("../../../base/editor-context-service");
|
|
34
34
|
const css_feedback_1 = require("../../../base/feedback/css-feedback");
|
|
35
35
|
const ui_extension_1 = require("../../../base/ui-extension/ui-extension");
|
|
36
|
+
const viewpoint_util_1 = require("../../../utils/viewpoint-util");
|
|
36
37
|
const container_manager_1 = require("../../tools/node-creation/container-manager");
|
|
37
38
|
const action_1 = require("../keyboard-grid/action");
|
|
38
39
|
const actions_1 = require("./actions");
|
|
@@ -53,9 +54,12 @@ let KeyboardPointer = class KeyboardPointer extends ui_extension_1.GLSPAbstractU
|
|
|
53
54
|
get triggerAction() {
|
|
54
55
|
return this._triggerAction;
|
|
55
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Whether the pointer is currently shown. Reflects the `hidden` css class toggled by
|
|
59
|
+
* {@link GLSPAbstractUIExtension}, not the inline `visibility` style.
|
|
60
|
+
*/
|
|
56
61
|
get isVisible() {
|
|
57
|
-
|
|
58
|
-
return ((_a = this.containerElement) === null || _a === void 0 ? void 0 : _a.style.visibility) === 'visible';
|
|
62
|
+
return !!this.containerElement && this.isContainerVisible();
|
|
59
63
|
}
|
|
60
64
|
get getPosition() {
|
|
61
65
|
return this.position;
|
|
@@ -91,9 +95,13 @@ let KeyboardPointer = class KeyboardPointer extends ui_extension_1.GLSPAbstractU
|
|
|
91
95
|
this.render();
|
|
92
96
|
}
|
|
93
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Positions the pointer on the selected grid cell and colors it to indicate whether node creation
|
|
100
|
+
* is allowed at that location.
|
|
101
|
+
*/
|
|
94
102
|
render() {
|
|
95
103
|
if (this.containerElement !== undefined) {
|
|
96
|
-
const { x, y } = this.position.renderPosition;
|
|
104
|
+
const { x, y } = (0, viewpoint_util_1.pageToCssPosition)(this.containerElement, this.position.renderPosition);
|
|
97
105
|
this.containerElement.style.left = `${x}px`;
|
|
98
106
|
this.containerElement.style.top = `${y}px`;
|
|
99
107
|
const { status } = this.position.containableParentAtDiagramPosition(this._triggerAction.elementTypeId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-pointer.js","sourceRoot":"","sources":["../../../../src/features/accessibility/keyboard-pointer/keyboard-pointer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAAgI;AAChI,yCAA+C;AAC/C,iFAA4E;AAC5E,sEAAgE;AAChE,0EAAkF;AAClF,mFAA+E;AAC/E,oDAAyE;AACzE,uCAAmE;AACnE,2CAAsD;AACtD,2EAA8E;AAC9E,2EAAsE;AAG/D,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,sCAAuB;IAcxD,YAA6C,gBAAsD;QAC/F,KAAK,EAAE,CAAC;QADoD,qBAAgB,GAAhB,gBAAgB,CAAmB;QAbzF,mBAAc,GAA8B;YAClD,aAAa,EAAE,gBAAgB;YAC/B,IAAI,EAAE,qBAAqB;SAC9B,CAAC;QAOQ,aAAQ,GAA4B,IAAI,mDAAuB,CAAC,IAAI,CAAC,CAAC;QAM5E,IAAI,CAAC,WAAW,GAAG,IAAI,2DAA+B,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACnF,CAAC;IAED,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED,IAAI,SAAS
|
|
1
|
+
{"version":3,"file":"keyboard-pointer.js","sourceRoot":"","sources":["../../../../src/features/accessibility/keyboard-pointer/keyboard-pointer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;A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AG,GAAG,CAAC,IAAI,CAAC;YAE3C,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,kCAAkC,CAAC,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;YAEvG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;YAClD,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;YAClD,QAAQ,MAAM,EAAE,CAAC;gBACb,KAAK,wBAAS,CAAC,aAAa,CAAC,CAAC,CAAC;oBAC3B,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;oBAClD,MAAM;gBACV,CAAC;gBACD,KAAK,wBAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC;oBACnC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC;oBAChD,MAAM;gBACV,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;CACJ,CAAA;AAhGY,0CAAe;AAOjB;IADN,IAAA,kBAAM,EAAC,6CAAoB,CAAC;8BACA,6CAAoB;6DAAC;AAE3C;IADN,IAAA,kBAAM,EAAC,eAAK,CAAC,iBAAiB,CAAC;8BACP,oCAAgB;yDAAC;0BATjC,eAAe;IAD3B,IAAA,sBAAU,GAAE;IAeI,WAAA,IAAA,kBAAM,EAAC,eAAK,CAAC,iBAAiB,CAAC,CAAA;;GAdnC,eAAe,CAgG3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-palette.d.ts","sourceRoot":"","sources":["../../../src/features/command-palette/command-palette.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAmB,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"command-palette.d.ts","sourceRoot":"","sources":["../../../src/features/command-palette/command-palette.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAmB,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAM3G,qBACa,kBAAmB,SAAQ,cAAc;cAC/B,kBAAkB,CAAC,gBAAgB,EAAE,WAAW,GAAG,IAAI;cAMvD,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;cAQ3C,YAAY,CAAC,gBAAgB,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,GAAG,kBAAkB,EAAE,MAAM,EAAE,GAAG,IAAI;IAoBjI,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,GAAG,MAAM;CAkBxE"}
|
|
@@ -26,6 +26,7 @@ const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
|
26
26
|
const inversify_1 = require("inversify");
|
|
27
27
|
const ui_extension_1 = require("../../base/ui-extension/ui-extension");
|
|
28
28
|
const gmodel_util_1 = require("../../utils/gmodel-util");
|
|
29
|
+
const viewpoint_util_1 = require("../../utils/viewpoint-util");
|
|
29
30
|
let GlspCommandPalette = class GlspCommandPalette extends sprotty_1.CommandPalette {
|
|
30
31
|
initializeContents(containerElement) {
|
|
31
32
|
super.initializeContents(containerElement);
|
|
@@ -55,8 +56,9 @@ let GlspCommandPalette = class GlspCommandPalette extends sprotty_1.CommandPalet
|
|
|
55
56
|
x += bounds.x;
|
|
56
57
|
y += bounds.y;
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
containerElement.style.
|
|
59
|
+
const { x: cssX, y: cssY } = (0, viewpoint_util_1.pageToCssPosition)(containerElement, { x, y });
|
|
60
|
+
containerElement.style.left = `${cssX}px`;
|
|
61
|
+
containerElement.style.top = `${cssY}px`;
|
|
60
62
|
containerElement.style.width = `${this.defaultWidth}px`;
|
|
61
63
|
}
|
|
62
64
|
getAbsoluteBounds(element) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-palette.js","sourceRoot":"","sources":["../../../src/features/command-palette/command-palette.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;AAElF,mDAA2G;AAC3G,yCAAuC;AACvC,uEAA0G;AAC1G,yDAAkF;
|
|
1
|
+
{"version":3,"file":"command-palette.js","sourceRoot":"","sources":["../../../src/features/command-palette/command-palette.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;AAElF,mDAA2G;AAC3G,yCAAuC;AACvC,uEAA0G;AAC1G,yDAAkF;AAClF,+DAA+D;AAGxD,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,wBAAc;IAC/B,kBAAkB,CAAC,gBAA6B;QAC/D,KAAK,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;QAC3C,gBAAgB,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC;QACrC,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,qCAAsB,CAAC,CAAC;IAC3D,CAAC;IAEkB,mBAAmB,CAAC,OAAgB;;QACnD,IAAI,OAAO,EAAE,CAAC;YACV,MAAA,IAAI,CAAC,gBAAgB,0CAAE,SAAS,CAAC,MAAM,CAAC,yCAA0B,CAAC,CAAC;QACxE,CAAC;aAAM,CAAC;YACJ,MAAA,IAAI,CAAC,gBAAgB,0CAAE,SAAS,CAAC,GAAG,CAAC,yCAA0B,CAAC,CAAC;QACrE,CAAC;IACL,CAAC;IAEkB,YAAY,CAAC,gBAA6B,EAAE,IAA0B,EAAE,GAAG,kBAA4B;QACtH,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QAErB,MAAM,gBAAgB,GAAG,IAAA,yBAAW,EAAC,IAAI,CAAC,KAAK,EAAE,kBAAkB,EAAE,wCAA0B,CAA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AC;YAChD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;YACjC,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC;YACzB,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC;YACxB,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACnB,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,CAAC;QACD,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IACnC,CAAC;CACJ,CAAA;AArDY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CAqD9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2026 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -30,6 +30,18 @@ import { BoundsAwareModelElement } from './gmodel-util';
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function getAbsolutePosition(target: GModelElement, mouseEvent: MouseEvent): Point;
|
|
32
32
|
export declare function getAbsolutePositionByPoint(target: GModelElement, point: Point): Point;
|
|
33
|
+
/**
|
|
34
|
+
* Computes the CSS `left`/`top` (in pixels) for placing {@link element} at the given point in page
|
|
35
|
+
* coordinates, accounting for its positioning context: relative to its `offsetParent` (the diagram
|
|
36
|
+
* container for absolutely positioned overlays) or, when there is none, relative to the viewport for
|
|
37
|
+
* fixed elements. This lets UI extensions be placed on the diagram canvas independently of where the
|
|
38
|
+
* diagram container sits within the page (e.g. below an application header).
|
|
39
|
+
*
|
|
40
|
+
* @param element the DOM-attached element to position
|
|
41
|
+
* @param pagePoint the target location in page coordinates
|
|
42
|
+
* @returns the `left`/`top` offset to assign to {@link element}'s style
|
|
43
|
+
*/
|
|
44
|
+
export declare function pageToCssPosition(element: HTMLElement, pagePoint: Point): Point;
|
|
33
45
|
export declare function getViewportBounds(target: GModelElement, bounds: Bounds): Bounds;
|
|
34
46
|
/**
|
|
35
47
|
* Translates the bounds of the diagram element (local coordinates) into the diagram coordinates system
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewpoint-util.d.ts","sourceRoot":"","sources":["../../src/utils/viewpoint-util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EACH,MAAM,EACN,SAAS,EACT,aAAa,EACb,aAAa,EACb,UAAU,EACV,KAAK,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"viewpoint-util.d.ts","sourceRoot":"","sources":["../../src/utils/viewpoint-util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EACH,MAAM,EACN,SAAS,EACT,aAAa,EACb,aAAa,EACb,UAAU,EACV,KAAK,EACL,QAAQ,EAOX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,GAAG,KAAK,CAExF;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAYrF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,GAAG,KAAK,CAQ/E;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAI/E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAOzE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,uBAAuB,GAAG,KAAK,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,uBAAuB,GAAG,SAAS,CAEzE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,aAAa,EAAE,aAAa,EAAE,KAAK,GAAG,KAAK,CAM9G;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,KAAK,GAAG,KAAK,CAG7F;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,CAOxF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/********************************************************************************
|
|
3
|
-
* Copyright (c) 2019-
|
|
3
|
+
* Copyright (c) 2019-2026 EclipseSource and others.
|
|
4
4
|
*
|
|
5
5
|
* This program and the accompanying materials are made available under the
|
|
6
6
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.getAbsolutePosition = getAbsolutePosition;
|
|
19
19
|
exports.getAbsolutePositionByPoint = getAbsolutePositionByPoint;
|
|
20
|
+
exports.pageToCssPosition = pageToCssPosition;
|
|
20
21
|
exports.getViewportBounds = getViewportBounds;
|
|
21
22
|
exports.toAbsoluteBounds = toAbsoluteBounds;
|
|
22
23
|
exports.toAbsolutePosition = toAbsolutePosition;
|
|
@@ -52,6 +53,26 @@ function getAbsolutePositionByPoint(target, point) {
|
|
|
52
53
|
}
|
|
53
54
|
return position;
|
|
54
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Computes the CSS `left`/`top` (in pixels) for placing {@link element} at the given point in page
|
|
58
|
+
* coordinates, accounting for its positioning context: relative to its `offsetParent` (the diagram
|
|
59
|
+
* container for absolutely positioned overlays) or, when there is none, relative to the viewport for
|
|
60
|
+
* fixed elements. This lets UI extensions be placed on the diagram canvas independently of where the
|
|
61
|
+
* diagram container sits within the page (e.g. below an application header).
|
|
62
|
+
*
|
|
63
|
+
* @param element the DOM-attached element to position
|
|
64
|
+
* @param pagePoint the target location in page coordinates
|
|
65
|
+
* @returns the `left`/`top` offset to assign to {@link element}'s style
|
|
66
|
+
*/
|
|
67
|
+
function pageToCssPosition(element, pagePoint) {
|
|
68
|
+
const scroll = (0, sprotty_1.getWindowScroll)();
|
|
69
|
+
const offsetParent = element.offsetParent;
|
|
70
|
+
if (offsetParent) {
|
|
71
|
+
const bounds = offsetParent.getBoundingClientRect();
|
|
72
|
+
return { x: pagePoint.x - bounds.left - scroll.x, y: pagePoint.y - bounds.top - scroll.y };
|
|
73
|
+
}
|
|
74
|
+
return { x: pagePoint.x - scroll.x, y: pagePoint.y - scroll.y };
|
|
75
|
+
}
|
|
55
76
|
function getViewportBounds(target, bounds) {
|
|
56
77
|
const topLeft = getAbsolutePositionByPoint(target, sprotty_1.Bounds.topLeft(bounds));
|
|
57
78
|
const bottomRight = getAbsolutePositionByPoint(target, sprotty_1.Bounds.bottomRight(bounds));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewpoint-util.js","sourceRoot":"","sources":["../../src/utils/viewpoint-util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;
|
|
1
|
+
{"version":3,"file":"viewpoint-util.js","sourceRoot":"","sources":["../../src/utils/viewpoint-util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;AAgClF,kDAEC;AAED,gEAYC;AAaD,8CAQC;AAED,8CAIC;AAQD,4CAOC;AAQD,gDAEC;AAQD,wCAEC;AAUD,4CAMC;AAUD,0CAGC;AAQD,8CAOC;AAxJD,mDAc+B;AAG/B;;;;;;;;;;;;GAYG;AACH,SAAgB,mBAAmB,CAAC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,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAAC,OAAgD,EAAE,aAAoB;IACnG,IAAI,IAAA,uBAAa,EAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,OAAO,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1D,CAAC;IACD,qEAAqE;IACrE,OAAO,eAAe,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,OAAgC,EAAE,aAAoB;IAClF,MAAM,qBAAqB,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxD,OAAO,eAAK,CAAC,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;AAChE,CAAC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,KAAY,EAAE,QAA+B;IAC3E,OAAO,CACH,KAAK,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC3B,KAAK,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI;QACzE,KAAK,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC3B,KAAK,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAC7E,CAAC;AACN,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2017-
|
|
2
|
+
* Copyright (c) 2017-2026 TypeFox and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -27,6 +27,17 @@ export declare class GLSPProjectionView extends ProjectedViewportView {
|
|
|
27
27
|
protected renderSvg(model: Readonly<GViewportRootElement>, context: RenderingContext, args?: IViewArgs): VNode;
|
|
28
28
|
protected getGridStyle(viewport: Readonly<SGraphImpl>, context: RenderingContext): GridStyle;
|
|
29
29
|
protected getBackgroundBounds(viewport: Readonly<SGraphImpl>, context: RenderingContext, gridManager: IGridManager): Writable<Bounds>;
|
|
30
|
+
protected renderProjections(model: Readonly<GViewportRootElement>, context: RenderingContext, args?: IViewArgs): VNode[];
|
|
31
|
+
/**
|
|
32
|
+
* Computes the total bounds that the projection bars map to, i.e. the union of the actual
|
|
33
|
+
* content bounds and the current viewport.
|
|
34
|
+
*
|
|
35
|
+
* This is a reimplementation of sprotty's `getModelBounds`, with two minor fixes
|
|
36
|
+
* - this intentionally derives the content bounds from the
|
|
37
|
+
* root's children instead of using {@link GViewportRootElement.bounds} directly.
|
|
38
|
+
* - We ignore bounds with invalid dimensions (e.g. from routable edges without bend points) to avoid pulling the
|
|
39
|
+
*/
|
|
40
|
+
protected getModelBounds(model: Readonly<GViewportRootElement>): Bounds | undefined;
|
|
30
41
|
protected renderProjectionBar(projections: ViewProjection[], model: Readonly<GViewportRootElement>, modelBounds: Bounds, orientation: 'horizontal' | 'vertical'): VNode;
|
|
31
42
|
protected renderViewport(model: Readonly<GViewportRootElement>, params: ProjectionParams): VNode;
|
|
32
43
|
protected renderProjection(projection: ViewProjection, model: Readonly<GViewportRootElement>, params: ProjectionParams): VNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-projection-view.d.ts","sourceRoot":"","sources":["../../src/views/glsp-projection-view.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,gBAAgB;AAChB,OAAO,EACH,MAAM,EAEN,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EAET,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EAEV,cAAc,EACd,QAAQ,
|
|
1
|
+
{"version":3,"file":"glsp-projection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AAE,QAAQ,CAAC,oBAAoB,CAAC,GAAG,MAAM,GAAG,SAAS;cA+BhE,mBAAmB,CAClC,WAAW,EAAE,cAAc,EAAE,EAC7B,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EACrC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,YAAY,GAAG,UAAU,GACvC,KAAK;cAMW,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,gBAAgB,GAAG,KAAK;cAsCtF,gBAAgB,CAC/B,UAAU,EAAE,cAAc,EAC1B,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EACrC,MAAM,EAAE,gBAAgB,GACzB,KAAK;CAWX"}
|
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.GLSPProjectionView = void 0;
|
|
13
13
|
/********************************************************************************
|
|
14
|
-
* Copyright (c) 2017-
|
|
14
|
+
* Copyright (c) 2017-2026 TypeFox and others.
|
|
15
15
|
*
|
|
16
16
|
* This program and the accompanying materials are made available under the
|
|
17
17
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -68,6 +68,57 @@ let GLSPProjectionView = class GLSPProjectionView extends sprotty_1.ProjectedVie
|
|
|
68
68
|
const size = sprotty_1.Dimension.fromPoint(sprotty_1.Point.multiplyScalar(gridManager.grid, viewport.zoom));
|
|
69
69
|
return { ...position, ...size };
|
|
70
70
|
}
|
|
71
|
+
renderProjections(model, context, args) {
|
|
72
|
+
var _a;
|
|
73
|
+
if (model.zoom <= 0) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const modelBounds = this.getModelBounds(model);
|
|
77
|
+
if (!modelBounds) {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const projections = (_a = (0, sprotty_1.getProjections)(model)) !== null && _a !== void 0 ? _a : [];
|
|
81
|
+
return [
|
|
82
|
+
this.renderProjectionBar(projections, model, modelBounds, 'vertical'),
|
|
83
|
+
this.renderProjectionBar(projections, model, modelBounds, 'horizontal')
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Computes the total bounds that the projection bars map to, i.e. the union of the actual
|
|
88
|
+
* content bounds and the current viewport.
|
|
89
|
+
*
|
|
90
|
+
* This is a reimplementation of sprotty's `getModelBounds`, with two minor fixes
|
|
91
|
+
* - this intentionally derives the content bounds from the
|
|
92
|
+
* root's children instead of using {@link GViewportRootElement.bounds} directly.
|
|
93
|
+
* - We ignore bounds with invalid dimensions (e.g. from routable edges without bend points) to avoid pulling the
|
|
94
|
+
*/
|
|
95
|
+
getModelBounds(model) {
|
|
96
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
97
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
98
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
99
|
+
let maxY = Number.NEGATIVE_INFINITY;
|
|
100
|
+
for (const element of model.children) {
|
|
101
|
+
if ((0, sprotty_1.isBoundsAware)(element)) {
|
|
102
|
+
const b = element.bounds;
|
|
103
|
+
if (!sprotty_1.Dimension.isValid(b)) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
minX = Math.min(minX, b.x);
|
|
107
|
+
minY = Math.min(minY, b.y);
|
|
108
|
+
maxX = Math.max(maxX, b.x + b.width);
|
|
109
|
+
maxY = Math.max(maxY, b.y + b.height);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// enlarge the bounds by the current viewport to ensure it always fits into the projection
|
|
113
|
+
minX = Math.min(minX, model.scroll.x);
|
|
114
|
+
minY = Math.min(minY, model.scroll.y);
|
|
115
|
+
maxX = Math.max(maxX, model.scroll.x + model.canvasBounds.width / model.zoom);
|
|
116
|
+
maxY = Math.max(maxY, model.scroll.y + model.canvasBounds.height / model.zoom);
|
|
117
|
+
if (minX < maxX && minY < maxY) {
|
|
118
|
+
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
|
119
|
+
}
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
71
122
|
renderProjectionBar(projections, model, modelBounds, orientation) {
|
|
72
123
|
const vnode = super.renderProjectionBar(projections, model, modelBounds, orientation);
|
|
73
124
|
(0, sprotty_1.setClass)(vnode, 'bordered-projection-bar', true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-projection-view.js","sourceRoot":"","sources":["../../src/views/glsp-projection-view.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,gBAAgB;AAChB,
|
|
1
|
+
{"version":3,"file":"glsp-projection-view.js","sourceRoot":"","sources":["../../src/views/glsp-projection-view.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,gBAAgB;AAChB,mDAmB+B;AAC/B,yCAAyD;AACzD,uCAAgD;AAChD,+CAA4C;AAE5C,4DAA2D;AAE3D;;GAEG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,+BAAqB;IAIhD,MAAM,CAAC,KAAqC,EAAE,OAAyB,EAAE,IAAgB;QAC9F,MAAM,QAAQ,GAAU,CACpB,oDAA0B,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;YACpE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC;YACpC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAC3C,CACT,CAAC;QACF,IAAA,iBAAO,EAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QACjC,IAAA,iBAAO,EAAC,QAAQ,EAAE,YAAY,EAAE,mBAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAExD,OAAO,QAAQ,CAAC;IACpB,CAAC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AC;QACjC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACb,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;QACzB,CAAC;aAAM,CAAC;YACJ,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QACxB,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;AAxKY,gDAAkB;AACC;IAA3B,IAAA,kBAAM,EAAC,4BAAkB,CAAC;8BAAqB,4BAAkB;8DAAC;AACjB;IAAjD,IAAA,kBAAM,EAAC,eAAK,CAAC,YAAY,CAAC;IAAE,IAAA,oBAAQ,GAAE;;uDAAsC;6BAFpE,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CAwK9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/client",
|
|
3
|
-
"version": "2.8.0-next.
|
|
3
|
+
"version": "2.8.0-next.8+6f64809",
|
|
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.8.0-next.
|
|
49
|
+
"@eclipse-glsp/sprotty": "2.8.0-next.8+6f64809",
|
|
50
50
|
"autocompleter": "^9.1.2",
|
|
51
51
|
"file-saver": "^2.0.5",
|
|
52
52
|
"snabbdom": "~3.5.1",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "6f64809dc67fe90dbd3dc81bff59305a12cf3010"
|
|
65
65
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2023-
|
|
2
|
+
* Copyright (c) 2023-2026 Business Informatics Group (TU Wien) and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -18,6 +18,7 @@ import { inject, injectable } from 'inversify';
|
|
|
18
18
|
import { EditorContextService } from '../../../base/editor-context-service';
|
|
19
19
|
import { CursorCSS } from '../../../base/feedback/css-feedback';
|
|
20
20
|
import { GLSPAbstractUIExtension } from '../../../base/ui-extension/ui-extension';
|
|
21
|
+
import { pageToCssPosition } from '../../../utils/viewpoint-util';
|
|
21
22
|
import { ContainerManager } from '../../tools/node-creation/container-manager';
|
|
22
23
|
import { KeyboardGridCellSelectedAction } from '../keyboard-grid/action';
|
|
23
24
|
import { SetKeyboardPointerRenderPositionAction } from './actions';
|
|
@@ -50,8 +51,12 @@ export class KeyboardPointer extends GLSPAbstractUIExtension implements IActionH
|
|
|
50
51
|
return this._triggerAction;
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Whether the pointer is currently shown. Reflects the `hidden` css class toggled by
|
|
56
|
+
* {@link GLSPAbstractUIExtension}, not the inline `visibility` style.
|
|
57
|
+
*/
|
|
53
58
|
get isVisible(): boolean {
|
|
54
|
-
return this.containerElement
|
|
59
|
+
return !!this.containerElement && this.isContainerVisible();
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
get getPosition(): KeyboardPointerPosition {
|
|
@@ -92,9 +97,13 @@ export class KeyboardPointer extends GLSPAbstractUIExtension implements IActionH
|
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Positions the pointer on the selected grid cell and colors it to indicate whether node creation
|
|
102
|
+
* is allowed at that location.
|
|
103
|
+
*/
|
|
95
104
|
render(): void {
|
|
96
105
|
if (this.containerElement !== undefined) {
|
|
97
|
-
const { x, y } = this.position.renderPosition;
|
|
106
|
+
const { x, y } = pageToCssPosition(this.containerElement, this.position.renderPosition);
|
|
98
107
|
this.containerElement.style.left = `${x}px`;
|
|
99
108
|
this.containerElement.style.top = `${y}px`;
|
|
100
109
|
|
|
@@ -18,6 +18,7 @@ import { Bounds, CommandPalette, getWindowScroll, GModelElement, GModelRoot } fr
|
|
|
18
18
|
import { injectable } from 'inversify';
|
|
19
19
|
import { CSS_HIDDEN_EXTENSION_CLASS, CSS_UI_EXTENSION_CLASS } from '../../base/ui-extension/ui-extension';
|
|
20
20
|
import { getElements, isSelectableAndBoundsAware } from '../../utils/gmodel-util';
|
|
21
|
+
import { pageToCssPosition } from '../../utils/viewpoint-util';
|
|
21
22
|
|
|
22
23
|
@injectable()
|
|
23
24
|
export class GlspCommandPalette extends CommandPalette {
|
|
@@ -49,8 +50,9 @@ export class GlspCommandPalette extends CommandPalette {
|
|
|
49
50
|
x += bounds.x;
|
|
50
51
|
y += bounds.y;
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
-
containerElement.style.
|
|
53
|
+
const { x: cssX, y: cssY } = pageToCssPosition(containerElement, { x, y });
|
|
54
|
+
containerElement.style.left = `${cssX}px`;
|
|
55
|
+
containerElement.style.top = `${cssY}px`;
|
|
54
56
|
containerElement.style.width = `${this.defaultWidth}px`;
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2026 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
Point,
|
|
24
24
|
Viewport,
|
|
25
25
|
findParentByFeature,
|
|
26
|
+
getWindowScroll,
|
|
26
27
|
isAlignable,
|
|
27
28
|
isBoundsAware,
|
|
28
29
|
isViewport,
|
|
@@ -61,6 +62,27 @@ export function getAbsolutePositionByPoint(target: GModelElement, point: Point):
|
|
|
61
62
|
return position;
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Computes the CSS `left`/`top` (in pixels) for placing {@link element} at the given point in page
|
|
67
|
+
* coordinates, accounting for its positioning context: relative to its `offsetParent` (the diagram
|
|
68
|
+
* container for absolutely positioned overlays) or, when there is none, relative to the viewport for
|
|
69
|
+
* fixed elements. This lets UI extensions be placed on the diagram canvas independently of where the
|
|
70
|
+
* diagram container sits within the page (e.g. below an application header).
|
|
71
|
+
*
|
|
72
|
+
* @param element the DOM-attached element to position
|
|
73
|
+
* @param pagePoint the target location in page coordinates
|
|
74
|
+
* @returns the `left`/`top` offset to assign to {@link element}'s style
|
|
75
|
+
*/
|
|
76
|
+
export function pageToCssPosition(element: HTMLElement, pagePoint: Point): Point {
|
|
77
|
+
const scroll = getWindowScroll();
|
|
78
|
+
const offsetParent = element.offsetParent as HTMLElement | null;
|
|
79
|
+
if (offsetParent) {
|
|
80
|
+
const bounds = offsetParent.getBoundingClientRect();
|
|
81
|
+
return { x: pagePoint.x - bounds.left - scroll.x, y: pagePoint.y - bounds.top - scroll.y };
|
|
82
|
+
}
|
|
83
|
+
return { x: pagePoint.x - scroll.x, y: pagePoint.y - scroll.y };
|
|
84
|
+
}
|
|
85
|
+
|
|
64
86
|
export function getViewportBounds(target: GModelElement, bounds: Bounds): Bounds {
|
|
65
87
|
const topLeft = getAbsolutePositionByPoint(target, Bounds.topLeft(bounds));
|
|
66
88
|
const bottomRight = getAbsolutePositionByPoint(target, Bounds.bottomRight(bounds));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2017-
|
|
2
|
+
* Copyright (c) 2017-2026 TypeFox and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -28,7 +28,9 @@ import {
|
|
|
28
28
|
TYPES,
|
|
29
29
|
ViewProjection,
|
|
30
30
|
Writable,
|
|
31
|
+
getProjections,
|
|
31
32
|
html,
|
|
33
|
+
isBoundsAware,
|
|
32
34
|
setAttr,
|
|
33
35
|
setClass
|
|
34
36
|
} from '@eclipse-glsp/sprotty';
|
|
@@ -91,6 +93,61 @@ export class GLSPProjectionView extends ProjectedViewportView {
|
|
|
91
93
|
return { ...position, ...size };
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
protected override renderProjections(model: Readonly<GViewportRootElement>, context: RenderingContext, args?: IViewArgs): VNode[] {
|
|
97
|
+
if (model.zoom <= 0) {
|
|
98
|
+
return [];
|
|
99
|
+
}
|
|
100
|
+
const modelBounds = this.getModelBounds(model);
|
|
101
|
+
if (!modelBounds) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
const projections = getProjections(model) ?? [];
|
|
105
|
+
return [
|
|
106
|
+
this.renderProjectionBar(projections, model, modelBounds, 'vertical'),
|
|
107
|
+
this.renderProjectionBar(projections, model, modelBounds, 'horizontal')
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Computes the total bounds that the projection bars map to, i.e. the union of the actual
|
|
113
|
+
* content bounds and the current viewport.
|
|
114
|
+
*
|
|
115
|
+
* This is a reimplementation of sprotty's `getModelBounds`, with two minor fixes
|
|
116
|
+
* - this intentionally derives the content bounds from the
|
|
117
|
+
* root's children instead of using {@link GViewportRootElement.bounds} directly.
|
|
118
|
+
* - We ignore bounds with invalid dimensions (e.g. from routable edges without bend points) to avoid pulling the
|
|
119
|
+
*/
|
|
120
|
+
protected getModelBounds(model: Readonly<GViewportRootElement>): Bounds | undefined {
|
|
121
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
122
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
123
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
124
|
+
let maxY = Number.NEGATIVE_INFINITY;
|
|
125
|
+
|
|
126
|
+
for (const element of model.children) {
|
|
127
|
+
if (isBoundsAware(element)) {
|
|
128
|
+
const b = element.bounds;
|
|
129
|
+
if (!Dimension.isValid(b)) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
minX = Math.min(minX, b.x);
|
|
133
|
+
minY = Math.min(minY, b.y);
|
|
134
|
+
maxX = Math.max(maxX, b.x + b.width);
|
|
135
|
+
maxY = Math.max(maxY, b.y + b.height);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// enlarge the bounds by the current viewport to ensure it always fits into the projection
|
|
140
|
+
minX = Math.min(minX, model.scroll.x);
|
|
141
|
+
minY = Math.min(minY, model.scroll.y);
|
|
142
|
+
maxX = Math.max(maxX, model.scroll.x + model.canvasBounds.width / model.zoom);
|
|
143
|
+
maxY = Math.max(maxY, model.scroll.y + model.canvasBounds.height / model.zoom);
|
|
144
|
+
|
|
145
|
+
if (minX < maxX && minY < maxY) {
|
|
146
|
+
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
|
147
|
+
}
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
|
|
94
151
|
protected override renderProjectionBar(
|
|
95
152
|
projections: ViewProjection[],
|
|
96
153
|
model: Readonly<GViewportRootElement>,
|