@eclipse-glsp/client 2.2.0-next.331 → 2.2.0-next.333
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/base/model/diagram-loader.d.ts.map +1 -1
- package/lib/base/model/diagram-loader.js +6 -1
- package/lib/base/model/diagram-loader.js.map +1 -1
- 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-handler.d.ts +6 -4
- package/lib/features/viewport/viewport-handler.d.ts.map +1 -1
- package/lib/features/viewport/viewport-handler.js +13 -8
- package/lib/features/viewport/viewport-handler.js.map +1 -1
- 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/base/model/diagram-loader.ts +5 -1
- 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-handler.ts +13 -7
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport-modules.js","sourceRoot":"","sources":["../../../src/features/viewport/viewport-modules.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAY+B;AAC/B,uDAA2F;AAC3F,6EAAuE;AACvE,
|
|
1
|
+
{"version":3,"file":"viewport-modules.js","sourceRoot":"","sources":["../../../src/features/viewport/viewport-modules.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAY+B;AAC/B,uDAA2F;AAC3F,sDAA0D;AAC1D,6EAAuE;AACvE,uDAA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E,OAAO,EAAE,OAAO,EAAE,EAAE;IACvB,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAClC,IAAA,uBAAa,EAAC,OAAO,EAAE,eAAK,CAAC,WAAW,EAAE,gCAAsB,CAAC,CAAC;AACtE,CAAC,EACD,EAAE,QAAQ,EAAE,sBAAc,EAAE,CAC/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-view-module.d.ts","sourceRoot":"","sources":["../../src/views/base-view-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,cAAc,EAOd,aAAa,
|
|
1
|
+
{"version":3,"file":"base-view-module.d.ts","sourceRoot":"","sources":["../../src/views/base-view-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,cAAc,EAOd,aAAa,EAwBhB,MAAM,uBAAuB,CAAC;AAQ/B,eAAO,MAAM,cAAc,eAGzB,CAAC;AAEH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,IAAI,CAiCrG"}
|
|
@@ -18,10 +18,11 @@ exports.configureDefaultModelElements = exports.baseViewModule = void 0;
|
|
|
18
18
|
********************************************************************************/
|
|
19
19
|
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
20
20
|
const issue_marker_1 = require("../features/validation/issue-marker");
|
|
21
|
+
const model_1 = require("../model");
|
|
21
22
|
const gedge_view_1 = require("./gedge-view");
|
|
23
|
+
const ggraph_view_1 = require("./ggraph-view");
|
|
22
24
|
const issue_marker_view_1 = require("./issue-marker-view");
|
|
23
25
|
const rounded_corner_view_1 = require("./rounded-corner-view");
|
|
24
|
-
const model_1 = require("../model");
|
|
25
26
|
exports.baseViewModule = new sprotty_1.FeatureModule((bind, unbind, isBound, rebind) => {
|
|
26
27
|
const context = { bind, unbind, isBound, rebind };
|
|
27
28
|
configureDefaultModelElements(context);
|
|
@@ -38,7 +39,7 @@ function configureDefaultModelElements(context) {
|
|
|
38
39
|
// SVG elements
|
|
39
40
|
(0, sprotty_1.configureModelElement)(context, sprotty_1.DefaultTypes.SVG, sprotty_1.GViewportRootElement, sprotty_1.SvgViewportView);
|
|
40
41
|
// graph elements
|
|
41
|
-
(0, sprotty_1.configureModelElement)(context, sprotty_1.DefaultTypes.GRAPH, model_1.GGraph,
|
|
42
|
+
(0, sprotty_1.configureModelElement)(context, sprotty_1.DefaultTypes.GRAPH, model_1.GGraph, ggraph_view_1.GGraphView);
|
|
42
43
|
(0, sprotty_1.configureModelElement)(context, sprotty_1.DefaultTypes.NODE, sprotty_1.GNode, rounded_corner_view_1.RoundedCornerNodeView);
|
|
43
44
|
(0, sprotty_1.configureModelElement)(context, sprotty_1.DefaultTypes.COMPARTMENT, sprotty_1.GCompartment, sprotty_1.GCompartmentView);
|
|
44
45
|
(0, sprotty_1.configureModelElement)(context, sprotty_1.DefaultTypes.COMPARTMENT_HEADER, sprotty_1.GCompartment, sprotty_1.GCompartmentView);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-view-module.js","sourceRoot":"","sources":["../../src/views/base-view-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"base-view-module.js","sourceRoot":"","sources":["../../src/views/base-view-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAgC+B;AAC/B,sEAAmE;AACnE,oCAAyC;AACzC,6CAAyC;AACzC,+CAA2C;AAC3C,2DAAuD;AACvD,+DAA8D;AAEjD,QAAA,cAAc,GAAG,IAAI,uBAAa,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9E,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClD,6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AC,IAAI,EAAE,eAAK,EAAE,6BAAmB,CAAC,CAAC;IAC9E,IAAA,+BAAqB,EAAC,OAAO,EAAE,sBAAY,CAAC,aAAa,EAAE,wBAAc,EAAE,4BAAkB,CAAC,CAAC;IAC/F,IAAA,+BAAqB,EAAC,OAAO,EAAE,sBAAY,CAAC,sBAAsB,EAAE,wBAAc,EAAE,4BAAkB,CAAC,CAAC;IACxG,IAAA,+BAAqB,EAAC,OAAO,EAAE,sBAAY,CAAC,KAAK,EAAE,gBAAM,EAAE,oBAAU,CAAC,CAAC;IAEvE,cAAc;IACd,IAAA,+BAAqB,EAAC,OAAO,EAAE,sBAAY,CAAC,aAAa,EAAE,iBAAO,EAAE,0BAAgB,CAAC,CAAC;IACtF,IAAA,+BAAqB,EAAC,OAAO,EAAE,sBAAY,CAAC,YAAY,EAAE,2BAAY,EAAE,oCAAgB,CAAC,CAAC;IAE1F,SAAS;IACT,IAAA,+BAAqB,EAAC,OAAO,EAAE,sBAAY,CAAC,WAAW,EAAE,sBAAY,EAAE,0BAAgB,CAAC,CAAC;IACzF,IAAA,+BAAqB,EAAC,OAAO,EAAE,sBAAY,CAAC,YAAY,EAAE,qBAAW,EAAE,yBAAe,CAAC,CAAC;IACxF,IAAA,+BAAqB,EAAC,OAAO,EAAE,sBAAY,CAAC,cAAc,EAAE,yBAAe,EAAE,6BAAmB,CAAC,CAAC;AACtG,CAAC;AAjCD,sEAiCC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2024 EclipseSource 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
|
+
import { Bounds, RenderingContext, SGraphImpl, SGraphView, Writable } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { VNode } from 'snabbdom';
|
|
18
|
+
import { GridManager, GridStyle } from '../features';
|
|
19
|
+
export declare class GGraphView extends SGraphView {
|
|
20
|
+
protected gridManager?: GridManager;
|
|
21
|
+
render(model: Readonly<SGraphImpl>, context: RenderingContext): VNode;
|
|
22
|
+
protected getGridStyle(model: Readonly<SGraphImpl>, context: RenderingContext): GridStyle;
|
|
23
|
+
protected getBackgroundBounds(viewport: Readonly<SGraphImpl>, context: RenderingContext, gridManager: GridManager): Writable<Bounds>;
|
|
24
|
+
protected getBackgroundImage(model: Readonly<SGraphImpl>, context: RenderingContext, gridManager: GridManager): string;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ggraph-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ggraph-view.d.ts","sourceRoot":"","sources":["../../src/views/ggraph-view.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAoB,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAS,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5H,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAErD,qBACa,UAAW,SAAQ,UAAU;IACE,SAAS,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IAEnE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK;IAQ9E,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;CAIzH"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GGraphView = void 0;
|
|
13
|
+
/********************************************************************************
|
|
14
|
+
* Copyright (c) 2024 EclipseSource and others.
|
|
15
|
+
*
|
|
16
|
+
* This program and the accompanying materials are made available under the
|
|
17
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
18
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
19
|
+
*
|
|
20
|
+
* This Source Code may also be made available under the following Secondary
|
|
21
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
22
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
23
|
+
* with the GNU Classpath Exception which is available at
|
|
24
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
25
|
+
*
|
|
26
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
27
|
+
********************************************************************************/
|
|
28
|
+
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
29
|
+
const inversify_1 = require("inversify");
|
|
30
|
+
const features_1 = require("../features");
|
|
31
|
+
let GGraphView = class GGraphView extends sprotty_1.SGraphView {
|
|
32
|
+
render(model, context) {
|
|
33
|
+
const graph = super.render(model, context);
|
|
34
|
+
if (graph.data) {
|
|
35
|
+
graph.data.style = Object.assign(Object.assign({}, graph.data.style), this.getGridStyle(model, context));
|
|
36
|
+
}
|
|
37
|
+
return graph;
|
|
38
|
+
}
|
|
39
|
+
getGridStyle(model, context) {
|
|
40
|
+
var _a;
|
|
41
|
+
if (!((_a = this.gridManager) === null || _a === void 0 ? void 0 : _a.isGridVisible)) {
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
44
|
+
const bounds = this.getBackgroundBounds(model, context, this.gridManager);
|
|
45
|
+
return {
|
|
46
|
+
backgroundPosition: `${bounds.x}px ${bounds.y}px`,
|
|
47
|
+
backgroundSize: `${bounds.width}px ${bounds.height}px`,
|
|
48
|
+
// we do not set the background image directly in the style object, because we want to toggle it on and off via CSS
|
|
49
|
+
'--grid-background-image': this.getBackgroundImage(model, context, this.gridManager)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
getBackgroundBounds(viewport, context, gridManager) {
|
|
53
|
+
const position = sprotty_1.Point.multiplyScalar(sprotty_1.Point.subtract(gridManager.grid, viewport.scroll), viewport.zoom);
|
|
54
|
+
const size = sprotty_1.Dimension.fromPoint(sprotty_1.Point.multiplyScalar(gridManager.grid, viewport.zoom));
|
|
55
|
+
return Object.assign(Object.assign({}, position), size);
|
|
56
|
+
}
|
|
57
|
+
getBackgroundImage(model, context, gridManager) {
|
|
58
|
+
// eslint-disable-next-line max-len
|
|
59
|
+
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>')`;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.GGraphView = GGraphView;
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, inversify_1.inject)(sprotty_1.TYPES.IGridManager),
|
|
65
|
+
(0, inversify_1.optional)(),
|
|
66
|
+
__metadata("design:type", features_1.GridManager)
|
|
67
|
+
], GGraphView.prototype, "gridManager", void 0);
|
|
68
|
+
exports.GGraphView = GGraphView = __decorate([
|
|
69
|
+
(0, inversify_1.injectable)()
|
|
70
|
+
], GGraphView);
|
|
71
|
+
//# sourceMappingURL=ggraph-view.js.map
|
|
@@ -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,CA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,4FAA4F,CAAC;IACzS,CAAC;CACJ,CAAA;AAlCY,gCAAU;AAC+B;IAAjD,IAAA,kBAAM,EAAC,eAAK,CAAC,YAAY,CAAC;IAAE,IAAA,oBAAQ,GAAE;8BAAyB,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.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,mDAiB+B;AAC/B,yCAAyD;AACzD,uCAAgD;AAChD,0CAAqD;AAErD,6DAA6D;AAC7D,MAAM,GAAG,GAAG,EAAE,aAAa,EAAE,cAAI,EAAE,CAAC;AAEpC;;GAEG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,+BAAqB;IAIhD,MAAM,CAAC,KAAqC,EAAE,OAAyB,EAAE,IAAgB;QAC9F,MAAM,QAAQ,GAAU,CACpB,kDAA0B,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,SAAS,CAAC,CAAC;QAE3C,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEkB,SAAS,CAAC,KAAqC,EAAE,OAAyB,EAAE,IAAgB;QAC3G,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACpE,MAAM,SAAS,GAAG,SAAS,KAAK,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC;QAC1F,MAAM,EAAE,GAAG,4BAA4B,CAAC;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AAQ,GAAG,UAAU,GAAG,OAAO,CAAC;QACpC,CAAC;QACD,MAAM,KAAK,GACP,MAAM,CAAC,WAAW,KAAK,YAAY;YAC/B,CAAC,CAAC;gBACI,IAAI,EAAE,GAAG,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.333+50b1e85",
|
|
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.333+50b1e85",
|
|
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": "50b1e85e8d2acf2fc73a2280dcb0151d617e0286"
|
|
65
65
|
}
|
|
@@ -192,7 +192,11 @@ export class DiagramLoader {
|
|
|
192
192
|
|
|
193
193
|
protected async invokeStartupHook(hook: keyof Omit<IDiagramStartup, 'rank'>): Promise<void> {
|
|
194
194
|
for (const startup of this.diagramStartups) {
|
|
195
|
-
|
|
195
|
+
try {
|
|
196
|
+
await startup[hook]?.();
|
|
197
|
+
} catch (err) {
|
|
198
|
+
console.error(`Error invoking diagram startup hook '${hook}':`, '\n', err);
|
|
199
|
+
}
|
|
196
200
|
}
|
|
197
201
|
}
|
|
198
202
|
|
|
@@ -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;
|