@eclipse-glsp/client 0.10.0-next.88e4725.166 → 0.10.0-next.91fd534.181
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/auto-complete/auto-complete-widget.d.ts +7 -0
- package/lib/base/auto-complete/auto-complete-widget.d.ts.map +1 -1
- package/lib/base/auto-complete/auto-complete-widget.js +7 -0
- package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
- 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 +14 -3
- package/lib/base/editor-context-service.d.ts.map +1 -1
- package/lib/base/editor-context-service.js +23 -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/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 +8 -5
- package/lib/features/layout/di.config.js.map +1 -1
- package/lib/features/layout/hbox-layout.d.ts +41 -0
- package/lib/features/layout/hbox-layout.d.ts.map +1 -0
- package/lib/features/layout/hbox-layout.js +189 -0
- package/lib/features/layout/hbox-layout.js.map +1 -0
- 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 +10 -5
- package/lib/features/validation/issue-marker.d.ts.map +1 -1
- package/lib/features/validation/issue-marker.js +12 -4
- 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 +28 -53
- 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/auto-complete/auto-complete-widget.ts +7 -0
- package/src/base/container-modules.ts +6 -5
- package/src/base/editor-context-service.ts +27 -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/layout/di.config.ts +14 -6
- package/src/features/layout/hbox-layout.ts +256 -0
- 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 +22 -12
- package/src/features/validation/marker-navigator.ts +29 -66
- package/src/features/validation/validate.ts +36 -70
- 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
|
@@ -16,15 +16,45 @@
|
|
|
16
16
|
import { Point } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { BoundsAware, SModelElement } from 'sprotty';
|
|
18
18
|
import { ModifyCSSFeedbackAction } from '../tool-feedback/css-feedback';
|
|
19
|
+
/**
|
|
20
|
+
* A `MovementRestrictor` is an optional service that can be used by tools to validate
|
|
21
|
+
* whether a certain move operation (e.g. `ChangeBoundsOperation`) in the diagram is valid.
|
|
22
|
+
*/
|
|
19
23
|
export interface IMovementRestrictor {
|
|
20
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Validate whether moving the given element to a new given location is allowed.
|
|
26
|
+
* @param element The element that should be moved.
|
|
27
|
+
* @param newLocation The new location of the element.
|
|
28
|
+
* @returns `true` if the the element is movable and moving to the given location is allowed, `false` otherwise.
|
|
29
|
+
* Should also return `false` if the newLocation is `undefined`:
|
|
30
|
+
*/
|
|
31
|
+
validate(element: SModelElement, newLocation?: Point): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Feedback css-classes. Can be applied to elements that did fail the validation.
|
|
34
|
+
*/
|
|
21
35
|
cssClasses?: string[];
|
|
22
36
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
/**
|
|
38
|
+
* A `IMovementRestrictor` that checks for overlapping elements. Move operations
|
|
39
|
+
* are only valid if the element does not collide with another element after moving.
|
|
40
|
+
*/
|
|
41
|
+
export declare class NoOverlapMovementRestrictor implements IMovementRestrictor {
|
|
26
42
|
cssClasses: string[];
|
|
27
|
-
validate(
|
|
43
|
+
validate(element: SModelElement, newLocation?: Point): boolean;
|
|
44
|
+
protected areOverlapping(element1: SModelElement & BoundsAware, element2: SModelElement & BoundsAware): boolean;
|
|
28
45
|
}
|
|
29
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Utility function to create an action that applies the given {@link IMovementRestrictor.cssClasses} to the given element.
|
|
48
|
+
* @param element The element on which the css classes should be applied.
|
|
49
|
+
* @param movementRestrictor The movement restrictor whose cssClasses should be applied.
|
|
50
|
+
* @returns The corresponding {@link ModifyCSSFeedbackAction}
|
|
51
|
+
*/
|
|
52
|
+
export declare function createMovementRestrictionFeedback(element: SModelElement, movementRestrictor: IMovementRestrictor): ModifyCSSFeedbackAction;
|
|
53
|
+
/**
|
|
54
|
+
* Utility function to create an action that removes the given {@link IMovementRestrictor.cssClasses} from the given element.
|
|
55
|
+
* @param element The element from which the css classes should be removed.
|
|
56
|
+
* @param movementRestrictor The movement restrictor whose cssClasses should be removed.
|
|
57
|
+
* @returns The corresponding {@link ModifyCSSFeedbackAction}
|
|
58
|
+
*/
|
|
59
|
+
export declare function removeMovementRestrictionFeedback(element: SModelElement, movementRestrictor: IMovementRestrictor): ModifyCSSFeedbackAction;
|
|
30
60
|
//# sourceMappingURL=movement-restrictor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"movement-restrictor.d.ts","sourceRoot":"","sources":["../../../src/features/change-bounds/movement-restrictor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAyB,MAAM,SAAS,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAGxE,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"movement-restrictor.d.ts","sourceRoot":"","sources":["../../../src/features/change-bounds/movement-restrictor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAyB,MAAM,SAAS,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAGxE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IAC/D;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;GAGG;AACH,qBACa,2BAA4B,YAAW,mBAAmB;IACnE,UAAU,WAA4B;IAEtC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,KAAK,GAAG,OAAO;IAsB9D,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,aAAa,GAAG,WAAW,EAAE,QAAQ,EAAE,aAAa,GAAG,WAAW,GAAG,OAAO;CAoBlH;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC7C,OAAO,EAAE,aAAa,EACtB,kBAAkB,EAAE,mBAAmB,GACxC,uBAAuB,CAMzB;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC7C,OAAO,EAAE,aAAa,EACtB,kBAAkB,EAAE,mBAAmB,GACxC,uBAAuB,CAOzB"}
|
|
@@ -6,34 +6,22 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.removeMovementRestrictionFeedback = exports.createMovementRestrictionFeedback = exports.NoOverlapMovementRestrictor = void 0;
|
|
10
10
|
const inversify_1 = require("inversify");
|
|
11
11
|
const sprotty_1 = require("sprotty");
|
|
12
12
|
const viewpoint_util_1 = require("../../utils/viewpoint-util");
|
|
13
13
|
const css_feedback_1 = require("../tool-feedback/css-feedback");
|
|
14
14
|
const model_1 = require("./model");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return css_feedback_1.ModifyCSSFeedbackAction.create({ elements, add: movementRestrictor.cssClasses });
|
|
21
|
-
}
|
|
22
|
-
exports.createMovementRestrictionFeedback = createMovementRestrictionFeedback;
|
|
23
|
-
function removeMovementRestrictionFeedback(element, movementRestrictor) {
|
|
24
|
-
const elements = [element];
|
|
25
|
-
if (element instanceof sprotty_1.SParentElement) {
|
|
26
|
-
element.children.filter(child => child instanceof model_1.SResizeHandle).forEach(e => elements.push(e));
|
|
27
|
-
}
|
|
28
|
-
return css_feedback_1.ModifyCSSFeedbackAction.create({ elements, remove: movementRestrictor.cssClasses });
|
|
29
|
-
}
|
|
30
|
-
exports.removeMovementRestrictionFeedback = removeMovementRestrictionFeedback;
|
|
31
|
-
let NoOverlapMovmentRestrictor = class NoOverlapMovmentRestrictor {
|
|
15
|
+
/**
|
|
16
|
+
* A `IMovementRestrictor` that checks for overlapping elements. Move operations
|
|
17
|
+
* are only valid if the element does not collide with another element after moving.
|
|
18
|
+
*/
|
|
19
|
+
let NoOverlapMovementRestrictor = class NoOverlapMovementRestrictor {
|
|
32
20
|
constructor() {
|
|
33
21
|
this.cssClasses = ['movement-not-allowed'];
|
|
34
22
|
}
|
|
35
|
-
validate(
|
|
36
|
-
if (!(0, model_1.isBoundsAwareMoveable)(element)) {
|
|
23
|
+
validate(element, newLocation) {
|
|
24
|
+
if (!(0, model_1.isBoundsAwareMoveable)(element) || !newLocation) {
|
|
37
25
|
return false;
|
|
38
26
|
}
|
|
39
27
|
// Create ghost element at the newLocation
|
|
@@ -49,29 +37,56 @@ let NoOverlapMovmentRestrictor = class NoOverlapMovmentRestrictor {
|
|
|
49
37
|
return !Array.from(element.root.index
|
|
50
38
|
.all()
|
|
51
39
|
.filter(e => e.id !== ghostElement.id && e !== ghostElement.root && e instanceof sprotty_1.SNode)
|
|
52
|
-
.map(e => e)).some(e => areOverlapping(e, ghostElement));
|
|
40
|
+
.map(e => e)).some(e => this.areOverlapping(e, ghostElement));
|
|
41
|
+
}
|
|
42
|
+
areOverlapping(element1, element2) {
|
|
43
|
+
const b1 = (0, viewpoint_util_1.toAbsoluteBounds)(element1);
|
|
44
|
+
const b2 = (0, viewpoint_util_1.toAbsoluteBounds)(element2);
|
|
45
|
+
const r1TopLeft = b1;
|
|
46
|
+
const r1BottomRight = { x: b1.x + b1.width, y: b1.y + b1.height };
|
|
47
|
+
const r2TopLeft = b2;
|
|
48
|
+
const r2BottomRight = { x: b2.x + b2.width, y: b2.y + b2.height };
|
|
49
|
+
// If one rectangle is on left side of other
|
|
50
|
+
if (r1TopLeft.x > r2BottomRight.x || r2TopLeft.x > r1BottomRight.x) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
// If one rectangle is above other
|
|
54
|
+
if (r1BottomRight.y < r2TopLeft.y || r2BottomRight.y < r1TopLeft.y) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
53
58
|
}
|
|
54
59
|
};
|
|
55
|
-
|
|
60
|
+
NoOverlapMovementRestrictor = __decorate([
|
|
56
61
|
(0, inversify_1.injectable)()
|
|
57
|
-
],
|
|
58
|
-
exports.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (
|
|
68
|
-
|
|
62
|
+
], NoOverlapMovementRestrictor);
|
|
63
|
+
exports.NoOverlapMovementRestrictor = NoOverlapMovementRestrictor;
|
|
64
|
+
/**
|
|
65
|
+
* Utility function to create an action that applies the given {@link IMovementRestrictor.cssClasses} to the given element.
|
|
66
|
+
* @param element The element on which the css classes should be applied.
|
|
67
|
+
* @param movementRestrictor The movement restrictor whose cssClasses should be applied.
|
|
68
|
+
* @returns The corresponding {@link ModifyCSSFeedbackAction}
|
|
69
|
+
*/
|
|
70
|
+
function createMovementRestrictionFeedback(element, movementRestrictor) {
|
|
71
|
+
const elements = [element];
|
|
72
|
+
if (element instanceof sprotty_1.SParentElement) {
|
|
73
|
+
element.children.filter(child => child instanceof model_1.SResizeHandle).forEach(e => elements.push(e));
|
|
69
74
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
return css_feedback_1.ModifyCSSFeedbackAction.create({ elements, add: movementRestrictor.cssClasses });
|
|
76
|
+
}
|
|
77
|
+
exports.createMovementRestrictionFeedback = createMovementRestrictionFeedback;
|
|
78
|
+
/**
|
|
79
|
+
* Utility function to create an action that removes the given {@link IMovementRestrictor.cssClasses} from the given element.
|
|
80
|
+
* @param element The element from which the css classes should be removed.
|
|
81
|
+
* @param movementRestrictor The movement restrictor whose cssClasses should be removed.
|
|
82
|
+
* @returns The corresponding {@link ModifyCSSFeedbackAction}
|
|
83
|
+
*/
|
|
84
|
+
function removeMovementRestrictionFeedback(element, movementRestrictor) {
|
|
85
|
+
const elements = [element];
|
|
86
|
+
if (element instanceof sprotty_1.SParentElement) {
|
|
87
|
+
element.children.filter(child => child instanceof model_1.SResizeHandle).forEach(e => elements.push(e));
|
|
73
88
|
}
|
|
74
|
-
return
|
|
89
|
+
return css_feedback_1.ModifyCSSFeedbackAction.create({ elements, remove: movementRestrictor.cssClasses });
|
|
75
90
|
}
|
|
76
|
-
exports.
|
|
91
|
+
exports.removeMovementRestrictionFeedback = removeMovementRestrictionFeedback;
|
|
77
92
|
//# sourceMappingURL=movement-restrictor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"movement-restrictor.js","sourceRoot":"","sources":["../../../src/features/change-bounds/movement-restrictor.ts"],"names":[],"mappings":";;;;;;;;;AAgBA,yCAAuC;AACvC,qCAA4E;AAC5E,+DAA8D;AAC9D,gEAAwE;AACxE,mCAA+D;
|
|
1
|
+
{"version":3,"file":"movement-restrictor.js","sourceRoot":"","sources":["../../../src/features/change-bounds/movement-restrictor.ts"],"names":[],"mappings":";;;;;;;;;AAgBA,yCAAuC;AACvC,qCAA4E;AAC5E,+DAA8D;AAC9D,gEAAwE;AACxE,mCAA+D;AAqB/D;;;GAGG;AAEH,IAAa,2BAA2B,GAAxC,MAAa,2BAA2B;IAAxC;QACI,eAAU,GAAG,CAAC,sBAAsB,CAAC,CAAC;IA4C1C,CAAC;IA1CG,QAAQ,CAAC,OAAsB,EAAE,WAAmB;QAChD,IAAI,CAAC,IAAA,6BAAqB,EAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;YACjD,OAAO,KAAK,CAAC;SAChB;QACD,0CAA0C;QAC1C,MAAM,YAAY,GAAG,MAAM,CAAC,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,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KACnG;IAED,OAAO,sCAAuB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,CAAC,UAAU,EAAE,CAAC,CAAC;AAC/F,CAAC;AAVD,8EAUC"}
|
|
@@ -13,12 +13,27 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Point } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { Point, Writable } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { ISnapper, SModelElement } from 'sprotty';
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* A {@link ISnapper} implementation that snaps all elements onto a fixed gride size.
|
|
20
|
+
* The default grid size is 10x10 pixel.
|
|
21
|
+
* To configure a custom grid size bind the `TYPES.ISnapper` service identifier
|
|
22
|
+
* to constant value, e.g:
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* bind(TYPES.ISnapper).toConstantValue(new GridSnapper({x:25 ,y:25 }));
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
19
28
|
export declare class GridSnapper implements ISnapper {
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
grid: {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
};
|
|
33
|
+
constructor(grid?: {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
});
|
|
22
37
|
snap(position: Point, element: SModelElement): Point;
|
|
23
38
|
}
|
|
24
39
|
/**
|
|
@@ -32,7 +47,7 @@ export declare class GridSnapper implements ISnapper {
|
|
|
32
47
|
export declare class PointPositionUpdater {
|
|
33
48
|
protected snapper?: ISnapper | undefined;
|
|
34
49
|
protected lastDragPosition?: Point;
|
|
35
|
-
protected positionDelta:
|
|
50
|
+
protected positionDelta: Writable<Point>;
|
|
36
51
|
constructor(snapper?: ISnapper | undefined);
|
|
37
52
|
/**
|
|
38
53
|
* Init the position with the {@link Point} of your mouse cursor.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snap.d.ts","sourceRoot":"","sources":["../../../src/features/change-bounds/snap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"snap.d.ts","sourceRoot":"","sources":["../../../src/features/change-bounds/snap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAuB,QAAQ,EAAc,aAAa,EAAE,MAAM,SAAS,CAAC;AAEnF;;;;;;;;;GASG;AACH,qBACa,WAAY,YAAW,QAAQ;IACrB,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;gBAA9B,IAAI,GAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAqB;IAEpE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK;CAMvD;AAED;;;;;;;GAOG;AACH,qBAAa,oBAAoB;IAIjB,SAAS,CAAC,OAAO,CAAC;IAH9B,SAAS,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACnC,SAAS,CAAC,aAAa,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAkB;gBAEpC,OAAO,CAAC,sBAAU;IAExC;;;;OAIG;IACI,sBAAsB,CAAC,aAAa,EAAE,KAAK,GAAG,IAAI;IAIzD;;;OAGG;IACI,2BAA2B,IAAI,OAAO;IAI7C;;;OAGG;IACI,aAAa,IAAI,IAAI;IAK5B;;;;;;;OAOG;IACI,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS;IA8B7G,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,GAAG,KAAK;CAGlF"}
|
|
@@ -5,26 +5,37 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
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
|
+
};
|
|
8
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
12
|
exports.PointPositionUpdater = exports.GridSnapper = void 0;
|
|
10
13
|
const inversify_1 = require("inversify");
|
|
11
14
|
const sprotty_1 = require("sprotty");
|
|
15
|
+
/**
|
|
16
|
+
* A {@link ISnapper} implementation that snaps all elements onto a fixed gride size.
|
|
17
|
+
* The default grid size is 10x10 pixel.
|
|
18
|
+
* To configure a custom grid size bind the `TYPES.ISnapper` service identifier
|
|
19
|
+
* to constant value, e.g:
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* bind(TYPES.ISnapper).toConstantValue(new GridSnapper({x:25 ,y:25 }));
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
12
25
|
let GridSnapper = class GridSnapper {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
get gridY() {
|
|
17
|
-
return 10;
|
|
26
|
+
constructor(grid = { x: 10, y: 10 }) {
|
|
27
|
+
this.grid = grid;
|
|
18
28
|
}
|
|
19
29
|
snap(position, element) {
|
|
20
30
|
return {
|
|
21
|
-
x: Math.round(position.x / this.
|
|
22
|
-
y: Math.round(position.y / this.
|
|
31
|
+
x: Math.round(position.x / this.grid.x) * this.grid.x,
|
|
32
|
+
y: Math.round(position.y / this.grid.y) * this.grid.y
|
|
23
33
|
};
|
|
24
34
|
}
|
|
25
35
|
};
|
|
26
36
|
GridSnapper = __decorate([
|
|
27
|
-
(0, inversify_1.injectable)()
|
|
37
|
+
(0, inversify_1.injectable)(),
|
|
38
|
+
__metadata("design:paramtypes", [Object])
|
|
28
39
|
], GridSnapper);
|
|
29
40
|
exports.GridSnapper = GridSnapper;
|
|
30
41
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snap.js","sourceRoot":"","sources":["../../../src/features/change-bounds/snap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"snap.js","sourceRoot":"","sources":["../../../src/features/change-bounds/snap.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yCAAuC;AACvC,qCAAmF;AAEnF;;;;;;;;;GASG;AAEH,IAAa,WAAW,GAAxB,MAAa,WAAW;IACpB,YAAmB,OAAiC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;QAAjD,SAAI,GAAJ,IAAI,CAA6C;IAAG,CAAC;IAExE,IAAI,CAAC,QAAe,EAAE,OAAsB;QACxC,OAAO;YACH,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;SACxD,CAAC;IACN,CAAC;CACJ,CAAA;AATY,WAAW;IADvB,IAAA,sBAAU,GAAE;;GACA,WAAW,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eAAe,CAAC;YAExC,0CAA0C;YAC1C,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC;YAC9C,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC;YAE9C,uEAAuE;YACvE,2DAA2D;YAC3D,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;YAC5E,IAAI,cAAc,CAAC,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,CAAC,KAAK,CAAC,EAAE;gBAClD,OAAO,SAAS,CAAC;aACpB;YAED,wEAAwE;YACxE,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC;YACzC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC;YACzC,OAAO,cAAc,CAAC;SACzB;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAES,IAAI,CAAC,QAAe,EAAE,OAAsB,EAAE,MAAe;QACnE,OAAO,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;IAC5G,CAAC;CACJ;AAzED,oDAyEC"}
|
|
@@ -17,25 +17,23 @@ import { Action } from '@eclipse-glsp/protocol';
|
|
|
17
17
|
import { ContextMenuProviderRegistry, IContextMenuServiceProvider, MouseListener, SModelElement } from 'sprotty';
|
|
18
18
|
import { SelectionService } from '../select/selection-service';
|
|
19
19
|
export declare class SelectionServiceAwareContextMenuMouseListener extends MouseListener {
|
|
20
|
-
protected readonly contextMenuService
|
|
21
|
-
protected readonly menuProvider
|
|
20
|
+
protected readonly contextMenuService?: IContextMenuServiceProvider;
|
|
21
|
+
protected readonly menuProvider?: ContextMenuProviderRegistry;
|
|
22
22
|
protected selectionService: SelectionService;
|
|
23
23
|
/**
|
|
24
|
-
* Opens the context menu
|
|
24
|
+
* Opens the context menu.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
contextMenu(target: SModelElement, event: MouseEvent): (Action | Promise<Action>)[];
|
|
27
27
|
/**
|
|
28
28
|
* Opens the context menu.
|
|
29
29
|
*
|
|
30
|
-
* - query the element on the click-target
|
|
31
|
-
* - select the element
|
|
32
30
|
* - query the context menu service and the context menu elements
|
|
33
31
|
* - show the context menu
|
|
34
32
|
* - send a focus state change to indicate that the diagram becomes inactive, once the context menu is shown
|
|
35
33
|
*
|
|
36
34
|
* When the context menu is closed, we focus the diagram element again.
|
|
37
35
|
*/
|
|
38
|
-
protected openContextMenu(
|
|
36
|
+
protected openContextMenu(target: SModelElement, event: MouseEvent): Promise<Action>[];
|
|
39
37
|
protected focusEventTarget(event: MouseEvent): void;
|
|
40
38
|
}
|
|
41
39
|
//# sourceMappingURL=selection-service-aware-context-menu-mouse-listener.d.ts.map
|
package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-service-aware-context-menu-mouse-listener.d.ts","sourceRoot":"","sources":["../../../src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,
|
|
1
|
+
{"version":3,"file":"selection-service-aware-context-menu-mouse-listener.d.ts","sourceRoot":"","sources":["../../../src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,qBACa,6CAA8C,SAAQ,aAAa;IAG5E,SAAS,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,2BAA2B,CAAC;IAIpE,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,2BAA2B,CAAC;IAG9D,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAE7C;;OAEG;IACM,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE;IAI5F;;;;;;;;OAQG;IACH,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE;IActF,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CAOtD"}
|
|
@@ -17,32 +17,25 @@ const types_1 = require("../../base/types");
|
|
|
17
17
|
const selection_service_1 = require("../select/selection-service");
|
|
18
18
|
let SelectionServiceAwareContextMenuMouseListener = class SelectionServiceAwareContextMenuMouseListener extends sprotty_1.MouseListener {
|
|
19
19
|
/**
|
|
20
|
-
* Opens the context menu
|
|
20
|
+
* Opens the context menu.
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return this.openContextMenu(event, target);
|
|
25
|
-
}
|
|
26
|
-
return [];
|
|
22
|
+
contextMenu(target, event) {
|
|
23
|
+
return this.openContextMenu(target, event);
|
|
27
24
|
}
|
|
28
25
|
/**
|
|
29
26
|
* Opens the context menu.
|
|
30
27
|
*
|
|
31
|
-
* - query the element on the click-target
|
|
32
|
-
* - select the element
|
|
33
28
|
* - query the context menu service and the context menu elements
|
|
34
29
|
* - show the context menu
|
|
35
30
|
* - send a focus state change to indicate that the diagram becomes inactive, once the context menu is shown
|
|
36
31
|
*
|
|
37
32
|
* When the context menu is closed, we focus the diagram element again.
|
|
38
33
|
*/
|
|
39
|
-
openContextMenu(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (selectableTarget) {
|
|
43
|
-
selectableTarget.selected = true;
|
|
44
|
-
this.selectionService.updateSelection(target.root, [selectableTarget.id], []);
|
|
34
|
+
openContextMenu(target, event) {
|
|
35
|
+
if (!this.contextMenuService || !this.menuProvider) {
|
|
36
|
+
return [];
|
|
45
37
|
}
|
|
38
|
+
const mousePosition = { x: event.x, y: event.y };
|
|
46
39
|
const result = Promise.all([this.contextMenuService(), this.menuProvider.getItems(target.root, mousePosition)])
|
|
47
40
|
.then(([menuService, menuItems]) => menuService.show(menuItems, mousePosition, () => this.focusEventTarget(event)))
|
|
48
41
|
.then(() => focus_change_action_1.FocusStateChangedAction.create(false));
|
package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-service-aware-context-menu-mouse-listener.js","sourceRoot":"","sources":["../../../src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yCAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"selection-service-aware-context-menu-mouse-listener.js","sourceRoot":"","sources":["../../../src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yCAAyD;AACzD,qCAAiH;AACjH,gFAAiF;AACjF,4CAAyC;AACzC,mEAA+D;AAG/D,IAAa,6CAA6C,GAA1D,MAAa,6CAA8C,SAAQ,uBAAa;IAY5E;;OAEG;IACM,WAAW,CAAC,MAAqB,EAAE,KAAiB;QACzD,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;;OAQG;IACO,eAAe,CAAC,MAAqB,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,GAAE;8BACuB,qCAA2B;mFAAC;AAG9D;IADC,IAAA,kBAAM,EAAC,aAAK,CAAC,gBAAgB,CAAC;8BACH,oCAAgB;uFAAC;AAVpC,6CAA6C;IADzD,IAAA,sBAAU,GAAE;GACA,6CAA6C,CAiDzD;AAjDY,sGAA6C"}
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { ContainerModule } from 'inversify';
|
|
17
|
-
declare const
|
|
18
|
-
export default
|
|
17
|
+
declare const layoutModule: ContainerModule;
|
|
18
|
+
export default layoutModule;
|
|
19
19
|
//# sourceMappingURL=di.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"di.config.d.ts","sourceRoot":"","sources":["../../../src/features/layout/di.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"di.config.d.ts","sourceRoot":"","sources":["../../../src/features/layout/di.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAY5C,QAAA,MAAM,YAAY,iBAQhB,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -18,13 +18,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
const inversify_1 = require("inversify");
|
|
19
19
|
const sprotty_1 = require("sprotty");
|
|
20
20
|
const freeform_layout_1 = require("./freeform-layout");
|
|
21
|
-
const
|
|
21
|
+
const hbox_layout_1 = require("./hbox-layout");
|
|
22
|
+
const layout_elements_action_1 = require("./layout-elements-action");
|
|
22
23
|
const vbox_layout_1 = require("./vbox-layout");
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
(0, sprotty_1.
|
|
24
|
+
const layoutModule = new inversify_1.ContainerModule((bind, _unbind, isBound, rebind) => {
|
|
25
|
+
const context = { bind, isBound };
|
|
26
|
+
(0, sprotty_1.configureActionHandler)(context, layout_elements_action_1.ResizeElementsAction.KIND, layout_elements_action_1.ResizeElementsActionHandler);
|
|
27
|
+
(0, sprotty_1.configureActionHandler)(context, layout_elements_action_1.AlignElementsAction.KIND, layout_elements_action_1.AlignElementsActionHandler);
|
|
26
28
|
rebind(sprotty_1.VBoxLayouter).to(vbox_layout_1.VBoxLayouterExt);
|
|
29
|
+
rebind(sprotty_1.HBoxLayouter).to(hbox_layout_1.HBoxLayouterExt);
|
|
27
30
|
(0, sprotty_1.configureLayout)({ bind, isBound }, freeform_layout_1.FreeFormLayouter.KIND, freeform_layout_1.FreeFormLayouter);
|
|
28
31
|
});
|
|
29
|
-
exports.default =
|
|
32
|
+
exports.default = layoutModule;
|
|
30
33
|
//# sourceMappingURL=di.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"di.config.js","sourceRoot":"","sources":["../../../src/features/layout/di.config.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"di.config.js","sourceRoot":"","sources":["../../../src/features/layout/di.config.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAA4C;AAC5C,qCAA8F;AAC9F,uDAAqD;AACrD,+CAAgD;AAChD,qEAKkC;AAClC,+CAAgD;AAEhD,MAAM,YAAY,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IACxE,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAClC,IAAA,gCAAsB,EAAC,OAAO,EAAE,6CAAoB,CAAC,IAAI,EAAE,oDAA2B,CAAC,CAAC;IACxF,IAAA,gCAAsB,EAAC,OAAO,EAAE,4CAAmB,CAAC,IAAI,EAAE,mDAA0B,CAAC,CAAC;IAEtF,MAAM,CAAC,sBAAY,CAAC,CAAC,EAAE,CAAC,6BAAe,CAAC,CAAC;IACzC,MAAM,CAAC,sBAAY,CAAC,CAAC,EAAE,CAAC,6BAAe,CAAC,CAAC;IACzC,IAAA,yBAAe,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,kCAAgB,CAAC,IAAI,EAAE,kCAAgB,CAAC,CAAC;AAChF,CAAC,CAAC,CAAC;AAEH,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2021-2022 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, Dimension, Point } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { BoundsData, LayoutContainer, SChildElement, SModelElement, SParentElement, StatefulLayouter, HBoxLayouter, HBoxLayoutOptions } from 'sprotty';
|
|
18
|
+
export interface HBoxLayoutOptionsExt extends HBoxLayoutOptions {
|
|
19
|
+
hGrab: boolean;
|
|
20
|
+
vGrab: boolean;
|
|
21
|
+
prefWidth: number | null;
|
|
22
|
+
prefHeight: number | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Extends HBoxLayouter to support additional layout options
|
|
26
|
+
*/
|
|
27
|
+
export declare class HBoxLayouterExt extends HBoxLayouter {
|
|
28
|
+
static KIND: string;
|
|
29
|
+
layout(container: SParentElement & LayoutContainer, layouter: StatefulLayouter): void;
|
|
30
|
+
protected getChildrenSize(container: SParentElement & LayoutContainer, containerOptions: HBoxLayoutOptionsExt, layouter: StatefulLayouter): Dimension;
|
|
31
|
+
protected layoutChildren(container: SParentElement & LayoutContainer, layouter: StatefulLayouter, containerOptions: HBoxLayoutOptionsExt, maxWidth: number, maxHeight: number, grabWidth?: number, grabbingChildren?: number): Point;
|
|
32
|
+
protected layoutChild(child: SChildElement, boundsData: BoundsData, bounds: Bounds, childOptions: HBoxLayoutOptionsExt, containerOptions: HBoxLayoutOptionsExt, currentOffset: Point, maxWidth: number, maxHeight: number, grabWidth?: number, grabbingChildren?: number): Point;
|
|
33
|
+
protected getFixedContainerBounds(container: SModelElement, layoutOptions: HBoxLayoutOptionsExt, layouter: StatefulLayouter): Bounds;
|
|
34
|
+
protected getChildLayoutOptions(child: SChildElement, containerOptions: HBoxLayoutOptionsExt): HBoxLayoutOptionsExt;
|
|
35
|
+
protected getLayoutOptions(element: SModelElement): HBoxLayoutOptionsExt;
|
|
36
|
+
protected getElementLayoutOptions(element: SModelElement): HBoxLayoutOptionsExt | undefined;
|
|
37
|
+
protected getFinalContainerBounds(container: SParentElement & LayoutContainer, lastOffset: Point, options: HBoxLayoutOptionsExt, maxWidth: number, maxHeight: number): Bounds;
|
|
38
|
+
protected getDefaultLayoutOptions(): HBoxLayoutOptionsExt;
|
|
39
|
+
protected spread(a: HBoxLayoutOptionsExt, b: HBoxLayoutOptionsExt): HBoxLayoutOptionsExt;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=hbox-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hbox-layout.d.ts","sourceRoot":"","sources":["../../../src/features/layout/hbox-layout.ts"],"names":[],"mappings":"AAAA;;;;;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