@eclipse-glsp/client 0.10.0-next.e5fcffe.169 → 1.0.0
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/decoration.css +5 -1
- package/css/glsp-sprotty.css +39 -0
- package/css/tool-palette.css +2 -2
- package/lib/base/container-modules.d.ts.map +1 -1
- package/lib/base/container-modules.js +10 -9
- package/lib/base/container-modules.js.map +1 -1
- package/lib/base/editor-context-service.d.ts +2 -3
- package/lib/base/editor-context-service.d.ts.map +1 -1
- package/lib/base/editor-context-service.js +11 -12
- package/lib/base/editor-context-service.js.map +1 -1
- package/lib/base/model/update-model-command.d.ts +14 -7
- package/lib/base/model/update-model-command.d.ts.map +1 -1
- package/lib/base/model/update-model-command.js +31 -41
- package/lib/base/model/update-model-command.js.map +1 -1
- package/lib/base/source-uri-aware.d.ts +2 -17
- package/lib/base/source-uri-aware.d.ts.map +1 -1
- package/lib/base/source-uri-aware.js +4 -6
- package/lib/base/source-uri-aware.js.map +1 -1
- package/lib/features/change-bounds/movement-restrictor.d.ts +36 -6
- package/lib/features/change-bounds/movement-restrictor.d.ts.map +1 -1
- package/lib/features/change-bounds/movement-restrictor.js +54 -39
- package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
- package/lib/features/change-bounds/snap.d.ts +20 -5
- package/lib/features/change-bounds/snap.d.ts.map +1 -1
- package/lib/features/change-bounds/snap.js +19 -8
- package/lib/features/change-bounds/snap.js.map +1 -1
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts +5 -7
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts.map +1 -1
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js +7 -14
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js.map +1 -1
- package/lib/features/hover/hover.d.ts +1 -2
- package/lib/features/hover/hover.d.ts.map +1 -1
- package/lib/features/hover/hover.js +2 -15
- package/lib/features/hover/hover.js.map +1 -1
- package/lib/features/layout/di.config.d.ts +2 -2
- package/lib/features/layout/di.config.d.ts.map +1 -1
- package/lib/features/layout/di.config.js +6 -5
- package/lib/features/layout/di.config.js.map +1 -1
- package/lib/features/layout/{layout-commands.d.ts → layout-elements-action.d.ts} +75 -57
- package/lib/features/layout/layout-elements-action.d.ts.map +1 -0
- package/lib/features/layout/{layout-commands.js → layout-elements-action.js} +153 -197
- package/lib/features/layout/layout-elements-action.js.map +1 -0
- package/lib/features/layout/layout-elements-action.spec.d.ts +3 -0
- package/lib/features/layout/layout-elements-action.spec.d.ts.map +1 -0
- package/lib/features/layout/{layout-commands.spec.js → layout-elements-action.spec.js} +63 -56
- package/lib/features/layout/layout-elements-action.spec.js.map +1 -0
- package/lib/features/mouse-tool/mouse-tool.d.ts +0 -1
- package/lib/features/mouse-tool/mouse-tool.d.ts.map +1 -1
- package/lib/features/mouse-tool/mouse-tool.js +9 -5
- package/lib/features/mouse-tool/mouse-tool.js.map +1 -1
- package/lib/features/select/select-mouse-listener.d.ts +3 -1
- package/lib/features/select/select-mouse-listener.d.ts.map +1 -1
- package/lib/features/select/select-mouse-listener.js +62 -0
- package/lib/features/select/select-mouse-listener.js.map +1 -1
- package/lib/features/select/selection-service.d.ts +12 -3
- package/lib/features/select/selection-service.d.ts.map +1 -1
- package/lib/features/select/selection-service.js +31 -45
- package/lib/features/select/selection-service.js.map +1 -1
- package/lib/features/select/selection-service.spec.js +1 -1
- package/lib/features/select/selection-service.spec.js.map +1 -1
- package/lib/features/source-model-watcher/di.config.d.ts +4 -0
- package/lib/features/{model-source-watcher → source-model-watcher}/di.config.d.ts.map +1 -1
- package/lib/features/{model-source-watcher → source-model-watcher}/di.config.js +4 -4
- package/lib/features/{model-source-watcher → source-model-watcher}/di.config.js.map +1 -1
- package/lib/features/{model-source-watcher/model-source-changed-action-handler.d.ts → source-model-watcher/source-model-changed-action-handler.d.ts} +9 -9
- package/lib/features/{model-source-watcher/model-source-changed-action-handler.d.ts.map → source-model-watcher/source-model-changed-action-handler.d.ts.map} +1 -1
- package/lib/features/{model-source-watcher/model-source-changed-action-handler.js → source-model-watcher/source-model-changed-action-handler.js} +19 -19
- package/lib/features/{model-source-watcher/model-source-changed-action-handler.js.map → source-model-watcher/source-model-changed-action-handler.js.map} +1 -1
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js +1 -1
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts +3 -2
- package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.js +13 -6
- package/lib/features/tool-feedback/edge-edit-tool-feedback.js.map +1 -1
- package/lib/features/tools/di.config.d.ts +9 -2
- package/lib/features/tools/di.config.d.ts.map +1 -1
- package/lib/features/tools/di.config.js +14 -3
- package/lib/features/tools/di.config.js.map +1 -1
- package/lib/features/tools/enable-default-tools-on-focus-loss.d.ts +26 -0
- package/lib/features/tools/enable-default-tools-on-focus-loss.d.ts.map +1 -0
- package/lib/features/tools/enable-default-tools-on-focus-loss.js +29 -0
- package/lib/features/tools/enable-default-tools-on-focus-loss.js.map +1 -0
- package/lib/features/validation/di.config.d.ts +0 -15
- package/lib/features/validation/di.config.d.ts.map +1 -1
- package/lib/features/validation/di.config.js +6 -4
- package/lib/features/validation/di.config.js.map +1 -1
- package/lib/features/validation/issue-marker.d.ts +11 -5
- package/lib/features/validation/issue-marker.d.ts.map +1 -1
- package/lib/features/validation/issue-marker.js +25 -5
- package/lib/features/validation/issue-marker.js.map +1 -1
- package/lib/features/validation/marker-navigator.d.ts +11 -17
- package/lib/features/validation/marker-navigator.d.ts.map +1 -1
- package/lib/features/validation/marker-navigator.js +32 -61
- package/lib/features/validation/marker-navigator.js.map +1 -1
- package/lib/features/validation/validate.d.ts +8 -19
- package/lib/features/validation/validate.d.ts.map +1 -1
- package/lib/features/validation/validate.js +29 -55
- package/lib/features/validation/validate.js.map +1 -1
- package/lib/index.d.ts +6 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +16 -15
- package/lib/index.js.map +1 -1
- package/lib/lib/model.d.ts +1 -1
- package/lib/lib/model.d.ts.map +1 -1
- package/lib/lib/model.js +3 -3
- package/lib/lib/model.js.map +1 -1
- package/lib/model-source/glsp-diagram-server.d.ts +1 -1
- package/lib/model-source/glsp-diagram-server.d.ts.map +1 -1
- package/lib/model-source/glsp-diagram-server.js +1 -1
- package/lib/model-source/glsp-diagram-server.js.map +1 -1
- package/lib/utils/layout-utils.d.ts +4 -20
- package/lib/utils/layout-utils.d.ts.map +1 -1
- package/lib/utils/layout-utils.js +1 -1
- package/lib/utils/layout-utils.js.map +1 -1
- package/lib/views/base-view-module.d.ts.map +1 -1
- package/lib/views/base-view-module.js +3 -1
- package/lib/views/base-view-module.js.map +1 -1
- package/lib/views/glsp-projection-view.d.ts +30 -0
- package/lib/views/glsp-projection-view.d.ts.map +1 -0
- package/lib/views/glsp-projection-view.js +142 -0
- package/lib/views/glsp-projection-view.js.map +1 -0
- 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 +4 -4
- package/src/base/container-modules.ts +6 -5
- package/src/base/editor-context-service.ts +15 -7
- package/src/base/model/update-model-command.ts +48 -34
- package/src/base/source-uri-aware.ts +5 -4
- package/src/features/change-bounds/movement-restrictor.ts +73 -43
- package/src/features/change-bounds/snap.ts +15 -12
- package/src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts +19 -25
- package/src/features/hover/hover.ts +2 -24
- package/src/features/layout/di.config.ts +12 -6
- package/src/features/layout/{layout-commands.spec.ts → layout-elements-action.spec.ts} +56 -48
- package/src/features/layout/{layout-commands.ts → layout-elements-action.ts} +195 -207
- package/src/features/mouse-tool/mouse-tool.ts +8 -6
- package/src/features/select/select-mouse-listener.ts +81 -1
- package/src/features/select/selection-service.spec.ts +1 -1
- package/src/features/select/selection-service.ts +37 -50
- package/src/features/{model-source-watcher → source-model-watcher}/di.config.ts +5 -5
- package/src/features/{model-source-watcher/model-source-changed-action-handler.ts → source-model-watcher/source-model-changed-action-handler.ts} +12 -12
- package/src/features/tool-feedback/change-bounds-tool-feedback.ts +1 -1
- package/src/features/tool-feedback/edge-edit-tool-feedback.ts +14 -6
- package/src/features/tools/di.config.ts +13 -2
- package/src/features/tools/enable-default-tools-on-focus-loss.ts +33 -0
- package/src/features/validation/di.config.ts +10 -7
- package/src/features/validation/issue-marker.ts +34 -12
- package/src/features/validation/marker-navigator.ts +29 -66
- package/src/features/validation/validate.ts +36 -71
- package/src/index.ts +8 -7
- package/src/lib/model.ts +1 -1
- package/src/model-source/glsp-diagram-server.ts +1 -1
- package/src/utils/layout-utils.ts +7 -27
- package/src/views/base-view-module.ts +5 -1
- package/src/views/glsp-projection-view.tsx +166 -0
- package/src/views/index.ts +2 -0
- package/lib/features/layout/layout-commands.d.ts.map +0 -1
- package/lib/features/layout/layout-commands.js.map +0 -1
- package/lib/features/layout/layout-commands.spec.d.ts +0 -3
- package/lib/features/layout/layout-commands.spec.d.ts.map +0 -1
- package/lib/features/layout/layout-commands.spec.js.map +0 -1
- package/lib/features/model-source-watcher/di.config.d.ts +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-view-module.js","sourceRoot":"","sources":["../../src/views/base-view-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAsD;AACtD,yCAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"base-view-module.js","sourceRoot":"","sources":["../../src/views/base-view-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAsD;AACtD,yCAAwD;AACxD,qCAgCiB;AACjB,wCAAyC;AACzC,qDAA6C;AAC7C,2DAAuD;AACvD,+DAA8D;AAO9D,MAAM,cAAc,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,MAAM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A,+BAAqB,EAAC,OAAO,EAAE,uBAAY,CAAC,IAAI,EAAE,eAAK,EAAE,0BAAS,CAAC,CAAC;IACpE,IAAA,+BAAqB,EAAC,OAAO,EAAE,uBAAY,CAAC,IAAI,EAAE,eAAK,EAAE,6BAAmB,CAAC,CAAC;IAC9E,IAAA,+BAAqB,EAAC,OAAO,EAAE,uBAAY,CAAC,aAAa,EAAE,wBAAc,EAAE,4BAAkB,CAAC,CAAC;IAC/F,IAAA,+BAAqB,EAAC,OAAO,EAAE,uBAAY,CAAC,sBAAsB,EAAE,wBAAc,EAAE,4BAAkB,CAAC,CAAC;IACxG,IAAA,+BAAqB,EAAC,OAAO,EAAE,uBAAY,CAAC,KAAK,EAAE,gBAAM,EAAE,oBAAU,CAAC,CAAC;IAEvE,cAAc;IACd,IAAA,+BAAqB,EAAC,OAAO,EAAE,uBAAY,CAAC,aAAa,EAAE,iBAAO,EAAE,0BAAgB,CAAC,CAAC;IACtF,IAAA,+BAAqB,EAAC,OAAO,EAAE,uBAAY,CAAC,YAAY,EAAE,sBAAY,EAAE,oCAAgB,CAAC,CAAC;IAE1F,SAAS;IACT,IAAA,+BAAqB,EAAC,OAAO,EAAE,uBAAY,CAAC,WAAW,EAAE,sBAAY,EAAE,0BAAgB,CAAC,CAAC;IACzF,IAAA,+BAAqB,EAAC,OAAO,EAAE,uBAAY,CAAC,YAAY,EAAE,qBAAW,EAAE,yBAAe,CAAC,CAAC;IACxF,IAAA,+BAAqB,EAAC,OAAO,EAAE,uBAAY,CAAC,cAAc,EAAE,yBAAe,EAAE,6BAAmB,CAAC,CAAC;AACtG,CAAC;AAjCD,sEAiCC;AAED,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2017-2018 TypeFox 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
|
+
/** @jsx html */
|
|
17
|
+
import { Bounds } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { VNode } from 'snabbdom';
|
|
19
|
+
import { IViewArgs, ProjectedViewportView, ProjectionParams, RenderingContext, ViewportRootElement, ViewProjection } from 'sprotty';
|
|
20
|
+
/**
|
|
21
|
+
* Special viewport root view that renders horizontal and vertical projection bars for quick navigation.
|
|
22
|
+
*/
|
|
23
|
+
export declare class GLSPProjectionView extends ProjectedViewportView {
|
|
24
|
+
render(model: Readonly<ViewportRootElement>, context: RenderingContext, args?: IViewArgs): VNode;
|
|
25
|
+
protected renderSvg(model: Readonly<ViewportRootElement>, context: RenderingContext, args?: IViewArgs): VNode;
|
|
26
|
+
protected renderProjectionBar(projections: ViewProjection[], model: Readonly<ViewportRootElement>, modelBounds: Bounds, orientation: 'horizontal' | 'vertical'): VNode;
|
|
27
|
+
protected renderViewport(model: Readonly<ViewportRootElement>, params: ProjectionParams): VNode;
|
|
28
|
+
protected renderProjection(projection: ViewProjection, model: Readonly<ViewportRootElement>, params: ProjectionParams): VNode;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=glsp-projection-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-projection-view.d.ts","sourceRoot":"","sources":["../../src/views/glsp-projection-view.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,gBAAgB;AAChB,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAK,KAAK,EAAc,MAAM,UAAU,CAAC;AAChD,OAAO,EAGH,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAEhB,mBAAmB,EACnB,cAAc,EACjB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,qBACa,kBAAmB,SAAQ,qBAAqB;IAChD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,KAAK;cAStF,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,KAAK;cAOnG,mBAAmB,CAClC,WAAW,EAAE,cAAc,EAAE,EAC7B,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC,EACpC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,YAAY,GAAG,UAAU,GACvC,KAAK;cAoBW,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,gBAAgB,GAAG,KAAK;cAwCrF,gBAAgB,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,gBAAgB,GAAG,KAAK;CA+CzI"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2017-2018 TypeFox and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
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;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.GLSPProjectionView = void 0;
|
|
25
|
+
const inversify_1 = require("inversify");
|
|
26
|
+
const snabbdom_1 = require("snabbdom");
|
|
27
|
+
const sprotty_1 = require("sprotty");
|
|
28
|
+
/**
|
|
29
|
+
* Special viewport root view that renders horizontal and vertical projection bars for quick navigation.
|
|
30
|
+
*/
|
|
31
|
+
let GLSPProjectionView = class GLSPProjectionView extends sprotty_1.ProjectedViewportView {
|
|
32
|
+
render(model, context, args) {
|
|
33
|
+
return ((0, sprotty_1.html)("div", { "class-sprotty-graph": true, style: { width: '100%' } },
|
|
34
|
+
this.renderSvg(model, context, args),
|
|
35
|
+
this.renderProjections(model, context, args)));
|
|
36
|
+
}
|
|
37
|
+
renderSvg(model, context, args) {
|
|
38
|
+
const transform = `scale(${model.zoom}) translate(${-model.scroll.x},${-model.scroll.y})`;
|
|
39
|
+
const ns = 'http://www.w3.org/2000/svg';
|
|
40
|
+
const svg = (0, snabbdom_1.h)('svg', { ns, style: { height: '100%' } }, (0, snabbdom_1.h)('g', { ns, attrs: { transform } }, context.renderChildren(model)));
|
|
41
|
+
return svg;
|
|
42
|
+
}
|
|
43
|
+
renderProjectionBar(projections, model, modelBounds, orientation) {
|
|
44
|
+
const params = { modelBounds, orientation };
|
|
45
|
+
// NOTE: Here we assume that the projection bars have the same size as the diagram canvas,
|
|
46
|
+
// i.e. they are drawn as overlay above the canvas.
|
|
47
|
+
params.factor =
|
|
48
|
+
orientation === 'horizontal' ? model.canvasBounds.width / modelBounds.width : model.canvasBounds.height / modelBounds.height;
|
|
49
|
+
params.zoomedFactor = params.factor / model.zoom;
|
|
50
|
+
return ((0, sprotty_1.html)("div", { "class-sprotty-projection-bar": true, "class-horizontal": orientation === 'horizontal', "class-vertical": orientation === 'vertical', "class-bordered-projection-bar": true },
|
|
51
|
+
this.renderViewport(model, params),
|
|
52
|
+
projections.map(p => this.renderProjection(p, model, params))));
|
|
53
|
+
}
|
|
54
|
+
renderViewport(model, params) {
|
|
55
|
+
let canvasSize;
|
|
56
|
+
let viewportPos;
|
|
57
|
+
if (params.orientation === 'horizontal') {
|
|
58
|
+
canvasSize = model.canvasBounds.width;
|
|
59
|
+
viewportPos = (model.scroll.x - params.modelBounds.x) * params.factor;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
canvasSize = model.canvasBounds.height;
|
|
63
|
+
viewportPos = (model.scroll.y - params.modelBounds.y) * params.factor;
|
|
64
|
+
}
|
|
65
|
+
let viewportSize = canvasSize * params.zoomedFactor;
|
|
66
|
+
if (viewportPos < 0) {
|
|
67
|
+
viewportSize += viewportPos;
|
|
68
|
+
viewportPos = 0;
|
|
69
|
+
}
|
|
70
|
+
else if (viewportPos > canvasSize) {
|
|
71
|
+
viewportPos = canvasSize;
|
|
72
|
+
}
|
|
73
|
+
if (viewportSize < 0) {
|
|
74
|
+
viewportSize = 0;
|
|
75
|
+
}
|
|
76
|
+
else if (viewportPos + viewportSize > canvasSize) {
|
|
77
|
+
viewportSize = canvasSize - viewportPos;
|
|
78
|
+
}
|
|
79
|
+
if (Math.abs(viewportSize - canvasSize) < 1) {
|
|
80
|
+
viewportSize = 0;
|
|
81
|
+
}
|
|
82
|
+
const style = params.orientation === 'horizontal'
|
|
83
|
+
? {
|
|
84
|
+
left: `${viewportPos}px`,
|
|
85
|
+
width: `${viewportSize}px`,
|
|
86
|
+
border: 'none'
|
|
87
|
+
}
|
|
88
|
+
: {
|
|
89
|
+
top: `${viewportPos}px`,
|
|
90
|
+
height: `${viewportSize}px`,
|
|
91
|
+
border: 'none'
|
|
92
|
+
};
|
|
93
|
+
return (0, sprotty_1.html)("div", { "class-sprotty-viewport": viewportSize !== 0, "class-projection-scroll-bar": true, style: style });
|
|
94
|
+
}
|
|
95
|
+
renderProjection(projection, model, params) {
|
|
96
|
+
let canvasSize;
|
|
97
|
+
let projPos;
|
|
98
|
+
let projSize;
|
|
99
|
+
if (params.orientation === 'horizontal') {
|
|
100
|
+
canvasSize = model.canvasBounds.width;
|
|
101
|
+
projPos = (projection.projectedBounds.x - params.modelBounds.x) * params.factor;
|
|
102
|
+
projSize = projection.projectedBounds.width * params.factor;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
canvasSize = model.canvasBounds.height;
|
|
106
|
+
projPos = (projection.projectedBounds.y - params.modelBounds.y) * params.factor;
|
|
107
|
+
projSize = projection.projectedBounds.height * params.factor;
|
|
108
|
+
}
|
|
109
|
+
if (projPos < 0) {
|
|
110
|
+
projSize += projPos;
|
|
111
|
+
projPos = 0;
|
|
112
|
+
}
|
|
113
|
+
else if (projPos > canvasSize) {
|
|
114
|
+
projPos = canvasSize;
|
|
115
|
+
}
|
|
116
|
+
if (projSize < 0) {
|
|
117
|
+
projSize = 0;
|
|
118
|
+
}
|
|
119
|
+
else if (projPos + projSize > canvasSize) {
|
|
120
|
+
projSize = canvasSize - projPos;
|
|
121
|
+
}
|
|
122
|
+
const style = params.orientation === 'horizontal'
|
|
123
|
+
? {
|
|
124
|
+
left: `${projPos}px`,
|
|
125
|
+
width: `${projSize}px`,
|
|
126
|
+
height: '60%'
|
|
127
|
+
}
|
|
128
|
+
: {
|
|
129
|
+
top: `${projPos}px`,
|
|
130
|
+
height: `${projSize}px`,
|
|
131
|
+
width: '60%'
|
|
132
|
+
};
|
|
133
|
+
const result = ((0, sprotty_1.html)("div", { id: `${params.orientation}-projection:${projection.elementId}`, "class-sprotty-projection": true, "class-glsp-projection": true, style: style }));
|
|
134
|
+
projection.cssClasses.forEach(cl => (0, sprotty_1.setClass)(result, cl, true));
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
GLSPProjectionView = __decorate([
|
|
139
|
+
(0, inversify_1.injectable)()
|
|
140
|
+
], GLSPProjectionView);
|
|
141
|
+
exports.GLSPProjectionView = GLSPProjectionView;
|
|
142
|
+
//# sourceMappingURL=glsp-projection-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-projection-view.js","sourceRoot":"","sources":["../../src/views/glsp-projection-view.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;AAIlF,yCAAuC;AACvC,uCAAgD;AAChD,qCAUiB;AAEjB;;GAEG;AAEH,IAAa,kBAAkB,GAA/B,MAAa,kBAAmB,SAAQ,+BAAqB;IAChD,MAAM,CAAC,KAAoC,EAAE,OAAyB,EAAE,IAAgB;QAC7F,OAAO,CACH,oDAA0B,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACnD,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC;YACpC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAC3C,CACT,CAAC;IACN,CAAC;IAEkB,SAAS,CAAC,KAAoC,EAAE,OAAyB,EAAE,IAAgB;QAC1G,MAAM,SAAS,GAAG,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;SACnC;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,6BACI,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;AAjIY,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CAiI9B;AAjIY,gDAAkB"}
|
package/lib/views/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
export * from './base-view-module';
|
|
17
17
|
export * from './compartments';
|
|
18
18
|
export * from './glsp-edge-view';
|
|
19
|
+
export * from './glsp-projection-view';
|
|
19
20
|
export * from './issue-marker-view';
|
|
20
21
|
export * from './rounded-corner';
|
|
21
22
|
export * from './rounded-corner-view';
|
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,kBAAkB,CAAC;AACjC,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,kBAAkB,CAAC;AACjC,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("./glsp-edge-view"), exports);
|
|
35
|
+
__exportStar(require("./glsp-projection-view"), exports);
|
|
35
36
|
__exportStar(require("./issue-marker-view"), exports);
|
|
36
37
|
__exportStar(require("./rounded-corner"), exports);
|
|
37
38
|
__exportStar(require("./rounded-corner-view"), 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,mDAAiC;AACjC,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,mDAAiC;AACjC,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": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A sprotty-based client for GLSP",
|
|
5
5
|
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
|
|
6
6
|
"keywords": [
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"css"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@eclipse-glsp/protocol": "0.
|
|
37
|
+
"@eclipse-glsp/protocol": "^1.0.0",
|
|
38
38
|
"autocompleter": "5.1.0",
|
|
39
|
-
"sprotty": "
|
|
39
|
+
"sprotty": "0.12.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@vscode/codicons": "^0.0.25",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
},
|
|
58
58
|
"main": "lib/index",
|
|
59
59
|
"types": "lib/index",
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "fe0b29761e9844d8541ce4cafeaf7e00976157e1"
|
|
61
61
|
}
|
|
@@ -37,14 +37,14 @@ import glspDecorationModule from '../features/decoration/di.config';
|
|
|
37
37
|
import glspEditLabelModule from '../features/edit-label/di.config';
|
|
38
38
|
import modelHintsModule from '../features/hints/di.config';
|
|
39
39
|
import glspHoverModule from '../features/hover/di.config';
|
|
40
|
-
import
|
|
41
|
-
import modelSourceWatcherModule from '../features/model-source-watcher/di.config';
|
|
40
|
+
import layoutModule from '../features/layout/di.config';
|
|
42
41
|
import glspMouseToolModule from '../features/mouse-tool/di.config';
|
|
43
42
|
import { navigationModule } from '../features/navigation/di.config';
|
|
44
43
|
import glspSelectModule from '../features/select/di.config';
|
|
44
|
+
import sourceModelWatcherModule from '../features/source-model-watcher/di.config';
|
|
45
45
|
import toolFeedbackModule from '../features/tool-feedback/di.config';
|
|
46
46
|
import toolPaletteModule from '../features/tool-palette/di.config';
|
|
47
|
-
import toolsModule from '../features/tools/di.config';
|
|
47
|
+
import { enableDefaultToolsOnFocusLossModule, toolsModule } from '../features/tools/di.config';
|
|
48
48
|
import { markerNavigatorModule, validationModule } from '../features/validation/di.config';
|
|
49
49
|
import glspViewportModule from '../features/viewport/di.config';
|
|
50
50
|
import defaultGLSPModule from './di.config';
|
|
@@ -69,17 +69,18 @@ export const DEFAULT_MODULES = [
|
|
|
69
69
|
glspServerCopyPasteModule,
|
|
70
70
|
glspViewportModule,
|
|
71
71
|
labelEditUiModule,
|
|
72
|
-
|
|
72
|
+
layoutModule,
|
|
73
73
|
markerNavigatorModule,
|
|
74
74
|
modelHintsModule,
|
|
75
75
|
modelSourceModule,
|
|
76
|
-
|
|
76
|
+
sourceModelWatcherModule,
|
|
77
77
|
navigationModule,
|
|
78
78
|
openModule,
|
|
79
79
|
toolPaletteModule,
|
|
80
80
|
routingModule,
|
|
81
81
|
toolFeedbackModule,
|
|
82
82
|
toolsModule,
|
|
83
|
+
enableDefaultToolsOnFocusLossModule,
|
|
83
84
|
validationModule,
|
|
84
85
|
zorderModule
|
|
85
86
|
];
|
|
@@ -38,12 +38,20 @@ export interface EditModeListener {
|
|
|
38
38
|
*/
|
|
39
39
|
@injectable()
|
|
40
40
|
export class EditorContextService implements IActionHandler {
|
|
41
|
-
@inject(TYPES.SelectionService)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
@inject(TYPES.SelectionService)
|
|
42
|
+
protected selectionService: SelectionService;
|
|
43
|
+
|
|
44
|
+
@inject(MousePositionTracker)
|
|
45
|
+
protected mousePositionTracker: MousePositionTracker;
|
|
46
|
+
|
|
47
|
+
@multiInject(TYPES.IEditModeListener)
|
|
48
|
+
@optional()
|
|
49
|
+
protected editModeListeners: EditModeListener[] = [];
|
|
45
50
|
|
|
46
|
-
|
|
51
|
+
@inject(TYPES.ModelSourceProvider)
|
|
52
|
+
protected modelSourceProvider: () => Promise<ModelSource>;
|
|
53
|
+
|
|
54
|
+
protected _editMode: string;
|
|
47
55
|
|
|
48
56
|
register(editModeListener: EditModeListener): void {
|
|
49
57
|
distinctAdd(this.editModeListeners, editModeListener);
|
|
@@ -82,9 +90,9 @@ export class EditorContextService implements IActionHandler {
|
|
|
82
90
|
}
|
|
83
91
|
|
|
84
92
|
async getSourceUri(): Promise<string | undefined> {
|
|
85
|
-
const modelSource = await this.
|
|
93
|
+
const modelSource = await this.modelSourceProvider();
|
|
86
94
|
if (isSourceUriAware(modelSource)) {
|
|
87
|
-
return modelSource.
|
|
95
|
+
return modelSource.sourceURI;
|
|
88
96
|
}
|
|
89
97
|
return undefined;
|
|
90
98
|
}
|
|
@@ -13,25 +13,31 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Action, SetModelAction, UpdateModelAction } from '@eclipse-glsp/protocol';
|
|
17
|
-
import { inject, injectable, multiInject, optional
|
|
16
|
+
import { Action, SetModelAction, toTypeGuard, UpdateModelAction } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { inject, injectable, multiInject, optional } from 'inversify';
|
|
18
18
|
import {
|
|
19
19
|
ActionHandlerRegistry,
|
|
20
|
+
Animation,
|
|
20
21
|
Command,
|
|
21
22
|
CommandActionHandler,
|
|
22
23
|
CommandExecutionContext,
|
|
23
24
|
CommandReturn,
|
|
24
25
|
IActionHandler,
|
|
25
26
|
ILogger,
|
|
27
|
+
MorphEdgesAnimation,
|
|
26
28
|
SModelRoot,
|
|
29
|
+
UpdateAnimationData,
|
|
27
30
|
UpdateModelCommand
|
|
28
31
|
} from 'sprotty';
|
|
29
32
|
import { IFeedbackActionDispatcher } from '../../features/tool-feedback/feedback-action-dispatcher';
|
|
30
33
|
import { FeedbackCommand } from '../../features/tool-feedback/model';
|
|
31
34
|
import { TYPES } from '../types';
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
*
|
|
36
|
+
/**
|
|
37
|
+
* ActionHandler that transforms a {@link SetModelAction} into an {@link UpdateModelAction} that can be handled
|
|
38
|
+
* by the {@link FeedbackAwareUpdateModelCommand}. This can be done because in sprotty an {@link UpdateModelCommand} and
|
|
39
|
+
* a {@link SetModelCommand} have the same behavior of no model is present yet.
|
|
40
|
+
*/
|
|
35
41
|
@injectable()
|
|
36
42
|
export class SetModelActionHandler implements IActionHandler {
|
|
37
43
|
handle(action: Action): Action | void {
|
|
@@ -46,38 +52,41 @@ export interface SModelRootListener {
|
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
/**
|
|
49
|
-
* A special
|
|
50
|
-
* feedback to the `newRoot` before performing the update
|
|
55
|
+
* A special {@link UpdateModelCommand} that retrieves all registered {@link Action}s from the {@link IFeedbackActionDispatcher}
|
|
56
|
+
* (if present) and applies their feedback to the `newRoot` before performing the update. This enables persistent client-side feedback
|
|
57
|
+
* across model updates initiated by the GLSP server.
|
|
51
58
|
*/
|
|
52
59
|
@injectable()
|
|
53
60
|
export class FeedbackAwareUpdateModelCommand extends UpdateModelCommand {
|
|
54
|
-
@inject(TYPES.ILogger)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@
|
|
61
|
+
@inject(TYPES.ILogger)
|
|
62
|
+
protected logger: ILogger;
|
|
63
|
+
|
|
64
|
+
@inject(TYPES.IFeedbackActionDispatcher)
|
|
65
|
+
@optional()
|
|
66
|
+
protected feedbackActionDispatcher: IFeedbackActionDispatcher;
|
|
67
|
+
|
|
68
|
+
@multiInject(TYPES.SModelRootListener)
|
|
69
|
+
@optional()
|
|
70
|
+
protected modelRootListeners: SModelRootListener[] = [];
|
|
58
71
|
|
|
59
72
|
protected actionHandlerRegistry?: ActionHandlerRegistry;
|
|
60
73
|
|
|
61
|
-
constructor(
|
|
74
|
+
constructor(
|
|
75
|
+
@inject(TYPES.Action) action: UpdateModelAction,
|
|
76
|
+
@inject(TYPES.ActionHandlerRegistryProvider)
|
|
77
|
+
actionHandlerRegistryProvider: () => Promise<ActionHandlerRegistry>
|
|
78
|
+
) {
|
|
62
79
|
super({ animate: true, ...action });
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
@postConstruct()
|
|
66
|
-
protected initialize(): void {
|
|
67
|
-
this.actionHandlerRegistryProvider().then(registry => (this.actionHandlerRegistry = registry));
|
|
80
|
+
actionHandlerRegistryProvider().then(registry => (this.actionHandlerRegistry = registry));
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
protected override performUpdate(oldRoot: SModelRoot, newRoot: SModelRoot, context: CommandExecutionContext): CommandReturn {
|
|
71
84
|
if (this.feedbackActionDispatcher && this.actionHandlerRegistry) {
|
|
72
|
-
// Create a temporary context
|
|
85
|
+
// Create a temporary context which defines the `newRoot` as `root`
|
|
73
86
|
// This way we do not corrupt the redo/undo behavior of the super class
|
|
74
87
|
const tempContext: CommandExecutionContext = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
logger: context.logger,
|
|
78
|
-
modelChanged: context.modelChanged,
|
|
79
|
-
modelFactory: context.modelFactory,
|
|
80
|
-
syncer: context.syncer
|
|
88
|
+
...context,
|
|
89
|
+
root: newRoot
|
|
81
90
|
};
|
|
82
91
|
|
|
83
92
|
const feedbackCommands = this.getFeedbackCommands(this.actionHandlerRegistry);
|
|
@@ -91,19 +100,24 @@ export class FeedbackAwareUpdateModelCommand extends UpdateModelCommand {
|
|
|
91
100
|
protected getFeedbackCommands(registry: ActionHandlerRegistry): Command[] {
|
|
92
101
|
const result: Command[] = [];
|
|
93
102
|
this.feedbackActionDispatcher.getRegisteredFeedback().forEach(action => {
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
103
|
+
const commands = registry
|
|
104
|
+
.get(action.kind)
|
|
105
|
+
.filter<CommandActionHandler>(toTypeGuard(CommandActionHandler))
|
|
106
|
+
.map(handler => handler.handle(action));
|
|
107
|
+
result.push(...commands);
|
|
98
108
|
});
|
|
99
|
-
// sort commands
|
|
100
|
-
return result.sort((a, b) => getPriority(b) - getPriority(a));
|
|
109
|
+
// sort commands descanting by priority
|
|
110
|
+
return result.sort((a, b) => this.getPriority(b) - this.getPriority(a));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
protected getPriority(command: Partial<FeedbackCommand>): number {
|
|
114
|
+
return command.priority ?? 0;
|
|
101
115
|
}
|
|
102
|
-
}
|
|
103
116
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
// Override the `createAnimations` implementation and remove the animation for edge morphing. Otherwise routing & reconnect
|
|
118
|
+
// handles flicker after each server update.
|
|
119
|
+
protected override createAnimations(data: UpdateAnimationData, root: SModelRoot, context: CommandExecutionContext): Animation[] {
|
|
120
|
+
const animations = super.createAnimations(data, root, context);
|
|
121
|
+
return animations.filter(animation => !(animation instanceof MorphEdgesAnimation));
|
|
107
122
|
}
|
|
108
|
-
return 0;
|
|
109
123
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2020-2022 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
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
import { AnyObject, hasStringProp } from '@eclipse-glsp/protocol';
|
|
17
|
+
export interface SourceUriAware {
|
|
18
|
+
sourceURI: string;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export function isSourceUriAware(obj: any): obj is SourceUriAware {
|
|
21
|
-
return obj
|
|
22
|
+
return AnyObject.is(obj) && hasStringProp(obj, 'sourceURI');
|
|
22
23
|
}
|
|
@@ -20,40 +20,35 @@ import { toAbsoluteBounds } from '../../utils/viewpoint-util';
|
|
|
20
20
|
import { ModifyCSSFeedbackAction } from '../tool-feedback/css-feedback';
|
|
21
21
|
import { isBoundsAwareMoveable, SResizeHandle } from './model';
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* A `MovementRestrictor` is an optional service that can be used by tools to validate
|
|
25
|
+
* whether a certain move operation (e.g. `ChangeBoundsOperation`) in the diagram is valid.
|
|
26
|
+
*/
|
|
23
27
|
export interface IMovementRestrictor {
|
|
24
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Validate whether moving the given element to a new given location is allowed.
|
|
30
|
+
* @param element The element that should be moved.
|
|
31
|
+
* @param newLocation The new location of the element.
|
|
32
|
+
* @returns `true` if the the element is movable and moving to the given location is allowed, `false` otherwise.
|
|
33
|
+
* Should also return `false` if the newLocation is `undefined`:
|
|
34
|
+
*/
|
|
35
|
+
validate(element: SModelElement, newLocation?: Point): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Feedback css-classes. Can be applied to elements that did fail the validation.
|
|
38
|
+
*/
|
|
25
39
|
cssClasses?: string[];
|
|
26
40
|
}
|
|
27
41
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const elements: SModelElement[] = [element];
|
|
33
|
-
if (element instanceof SParentElement) {
|
|
34
|
-
element.children.filter(child => child instanceof SResizeHandle).forEach(e => elements.push(e));
|
|
35
|
-
}
|
|
36
|
-
return ModifyCSSFeedbackAction.create({ elements, add: movementRestrictor.cssClasses });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function removeMovementRestrictionFeedback(
|
|
40
|
-
element: SModelElement,
|
|
41
|
-
movementRestrictor: IMovementRestrictor
|
|
42
|
-
): ModifyCSSFeedbackAction {
|
|
43
|
-
const elements: SModelElement[] = [element];
|
|
44
|
-
if (element instanceof SParentElement) {
|
|
45
|
-
element.children.filter(child => child instanceof SResizeHandle).forEach(e => elements.push(e));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return ModifyCSSFeedbackAction.create({ elements, remove: movementRestrictor.cssClasses });
|
|
49
|
-
}
|
|
50
|
-
|
|
42
|
+
/**
|
|
43
|
+
* A `IMovementRestrictor` that checks for overlapping elements. Move operations
|
|
44
|
+
* are only valid if the element does not collide with another element after moving.
|
|
45
|
+
*/
|
|
51
46
|
@injectable()
|
|
52
|
-
export class
|
|
47
|
+
export class NoOverlapMovementRestrictor implements IMovementRestrictor {
|
|
53
48
|
cssClasses = ['movement-not-allowed'];
|
|
54
49
|
|
|
55
|
-
validate(
|
|
56
|
-
if (!isBoundsAwareMoveable(element)) {
|
|
50
|
+
validate(element: SModelElement, newLocation?: Point): boolean {
|
|
51
|
+
if (!isBoundsAwareMoveable(element) || !newLocation) {
|
|
57
52
|
return false;
|
|
58
53
|
}
|
|
59
54
|
// Create ghost element at the newLocation
|
|
@@ -71,27 +66,62 @@ export class NoOverlapMovmentRestrictor implements IMovementRestrictor {
|
|
|
71
66
|
.all()
|
|
72
67
|
.filter(e => e.id !== ghostElement.id && e !== ghostElement.root && e instanceof SNode)
|
|
73
68
|
.map(e => e as SModelElement & BoundsAware)
|
|
74
|
-
).some(e => areOverlapping(e, ghostElement));
|
|
69
|
+
).some(e => this.areOverlapping(e, ghostElement));
|
|
75
70
|
}
|
|
76
|
-
}
|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
protected areOverlapping(element1: SModelElement & BoundsAware, element2: SModelElement & BoundsAware): boolean {
|
|
73
|
+
const b1 = toAbsoluteBounds(element1);
|
|
74
|
+
const b2 = toAbsoluteBounds(element2);
|
|
75
|
+
const r1TopLeft: Point = b1;
|
|
76
|
+
const r1BottomRight = { x: b1.x + b1.width, y: b1.y + b1.height };
|
|
77
|
+
const r2TopLeft: Point = b2;
|
|
78
|
+
const r2BottomRight = { x: b2.x + b2.width, y: b2.y + b2.height };
|
|
79
|
+
|
|
80
|
+
// If one rectangle is on left side of other
|
|
81
|
+
if (r1TopLeft.x > r2BottomRight.x || r2TopLeft.x > r1BottomRight.x) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
// If one rectangle is above other
|
|
86
|
+
if (r1BottomRight.y < r2TopLeft.y || r2BottomRight.y < r1TopLeft.y) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return true;
|
|
89
91
|
}
|
|
92
|
+
}
|
|
90
93
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Utility function to create an action that applies the given {@link IMovementRestrictor.cssClasses} to the given element.
|
|
96
|
+
* @param element The element on which the css classes should be applied.
|
|
97
|
+
* @param movementRestrictor The movement restrictor whose cssClasses should be applied.
|
|
98
|
+
* @returns The corresponding {@link ModifyCSSFeedbackAction}
|
|
99
|
+
*/
|
|
100
|
+
export function createMovementRestrictionFeedback(
|
|
101
|
+
element: SModelElement,
|
|
102
|
+
movementRestrictor: IMovementRestrictor
|
|
103
|
+
): ModifyCSSFeedbackAction {
|
|
104
|
+
const elements: SModelElement[] = [element];
|
|
105
|
+
if (element instanceof SParentElement) {
|
|
106
|
+
element.children.filter(child => child instanceof SResizeHandle).forEach(e => elements.push(e));
|
|
107
|
+
}
|
|
108
|
+
return ModifyCSSFeedbackAction.create({ elements, add: movementRestrictor.cssClasses });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Utility function to create an action that removes the given {@link IMovementRestrictor.cssClasses} from the given element.
|
|
113
|
+
* @param element The element from which the css classes should be removed.
|
|
114
|
+
* @param movementRestrictor The movement restrictor whose cssClasses should be removed.
|
|
115
|
+
* @returns The corresponding {@link ModifyCSSFeedbackAction}
|
|
116
|
+
*/
|
|
117
|
+
export function removeMovementRestrictionFeedback(
|
|
118
|
+
element: SModelElement,
|
|
119
|
+
movementRestrictor: IMovementRestrictor
|
|
120
|
+
): ModifyCSSFeedbackAction {
|
|
121
|
+
const elements: SModelElement[] = [element];
|
|
122
|
+
if (element instanceof SParentElement) {
|
|
123
|
+
element.children.filter(child => child instanceof SResizeHandle).forEach(e => elements.push(e));
|
|
94
124
|
}
|
|
95
125
|
|
|
96
|
-
return
|
|
126
|
+
return ModifyCSSFeedbackAction.create({ elements, remove: movementRestrictor.cssClasses });
|
|
97
127
|
}
|