@eclipse-glsp/client 2.2.0-next.331 → 2.2.0-next.332
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/debug.css +25 -0
- package/css/grid.css +20 -0
- package/css/keyboard-tool-palette.css +0 -6
- package/css/tool-palette.css +30 -26
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.d.ts.map +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.js +21 -7
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.js.map +1 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-handler.d.ts +2 -4
- package/lib/features/accessibility/resize-key-tool/resize-key-handler.d.ts.map +1 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-handler.js +11 -7
- package/lib/features/accessibility/resize-key-tool/resize-key-handler.js.map +1 -1
- package/lib/features/accessibility/view-key-tools/movement-key-tool.d.ts +5 -6
- package/lib/features/accessibility/view-key-tools/movement-key-tool.d.ts.map +1 -1
- package/lib/features/accessibility/view-key-tools/movement-key-tool.js +12 -8
- package/lib/features/accessibility/view-key-tools/movement-key-tool.js.map +1 -1
- package/lib/features/change-bounds/snap.d.ts +1 -22
- package/lib/features/change-bounds/snap.d.ts.map +1 -1
- package/lib/features/change-bounds/snap.js +1 -37
- package/lib/features/change-bounds/snap.js.map +1 -1
- package/lib/features/debug/debug-bounds-decorator.d.ts +35 -0
- package/lib/features/debug/debug-bounds-decorator.d.ts.map +1 -0
- package/lib/features/debug/debug-bounds-decorator.js +149 -0
- package/lib/features/debug/debug-bounds-decorator.js.map +1 -0
- package/lib/features/debug/debug-manager.d.ts +29 -0
- package/lib/features/debug/debug-manager.d.ts.map +1 -0
- package/lib/features/debug/debug-manager.js +72 -0
- package/lib/features/debug/debug-manager.js.map +1 -0
- package/lib/features/debug/debug-model.d.ts +37 -0
- package/lib/features/debug/debug-model.d.ts.map +1 -0
- package/lib/features/debug/debug-model.js +73 -0
- package/lib/features/debug/debug-model.js.map +1 -0
- package/lib/features/debug/debug-module.d.ts +19 -0
- package/lib/features/debug/debug-module.d.ts.map +1 -0
- package/lib/features/debug/debug-module.js +31 -0
- package/lib/features/debug/debug-module.js.map +1 -0
- package/lib/features/debug/index.d.ts +20 -0
- package/lib/features/debug/index.d.ts.map +1 -0
- package/lib/features/debug/index.js +36 -0
- package/lib/features/debug/index.js.map +1 -0
- package/lib/features/grid/grid-manager.d.ts +32 -0
- package/lib/features/grid/grid-manager.d.ts.map +1 -0
- package/lib/features/grid/grid-manager.js +74 -0
- package/lib/features/grid/grid-manager.js.map +1 -0
- package/lib/features/grid/grid-model.d.ts +37 -0
- package/lib/features/grid/grid-model.d.ts.map +1 -0
- package/lib/features/grid/grid-model.js +73 -0
- package/lib/features/grid/grid-model.js.map +1 -0
- package/lib/features/grid/grid-module.d.ts +19 -0
- package/lib/features/grid/grid-module.d.ts.map +1 -0
- package/lib/features/grid/grid-module.js +32 -0
- package/lib/features/grid/grid-module.js.map +1 -0
- package/lib/features/grid/grid-snapper.d.ts +45 -0
- package/lib/features/grid/grid-snapper.d.ts.map +1 -0
- package/lib/features/grid/grid-snapper.js +83 -0
- package/lib/features/grid/grid-snapper.js.map +1 -0
- package/lib/features/grid/grid.d.ts +18 -0
- package/lib/features/grid/grid.d.ts.map +1 -0
- package/lib/features/grid/grid.js +3 -0
- package/lib/features/grid/grid.js.map +1 -0
- package/lib/features/grid/index.d.ts +21 -0
- package/lib/features/grid/index.d.ts.map +1 -0
- package/lib/features/grid/index.js +37 -0
- package/lib/features/grid/index.js.map +1 -0
- package/lib/features/helper-lines/helper-line-manager-default.d.ts +4 -1
- package/lib/features/helper-lines/helper-line-manager-default.d.ts.map +1 -1
- package/lib/features/helper-lines/helper-line-manager-default.js +11 -1
- package/lib/features/helper-lines/helper-line-manager-default.js.map +1 -1
- package/lib/features/index.d.ts +2 -0
- package/lib/features/index.d.ts.map +1 -1
- package/lib/features/index.js +2 -0
- package/lib/features/index.js.map +1 -1
- package/lib/features/tool-palette/tool-palette.d.ts +7 -0
- package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
- package/lib/features/tool-palette/tool-palette.js +80 -2
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/viewport/index.d.ts +1 -0
- package/lib/features/viewport/index.d.ts.map +1 -1
- package/lib/features/viewport/index.js +1 -0
- package/lib/features/viewport/index.js.map +1 -1
- package/lib/features/viewport/origin-viewport.d.ts +36 -0
- package/lib/features/viewport/origin-viewport.d.ts.map +1 -0
- package/lib/features/viewport/origin-viewport.js +75 -0
- package/lib/features/viewport/origin-viewport.js.map +1 -0
- package/lib/features/viewport/viewport-modules.d.ts.map +1 -1
- package/lib/features/viewport/viewport-modules.js +4 -2
- package/lib/features/viewport/viewport-modules.js.map +1 -1
- package/lib/views/base-view-module.d.ts.map +1 -1
- package/lib/views/base-view-module.js +3 -2
- package/lib/views/base-view-module.js.map +1 -1
- package/lib/views/ggraph-view.d.ts +26 -0
- package/lib/views/ggraph-view.d.ts.map +1 -0
- package/lib/views/ggraph-view.js +71 -0
- package/lib/views/ggraph-view.js.map +1 -0
- package/lib/views/glsp-projection-view.d.ts +6 -1
- package/lib/views/glsp-projection-view.d.ts.map +1 -1
- package/lib/views/glsp-projection-view.js +30 -6
- package/lib/views/glsp-projection-view.js.map +1 -1
- package/lib/views/index.d.ts +1 -0
- package/lib/views/index.d.ts.map +1 -1
- package/lib/views/index.js +1 -0
- package/lib/views/index.js.map +1 -1
- package/package.json +3 -3
- package/src/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.ts +24 -7
- package/src/features/accessibility/resize-key-tool/resize-key-handler.ts +9 -9
- package/src/features/accessibility/view-key-tools/movement-key-tool.ts +13 -11
- package/src/features/change-bounds/{snap.spec.ts → point-position-updater.spec.ts} +1 -12
- package/src/features/change-bounds/snap.ts +1 -24
- package/src/features/debug/debug-bounds-decorator.tsx +171 -0
- package/src/features/debug/debug-manager.ts +56 -0
- package/src/features/debug/debug-model.ts +63 -0
- package/src/features/debug/debug-module.ts +32 -0
- package/src/features/debug/index.ts +19 -0
- package/src/features/grid/grid-manager.ts +60 -0
- package/src/features/grid/grid-model.ts +62 -0
- package/src/features/grid/grid-module.ts +34 -0
- package/src/features/grid/grid-snapper.spec.ts +30 -0
- package/src/features/grid/grid-snapper.ts +59 -0
- package/src/features/grid/grid.ts +18 -0
- package/src/features/grid/index.ts +20 -0
- package/src/features/helper-lines/helper-line-manager-default.ts +10 -2
- package/src/features/index.ts +2 -0
- package/src/features/tool-palette/tool-palette.ts +80 -3
- package/src/features/viewport/index.ts +1 -0
- package/src/features/viewport/origin-viewport.ts +68 -0
- package/src/features/viewport/viewport-modules.ts +4 -2
- package/src/views/base-view-module.ts +3 -3
- package/src/views/ggraph-view.tsx +56 -0
- package/src/views/glsp-projection-view.tsx +34 -7
- package/src/views/index.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ggraph-view.js","sourceRoot":"","sources":["../../src/views/ggraph-view.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAA4H;AAC5H,yCAAyD;AAEzD,0CAAqD;AAG9C,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,oBAAU;IAG7B,MAAM,CAAC,KAA2B,EAAE,OAAyB;QAClE,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC3C,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACb,KAAK,CAAC,IAAI,CAAC,KAAK,mCAAQ,KAAK,CAAC,IAAI,CAAC,KAAK,GAAK,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAE,CAAC;QACrF,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAES,YAAY,CAAC,KAA2B,EAAE,OAAyB;;QACzE,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,WAA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AAyB,sBAAW;+CAAC;qBADnE,UAAU;IADtB,IAAA,sBAAU,GAAE;GACA,UAAU,CAkCtB"}
|
|
@@ -13,15 +13,20 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Bounds, EdgeRouterRegistry, GViewportRootElement, IViewArgs, ProjectedViewportView, ProjectionParams, RenderingContext, ViewProjection } from '@eclipse-glsp/sprotty';
|
|
16
|
+
import { Bounds, EdgeRouterRegistry, GViewportRootElement, IViewArgs, ProjectedViewportView, ProjectionParams, RenderingContext, SGraphImpl, ViewProjection, Writable } from '@eclipse-glsp/sprotty';
|
|
17
17
|
import { VNode } from 'snabbdom';
|
|
18
|
+
import { GridManager, GridStyle } from '../features';
|
|
18
19
|
/**
|
|
19
20
|
* Special viewport root view that renders horizontal and vertical projection bars for quick navigation.
|
|
20
21
|
*/
|
|
21
22
|
export declare class GLSPProjectionView extends ProjectedViewportView {
|
|
22
23
|
edgeRouterRegistry: EdgeRouterRegistry;
|
|
24
|
+
protected gridManager?: GridManager;
|
|
23
25
|
render(model: Readonly<GViewportRootElement>, context: RenderingContext, args?: IViewArgs): VNode;
|
|
24
26
|
protected renderSvg(model: Readonly<GViewportRootElement>, context: RenderingContext, args?: IViewArgs): VNode;
|
|
27
|
+
protected getGridStyle(model: Readonly<SGraphImpl>, context: RenderingContext): GridStyle;
|
|
28
|
+
protected getBackgroundBounds(viewport: Readonly<SGraphImpl>, context: RenderingContext, gridManager: GridManager): Writable<Bounds>;
|
|
29
|
+
protected getBackgroundImage(model: Readonly<SGraphImpl>, context: RenderingContext, gridManager: GridManager): string;
|
|
25
30
|
protected renderProjectionBar(projections: ViewProjection[], model: Readonly<GViewportRootElement>, modelBounds: Bounds, orientation: 'horizontal' | 'vertical'): VNode;
|
|
26
31
|
protected renderViewport(model: Readonly<GViewportRootElement>, params: ProjectionParams): VNode;
|
|
27
32
|
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;AAElF,OAAO,EACH,MAAM,
|
|
1
|
+
{"version":3,"file":"glsp-projection-view.d.ts","sourceRoot":"","sources":["../../src/views/glsp-projection-view.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EACH,MAAM,EAEN,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EAET,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EAEV,cAAc,EACd,QAAQ,EAIX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAiB,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKrD;;GAEG;AACH,qBACa,kBAAmB,SAAQ,qBAAqB;IAC7B,kBAAkB,EAAE,kBAAkB,CAAC;IAC3B,SAAS,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IAEnE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,KAAK;cAavF,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,KAAK;IAYvH,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,gBAAgB,GAAG,SAAS;IAazF,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC;IAMpI,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,GAAG,MAAM;cAKnG,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;cAoBW,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;CA+CX"}
|
|
@@ -28,6 +28,7 @@ exports.GLSPProjectionView = void 0;
|
|
|
28
28
|
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
29
29
|
const inversify_1 = require("inversify");
|
|
30
30
|
const snabbdom_1 = require("snabbdom");
|
|
31
|
+
const features_1 = require("../features");
|
|
31
32
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
33
|
const JSX = { createElement: sprotty_1.html };
|
|
33
34
|
/**
|
|
@@ -35,12 +36,8 @@ const JSX = { createElement: sprotty_1.html };
|
|
|
35
36
|
*/
|
|
36
37
|
let GLSPProjectionView = class GLSPProjectionView extends sprotty_1.ProjectedViewportView {
|
|
37
38
|
render(model, context, args) {
|
|
38
|
-
const svgElem = this.renderSvg(model, context, args);
|
|
39
|
-
if (svgElem.data) {
|
|
40
|
-
svgElem.data.class = { 'sprotty-graph': true };
|
|
41
|
-
}
|
|
42
39
|
const rootNode = (JSX.createElement("div", { "class-sprotty-graph": false, style: { width: '100%', height: '100%' } },
|
|
43
|
-
|
|
40
|
+
this.renderSvg(model, context, args),
|
|
44
41
|
this.renderProjections(model, context, args)));
|
|
45
42
|
(0, sprotty_1.setAttr)(rootNode, 'tabindex', 1);
|
|
46
43
|
(0, sprotty_1.setAttr)(rootNode, 'aria-label', 'Diagram');
|
|
@@ -50,9 +47,31 @@ let GLSPProjectionView = class GLSPProjectionView extends sprotty_1.ProjectedVie
|
|
|
50
47
|
const edgeRouting = this.edgeRouterRegistry.routeAllChildren(model);
|
|
51
48
|
const transform = `scale(${model.zoom}) translate(${-model.scroll.x},${-model.scroll.y})`;
|
|
52
49
|
const ns = 'http://www.w3.org/2000/svg';
|
|
53
|
-
const svg = (0, snabbdom_1.h)('svg', { ns, style: { height: '100%' } }, (0, snabbdom_1.h)('g', { ns, attrs: { transform } }, context.renderChildren(model, { edgeRouting })));
|
|
50
|
+
const svg = (0, snabbdom_1.h)('svg', { ns, style: Object.assign({ height: '100%' }, this.getGridStyle(model, context)), class: { 'sprotty-graph': true } }, (0, snabbdom_1.h)('g', { ns, attrs: { transform } }, context.renderChildren(model, { edgeRouting })));
|
|
54
51
|
return svg;
|
|
55
52
|
}
|
|
53
|
+
getGridStyle(model, context) {
|
|
54
|
+
var _a;
|
|
55
|
+
if (!((_a = this.gridManager) === null || _a === void 0 ? void 0 : _a.isGridVisible)) {
|
|
56
|
+
return {};
|
|
57
|
+
}
|
|
58
|
+
const bounds = this.getBackgroundBounds(model, context, this.gridManager);
|
|
59
|
+
return {
|
|
60
|
+
backgroundPosition: `${bounds.x}px ${bounds.y}px`,
|
|
61
|
+
backgroundSize: `${bounds.width}px ${bounds.height}px`,
|
|
62
|
+
// we do not set the background image directly in the style object, because we want to toggle it on and off via CSS
|
|
63
|
+
'--grid-background-image': this.getBackgroundImage(model, context, this.gridManager)
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
getBackgroundBounds(viewport, context, gridManager) {
|
|
67
|
+
const position = sprotty_1.Point.multiplyScalar(sprotty_1.Point.subtract(gridManager.grid, viewport.scroll), viewport.zoom);
|
|
68
|
+
const size = sprotty_1.Dimension.fromPoint(sprotty_1.Point.multiplyScalar(gridManager.grid, viewport.zoom));
|
|
69
|
+
return Object.assign(Object.assign({}, position), size);
|
|
70
|
+
}
|
|
71
|
+
getBackgroundImage(model, context, gridManager) {
|
|
72
|
+
// eslint-disable-next-line max-len
|
|
73
|
+
return `url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${gridManager.grid.x} ${gridManager.grid.y}"><rect width="${gridManager.grid.x}" height="${gridManager.grid.y}" x="0" y="0" fill="none" stroke="black" stroke-width="1" stroke-opacity="0.10" /></svg>')`;
|
|
74
|
+
}
|
|
56
75
|
renderProjectionBar(projections, model, modelBounds, orientation) {
|
|
57
76
|
const params = { modelBounds, orientation };
|
|
58
77
|
// NOTE: Here we assume that the projection bars have the same size as the diagram canvas,
|
|
@@ -151,6 +170,11 @@ __decorate([
|
|
|
151
170
|
(0, inversify_1.inject)(sprotty_1.EdgeRouterRegistry),
|
|
152
171
|
__metadata("design:type", sprotty_1.EdgeRouterRegistry)
|
|
153
172
|
], GLSPProjectionView.prototype, "edgeRouterRegistry", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
(0, inversify_1.inject)(sprotty_1.TYPES.IGridManager),
|
|
175
|
+
(0, inversify_1.optional)(),
|
|
176
|
+
__metadata("design:type", features_1.GridManager)
|
|
177
|
+
], GLSPProjectionView.prototype, "gridManager", void 0);
|
|
154
178
|
exports.GLSPProjectionView = GLSPProjectionView = __decorate([
|
|
155
179
|
(0, inversify_1.injectable)()
|
|
156
180
|
], GLSPProjectionView);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-projection-view.js","sourceRoot":"","sources":["../../src/views/glsp-projection-view.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,
|
|
1
|
+
{"version":3,"file":"glsp-projection-view.js","sourceRoot":"","sources":["../../src/views/glsp-projection-view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G,OAAO,IAAI;gBACpB,KAAK,EAAE,GAAG,QAAQ,IAAI;gBACtB,MAAM,EAAE,KAAK;aAChB;YACH,CAAC,CAAC;gBACI,GAAG,EAAE,GAAG,OAAO,IAAI;gBACnB,MAAM,EAAE,GAAG,QAAQ,IAAI;gBACvB,KAAK,EAAE,KAAK;aACf,CAAC;QACZ,MAAM,MAAM,GAAG,CACX,2BACI,EAAE,EAAE,GAAG,MAAM,CAAC,WAAW,eAAe,UAAU,CAAC,SAAS,EAAE,8BACpC,IAAI,2BACP,IAAI,EAC3B,KAAK,EAAE,KAAK,GACd,CACL,CAAC;QACF,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,IAAA,kBAAQ,EAAC,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QAChE,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AAvKY,gDAAkB;AACC;IAA3B,IAAA,kBAAM,EAAC,4BAAkB,CAAC;8BAAqB,4BAAkB;8DAAC;AACjB;IAAjD,IAAA,kBAAM,EAAC,eAAK,CAAC,YAAY,CAAC;IAAE,IAAA,oBAAQ,GAAE;8BAAyB,sBAAW;uDAAC;6BAFnE,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CAuK9B"}
|
package/lib/views/index.d.ts
CHANGED
package/lib/views/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/views/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/views/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC"}
|
package/lib/views/index.js
CHANGED
|
@@ -32,6 +32,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
__exportStar(require("./base-view-module"), exports);
|
|
33
33
|
__exportStar(require("./compartments"), exports);
|
|
34
34
|
__exportStar(require("./gedge-view"), exports);
|
|
35
|
+
__exportStar(require("./ggraph-view"), exports);
|
|
35
36
|
__exportStar(require("./glsp-projection-view"), exports);
|
|
36
37
|
__exportStar(require("./issue-marker-view"), exports);
|
|
37
38
|
__exportStar(require("./rounded-corner"), exports);
|
package/lib/views/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/views/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAmC;AACnC,iDAA+B;AAC/B,+CAA6B;AAC7B,yDAAuC;AACvC,sDAAoC;AACpC,mDAAiC;AACjC,wDAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/views/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAmC;AACnC,iDAA+B;AAC/B,+CAA6B;AAC7B,gDAA8B;AAC9B,yDAAuC;AACvC,sDAAoC;AACpC,mDAAiC;AACjC,wDAAsC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/client",
|
|
3
|
-
"version": "2.2.0-next.
|
|
3
|
+
"version": "2.2.0-next.332+ca7c9ae",
|
|
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.
|
|
49
|
+
"@eclipse-glsp/sprotty": "2.2.0-next.332+ca7c9ae",
|
|
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": "
|
|
64
|
+
"gitHead": "ca7c9aecfaa198b8ceed3bf488abfc3d3d552e07"
|
|
65
65
|
}
|
|
@@ -44,7 +44,7 @@ import * as messages from '../toast/messages.json';
|
|
|
44
44
|
import { ShowToastMessageAction } from '../toast/toast-handler';
|
|
45
45
|
|
|
46
46
|
const SEARCH_ICON_ID = 'search';
|
|
47
|
-
const PALETTE_ICON_ID = '
|
|
47
|
+
const PALETTE_ICON_ID = 'tools';
|
|
48
48
|
const CHEVRON_DOWN_ICON_ID = 'chevron-right';
|
|
49
49
|
const PALETTE_HEIGHT = '500px';
|
|
50
50
|
const SELECTION_TOOL_KEY: KeyCode[] = ['Digit1', 'Numpad1'];
|
|
@@ -212,29 +212,46 @@ export class KeyboardToolPalette extends ToolPalette {
|
|
|
212
212
|
|
|
213
213
|
protected override createHeaderTools(): HTMLElement {
|
|
214
214
|
this.headerToolsButtonMapping.clear();
|
|
215
|
+
let mappingIndex = 0;
|
|
215
216
|
|
|
216
217
|
const headerTools = document.createElement('div');
|
|
217
218
|
headerTools.classList.add('header-tools');
|
|
218
219
|
|
|
219
220
|
this.defaultToolsButton = this.createDefaultToolButton();
|
|
220
|
-
this.headerToolsButtonMapping.set(
|
|
221
|
+
this.headerToolsButtonMapping.set(mappingIndex++, this.defaultToolsButton);
|
|
221
222
|
headerTools.appendChild(this.defaultToolsButton);
|
|
222
223
|
|
|
223
224
|
this.deleteToolButton = this.createMouseDeleteToolButton();
|
|
224
|
-
this.headerToolsButtonMapping.set(
|
|
225
|
+
this.headerToolsButtonMapping.set(mappingIndex++, this.deleteToolButton);
|
|
225
226
|
headerTools.appendChild(this.deleteToolButton);
|
|
226
227
|
|
|
227
228
|
this.marqueeToolButton = this.createMarqueeToolButton();
|
|
228
|
-
this.headerToolsButtonMapping.set(
|
|
229
|
+
this.headerToolsButtonMapping.set(mappingIndex++, this.marqueeToolButton);
|
|
229
230
|
headerTools.appendChild(this.marqueeToolButton);
|
|
230
231
|
|
|
231
232
|
this.validateToolButton = this.createValidateButton();
|
|
232
|
-
this.headerToolsButtonMapping.set(
|
|
233
|
+
this.headerToolsButtonMapping.set(mappingIndex++, this.validateToolButton);
|
|
233
234
|
headerTools.appendChild(this.validateToolButton);
|
|
234
235
|
|
|
236
|
+
const resetViewportButton = this.createResetViewportButton();
|
|
237
|
+
this.headerToolsButtonMapping.set(mappingIndex++, resetViewportButton);
|
|
238
|
+
headerTools.appendChild(resetViewportButton);
|
|
239
|
+
|
|
240
|
+
if (this.gridManager) {
|
|
241
|
+
const toggleGridButton = this.createToggleGridButton();
|
|
242
|
+
this.headerToolsButtonMapping.set(mappingIndex++, toggleGridButton);
|
|
243
|
+
headerTools.appendChild(toggleGridButton);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (this.debugManager) {
|
|
247
|
+
const toggleDebugButton = this.createToggleDebugButton();
|
|
248
|
+
this.headerToolsButtonMapping.set(mappingIndex++, toggleDebugButton);
|
|
249
|
+
headerTools.appendChild(toggleDebugButton);
|
|
250
|
+
}
|
|
251
|
+
|
|
235
252
|
// Create button for Search
|
|
236
253
|
this.searchToolButton = this.createSearchButton();
|
|
237
|
-
this.headerToolsButtonMapping.set(
|
|
254
|
+
this.headerToolsButtonMapping.set(mappingIndex++, this.searchToolButton);
|
|
238
255
|
headerTools.appendChild(this.searchToolButton);
|
|
239
256
|
|
|
240
257
|
return headerTools;
|
|
@@ -324,7 +341,7 @@ export class KeyboardToolPalette extends ToolPalette {
|
|
|
324
341
|
searchField.tabIndex = 21;
|
|
325
342
|
searchField.id = this.containerElement.id + '_search_field';
|
|
326
343
|
searchField.type = 'text';
|
|
327
|
-
searchField.placeholder = '
|
|
344
|
+
searchField.placeholder = 'Search...';
|
|
328
345
|
searchField.style.display = 'none';
|
|
329
346
|
searchField.onkeyup = ev => {
|
|
330
347
|
this.requestFilterUpdate(this.searchField.value);
|
|
@@ -36,7 +36,7 @@ import { EditorContextService } from '../../../base/editor-context-service';
|
|
|
36
36
|
import { IFeedbackActionDispatcher } from '../../../base/feedback/feedback-action-dispatcher';
|
|
37
37
|
import { Resizable, SelectableBoundsAware, getElements, isSelectableAndBoundsAware, toElementAndBounds } from '../../../utils/gmodel-util';
|
|
38
38
|
import { isValidMove, isValidSize, minHeight, minWidth } from '../../../utils/layout-utils';
|
|
39
|
-
import {
|
|
39
|
+
import { Grid } from '../../grid';
|
|
40
40
|
|
|
41
41
|
export enum ResizeType {
|
|
42
42
|
Increase,
|
|
@@ -80,20 +80,20 @@ export class ResizeElementHandler implements IActionHandler {
|
|
|
80
80
|
protected debouncedChangeBounds?: DebouncedFunc<() => void>;
|
|
81
81
|
protected resizeFeedback: FeedbackEmitter;
|
|
82
82
|
|
|
83
|
-
// Default x resize used if
|
|
83
|
+
// Default x resize used if grid is not provided
|
|
84
84
|
static readonly defaultResizeX = 20;
|
|
85
85
|
|
|
86
|
-
// Default y resize used if
|
|
86
|
+
// Default y resize used if grid is not provided
|
|
87
87
|
static readonly defaultResizeY = 20;
|
|
88
|
-
|
|
88
|
+
|
|
89
|
+
@inject(TYPES.Grid) @optional() protected grid: Grid = {
|
|
90
|
+
x: ResizeElementHandler.defaultResizeX,
|
|
91
|
+
y: ResizeElementHandler.defaultResizeY
|
|
92
|
+
};
|
|
89
93
|
|
|
90
94
|
protected isEditMode = false;
|
|
91
95
|
|
|
92
|
-
constructor(@inject(TYPES.ISnapper) @optional() protected readonly snapper?: ISnapper) {
|
|
93
|
-
if (snapper instanceof GridSnapper) {
|
|
94
|
-
this.grid = snapper.grid;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
96
|
+
constructor(@inject(TYPES.ISnapper) @optional() protected readonly snapper?: ISnapper) {}
|
|
97
97
|
|
|
98
98
|
@postConstruct()
|
|
99
99
|
protected init(): void {
|
|
@@ -20,7 +20,8 @@ import { matchesKeystroke } from 'sprotty/lib/utils/keyboard';
|
|
|
20
20
|
import { GLSPActionDispatcher } from '../../../base/action-dispatcher';
|
|
21
21
|
import { SelectionService } from '../../../base/selection-service';
|
|
22
22
|
import { Tool } from '../../../base/tool-manager/tool';
|
|
23
|
-
import {
|
|
23
|
+
import { unsnapModifier, useSnap } from '../../change-bounds/snap';
|
|
24
|
+
import { Grid } from '../../grid';
|
|
24
25
|
import { AccessibleKeyShortcutProvider, SetAccessibleKeyShortcutAction } from '../key-shortcut/accessible-key-shortcut';
|
|
25
26
|
import { MoveElementAction, MoveViewportAction } from '../move-zoom/move-handler';
|
|
26
27
|
|
|
@@ -33,18 +34,22 @@ export class MovementKeyTool implements Tool {
|
|
|
33
34
|
|
|
34
35
|
isEditTool = true;
|
|
35
36
|
|
|
36
|
-
protected
|
|
37
|
+
protected movementKeyListener: MoveKeyListener;
|
|
37
38
|
|
|
38
39
|
@inject(KeyTool) protected readonly keytool: KeyTool;
|
|
39
40
|
@inject(SelectionService) selectionService: SelectionService;
|
|
40
41
|
@inject(TYPES.ISnapper) @optional() readonly snapper?: ISnapper;
|
|
41
42
|
@inject(TYPES.IActionDispatcher) readonly actionDispatcher: GLSPActionDispatcher;
|
|
43
|
+
@optional() @inject(TYPES.Grid) protected grid: Grid;
|
|
42
44
|
|
|
43
45
|
get id(): string {
|
|
44
46
|
return MovementKeyTool.ID;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
enable(): void {
|
|
50
|
+
if (!this.movementKeyListener) {
|
|
51
|
+
this.movementKeyListener = new MoveKeyListener(this, this.grid);
|
|
52
|
+
}
|
|
48
53
|
this.keytool.register(this.movementKeyListener);
|
|
49
54
|
this.movementKeyListener.registerShortcutKey();
|
|
50
55
|
}
|
|
@@ -55,22 +60,19 @@ export class MovementKeyTool implements Tool {
|
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
export class MoveKeyListener extends KeyListener implements AccessibleKeyShortcutProvider {
|
|
58
|
-
// Default x distance used if
|
|
63
|
+
// Default x distance used if grid is not provided
|
|
59
64
|
static readonly defaultMoveX = 20;
|
|
60
65
|
|
|
61
|
-
// Default y distance used if
|
|
66
|
+
// Default y distance used if grid is not provided
|
|
62
67
|
static readonly defaultMoveY = 20;
|
|
63
68
|
|
|
64
69
|
protected readonly token = MoveKeyListener.name;
|
|
65
70
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
constructor(
|
|
72
|
+
protected readonly tool: MovementKeyTool,
|
|
73
|
+
protected grid: Grid = { x: MoveKeyListener.defaultMoveX, y: MoveKeyListener.defaultMoveY }
|
|
74
|
+
) {
|
|
69
75
|
super();
|
|
70
|
-
|
|
71
|
-
if (this.tool.snapper instanceof GridSnapper) {
|
|
72
|
-
this.grid = this.tool.snapper.grid;
|
|
73
|
-
}
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
registerShortcutKey(): void {
|
|
@@ -16,19 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
import { GModelElement } from '@eclipse-glsp/sprotty';
|
|
18
18
|
import { expect } from 'chai';
|
|
19
|
+
import { GridSnapper } from '../grid';
|
|
19
20
|
import { PointPositionUpdater } from './point-position-updater';
|
|
20
|
-
import { GridSnapper } from './snap';
|
|
21
|
-
|
|
22
|
-
describe('GridSnapper', () => {
|
|
23
|
-
it('snap', () => {
|
|
24
|
-
const element = new GModelElement();
|
|
25
|
-
const snapper = new GridSnapper();
|
|
26
|
-
expect(snapper.snap({ x: 0, y: 0 }, element)).to.be.deep.equals({ x: 0, y: 0 });
|
|
27
|
-
expect(snapper.snap({ x: 4, y: 5 }, element)).to.be.deep.equals({ x: 0, y: 10 });
|
|
28
|
-
expect(snapper.snap({ x: 8, y: 11 }, element)).to.be.deep.equals({ x: 10, y: 10 });
|
|
29
|
-
expect(snapper.snap({ x: -7, y: -4 }, element)).to.be.deep.equals({ x: -10, y: -0 });
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
21
|
|
|
33
22
|
describe('PointPositionUpdater', () => {
|
|
34
23
|
it('updatePosition with no last drag position', () => {
|
|
@@ -14,30 +14,7 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
17
|
-
import {
|
|
18
|
-
import { injectable } from 'inversify';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* A {@link ISnapper} implementation that snaps all elements onto a fixed gride size.
|
|
22
|
-
* The default grid size is 10x10 pixel.
|
|
23
|
-
* To configure a custom grid size bind the `TYPES.ISnapper` service identifier
|
|
24
|
-
* to constant value, e.g:
|
|
25
|
-
*
|
|
26
|
-
* ```ts
|
|
27
|
-
* bind(TYPES.ISnapper).toConstantValue(new GridSnapper({x:25 ,y:25 }));
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
@injectable()
|
|
31
|
-
export class GridSnapper implements ISnapper {
|
|
32
|
-
constructor(public grid: { x: number; y: number } = { x: 10, y: 10 }) {}
|
|
33
|
-
|
|
34
|
-
snap(position: Point, _element: GModelElement): Point {
|
|
35
|
-
return {
|
|
36
|
-
x: Math.round(position.x / this.grid.x) * this.grid.x,
|
|
37
|
-
y: Math.round(position.y / this.grid.y) * this.grid.y
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
17
|
+
import { KeyboardModifier } from '@eclipse-glsp/sprotty';
|
|
41
18
|
|
|
42
19
|
export function useSnap(event: MouseEvent | KeyboardEvent): boolean {
|
|
43
20
|
return !event.shiftKey;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2024 Axon Ivy AG and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
/* eslint-disable max-len */
|
|
17
|
+
|
|
18
|
+
import { Bounds, GModelElement, IVNodePostprocessor, Point, TYPES, isBoundsAware, setClass, svg } from '@eclipse-glsp/sprotty';
|
|
19
|
+
import { inject, injectable, optional } from 'inversify';
|
|
20
|
+
import { VNode } from 'snabbdom';
|
|
21
|
+
import { GGraph } from '../../model';
|
|
22
|
+
import { BoundsAwareModelElement } from '../../utils';
|
|
23
|
+
import { DebugManager } from './debug-manager';
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
|
+
const JSX = { createElement: svg };
|
|
27
|
+
|
|
28
|
+
@injectable()
|
|
29
|
+
export class DebugBoundsDecorator implements IVNodePostprocessor {
|
|
30
|
+
@inject(TYPES.IDebugManager) @optional() protected debugManager?: DebugManager;
|
|
31
|
+
|
|
32
|
+
decorate(vnode: VNode, element: GModelElement): VNode {
|
|
33
|
+
if (!this.debugManager?.isDebugEnabled) {
|
|
34
|
+
return vnode;
|
|
35
|
+
}
|
|
36
|
+
if (isBoundsAware(element)) {
|
|
37
|
+
this.decorateBoundsAware(vnode, element);
|
|
38
|
+
}
|
|
39
|
+
if (element instanceof GGraph) {
|
|
40
|
+
this.decorateGraph(vnode, element);
|
|
41
|
+
}
|
|
42
|
+
return vnode;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
postUpdate(): void {}
|
|
46
|
+
|
|
47
|
+
protected get decorationSize(): number {
|
|
48
|
+
return 5;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
protected decorateGraph(vnode: VNode, graph: GGraph): void {
|
|
52
|
+
setClass(vnode, 'debug-bounds', true);
|
|
53
|
+
const svgChild = vnode.children?.find(child => typeof child !== 'string' && child.sel === 'svg') as VNode | undefined;
|
|
54
|
+
const group = svgChild?.children?.find(child => typeof child !== 'string' && child.sel === 'g') as VNode | undefined;
|
|
55
|
+
group?.children?.push(this.renderOrigin(graph));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
protected renderOrigin(graph: GGraph): VNode {
|
|
59
|
+
return (
|
|
60
|
+
<polyline
|
|
61
|
+
class-debug-bounds-decoration={true}
|
|
62
|
+
class-debug-bounds-origin={true}
|
|
63
|
+
points={`0,${this.decorationSize} 0,0 ${this.decorationSize},0`}
|
|
64
|
+
>
|
|
65
|
+
<title>Origin = x: 0, y: 0</title>
|
|
66
|
+
</polyline>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
protected decorateBoundsAware(vnode: VNode, element: BoundsAwareModelElement): void {
|
|
71
|
+
setClass(vnode, 'debug-bounds', true);
|
|
72
|
+
vnode.children?.push(this.renderTopLeftCorner(element));
|
|
73
|
+
vnode.children?.push(this.renderTopRightCorner(element));
|
|
74
|
+
vnode.children?.push(this.renderBottomLeftCorner(element));
|
|
75
|
+
vnode.children?.push(this.renderBottomRightCorner(element));
|
|
76
|
+
vnode.children?.push(this.renderCenter(element));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
protected renderTopLeftCorner(element: BoundsAwareModelElement): VNode {
|
|
80
|
+
const position = Bounds.topLeft(element.bounds);
|
|
81
|
+
const topLeft = Bounds.topLeft(element.bounds);
|
|
82
|
+
const corner = Point.subtract(topLeft, position);
|
|
83
|
+
return (
|
|
84
|
+
<polyline
|
|
85
|
+
class-debug-bounds-decoration={true}
|
|
86
|
+
class-debug-bounds-top-left={true}
|
|
87
|
+
points={`${corner.x},${corner.y + this.decorationSize} ${corner.x},${corner.y} ${corner.x + this.decorationSize},${corner.y}`}
|
|
88
|
+
>
|
|
89
|
+
<title>
|
|
90
|
+
Top Left = x: {topLeft.x}, y: {topLeft.y}
|
|
91
|
+
</title>
|
|
92
|
+
</polyline>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
protected renderTopRightCorner(element: BoundsAwareModelElement): VNode {
|
|
97
|
+
const position = Bounds.topLeft(element.bounds);
|
|
98
|
+
const topRight = Bounds.topRight(element.bounds);
|
|
99
|
+
const corner = Point.subtract(topRight, position);
|
|
100
|
+
return (
|
|
101
|
+
<polyline
|
|
102
|
+
class-debug-bounds-decoration={true}
|
|
103
|
+
class-debug-bounds-top-right={true}
|
|
104
|
+
points={`${corner.x - this.decorationSize},${corner.y} ${corner.x},${corner.y} ${corner.x},${corner.y + this.decorationSize}`}
|
|
105
|
+
>
|
|
106
|
+
<title>
|
|
107
|
+
Top Right = x: {topRight.x}, y: {topRight.y}
|
|
108
|
+
</title>
|
|
109
|
+
</polyline>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
protected renderBottomLeftCorner(element: BoundsAwareModelElement): VNode {
|
|
114
|
+
const position = Bounds.topLeft(element.bounds);
|
|
115
|
+
const bottomLeft = Bounds.bottomLeft(element.bounds);
|
|
116
|
+
const corner = Point.subtract(bottomLeft, position);
|
|
117
|
+
return (
|
|
118
|
+
<polyline
|
|
119
|
+
class-debug-bounds-decoration={true}
|
|
120
|
+
class-debug-bounds-bottom-left={true}
|
|
121
|
+
points={`${corner.x},${corner.y - this.decorationSize} ${corner.x},${corner.y} ${corner.x + this.decorationSize},${corner.y}`}
|
|
122
|
+
>
|
|
123
|
+
<title>
|
|
124
|
+
Bottom Left = x: {bottomLeft.x}, y: {bottomLeft.y}
|
|
125
|
+
</title>
|
|
126
|
+
</polyline>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
protected renderBottomRightCorner(element: BoundsAwareModelElement): VNode {
|
|
131
|
+
const position = Bounds.topLeft(element.bounds);
|
|
132
|
+
const bottomRight = Bounds.bottomRight(element.bounds);
|
|
133
|
+
const corner = Point.subtract(bottomRight, position);
|
|
134
|
+
return (
|
|
135
|
+
<polyline
|
|
136
|
+
class-debug-bounds-decoration={true}
|
|
137
|
+
class-debug-bounds-bottom-right={true}
|
|
138
|
+
points={`${corner.x - this.decorationSize},${corner.y} ${corner.x},${corner.y} ${corner.x},${corner.y - this.decorationSize}`}
|
|
139
|
+
>
|
|
140
|
+
<title>
|
|
141
|
+
Bottom Right = x: {bottomRight.x}, y: {bottomRight.y}
|
|
142
|
+
</title>
|
|
143
|
+
</polyline>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
protected renderCenter(element: BoundsAwareModelElement): VNode {
|
|
148
|
+
const bounds = element.bounds;
|
|
149
|
+
const position = Bounds.topLeft(bounds);
|
|
150
|
+
const center = Bounds.center(bounds);
|
|
151
|
+
const corner = Point.subtract(center, position);
|
|
152
|
+
return (
|
|
153
|
+
<g>
|
|
154
|
+
<title>
|
|
155
|
+
Center = x: {center.x}, y: {center.y}
|
|
156
|
+

Bounds = x: {bounds.x}, y: {bounds.y}, width: {bounds.width}, height: {bounds.height}
|
|
157
|
+
</title>
|
|
158
|
+
<polyline
|
|
159
|
+
class-debug-bounds-decoration={true}
|
|
160
|
+
class-debug-bounds-center={true}
|
|
161
|
+
points={`${corner.x - this.decorationSize / 2},${corner.y - this.decorationSize / 2} ${corner.x + this.decorationSize / 2},${corner.y + this.decorationSize / 2}`}
|
|
162
|
+
></polyline>
|
|
163
|
+
<polyline
|
|
164
|
+
class-debug-bounds-decoration={true}
|
|
165
|
+
class-debug-bounds-center={true}
|
|
166
|
+
points={`${corner.x + this.decorationSize / 2},${corner.y - this.decorationSize / 2} ${corner.x - this.decorationSize / 2},${corner.y + this.decorationSize / 2}`}
|
|
167
|
+
></polyline>
|
|
168
|
+
</g>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2024 Axon Ivy AG and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
import { IActionHandler, TYPES } from '@eclipse-glsp/sprotty';
|
|
18
|
+
import { inject, injectable, postConstruct } from 'inversify';
|
|
19
|
+
import { FeedbackEmitter, IFeedbackActionDispatcher } from '../../base';
|
|
20
|
+
import { EnableDebugModeAction } from './debug-model';
|
|
21
|
+
|
|
22
|
+
@injectable()
|
|
23
|
+
export class DebugManager implements IActionHandler {
|
|
24
|
+
protected _debugEnabled: boolean = false;
|
|
25
|
+
protected debugFeedback: FeedbackEmitter;
|
|
26
|
+
|
|
27
|
+
@inject(TYPES.IFeedbackActionDispatcher)
|
|
28
|
+
protected feedbackDispatcher: IFeedbackActionDispatcher;
|
|
29
|
+
|
|
30
|
+
get isDebugEnabled(): boolean {
|
|
31
|
+
return this._debugEnabled;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
handle(action: EnableDebugModeAction): void {
|
|
35
|
+
this._debugEnabled = action.enable;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@postConstruct()
|
|
39
|
+
protected init(): void {
|
|
40
|
+
this.debugFeedback = this.feedbackDispatcher.createEmitter();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
setDebugEnabled(visible: boolean): void {
|
|
44
|
+
if (!visible) {
|
|
45
|
+
this.debugFeedback.dispose();
|
|
46
|
+
} else {
|
|
47
|
+
this.debugFeedback
|
|
48
|
+
.add(EnableDebugModeAction.create({ enable: true }), EnableDebugModeAction.create({ enable: false }))
|
|
49
|
+
.submit();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
toggleDebugEnabled(): void {
|
|
54
|
+
this.setDebugEnabled(!this._debugEnabled);
|
|
55
|
+
}
|
|
56
|
+
}
|