@eclipse-glsp/client 2.2.0-next.329 → 2.2.0-next.330
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/change-bounds.css +15 -0
- package/css/glsp-sprotty.css +17 -0
- package/lib/base/drag-aware-mouse-listener.d.ts +5 -2
- package/lib/base/drag-aware-mouse-listener.d.ts.map +1 -1
- package/lib/base/drag-aware-mouse-listener.js +11 -0
- package/lib/base/drag-aware-mouse-listener.js.map +1 -1
- package/lib/base/feedback/css-feedback.d.ts +4 -0
- package/lib/base/feedback/css-feedback.d.ts.map +1 -1
- package/lib/base/feedback/css-feedback.js +4 -0
- package/lib/base/feedback/css-feedback.js.map +1 -1
- package/lib/base/feedback/feeback-emitter.d.ts +67 -0
- package/lib/base/feedback/feeback-emitter.d.ts.map +1 -0
- package/lib/base/feedback/feeback-emitter.js +109 -0
- package/lib/base/feedback/feeback-emitter.js.map +1 -0
- package/lib/base/feedback/feedback-action-dispatcher.d.ts +17 -5
- package/lib/base/feedback/feedback-action-dispatcher.d.ts.map +1 -1
- package/lib/base/feedback/feedback-action-dispatcher.js +23 -3
- package/lib/base/feedback/feedback-action-dispatcher.js.map +1 -1
- package/lib/base/feedback/index.d.ts +1 -0
- package/lib/base/feedback/index.d.ts.map +1 -1
- package/lib/base/feedback/index.js +1 -0
- package/lib/base/feedback/index.js.map +1 -1
- package/lib/base/selection-service.d.ts +3 -2
- package/lib/base/selection-service.d.ts.map +1 -1
- package/lib/base/selection-service.js.map +1 -1
- package/lib/features/accessibility/element-navigation/local-element-navigator.d.ts +3 -3
- package/lib/features/accessibility/element-navigation/local-element-navigator.d.ts.map +1 -1
- package/lib/features/accessibility/element-navigation/local-element-navigator.js.map +1 -1
- package/lib/features/accessibility/move-zoom/move-handler.d.ts +4 -2
- package/lib/features/accessibility/move-zoom/move-handler.d.ts.map +1 -1
- package/lib/features/accessibility/move-zoom/move-handler.js +10 -4
- package/lib/features/accessibility/move-zoom/move-handler.js.map +1 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-handler.d.ts +4 -2
- 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 -3
- package/lib/features/accessibility/resize-key-tool/resize-key-handler.js.map +1 -1
- package/lib/features/change-bounds/model.d.ts +8 -8
- package/lib/features/change-bounds/model.d.ts.map +1 -1
- package/lib/features/change-bounds/model.js +17 -5
- package/lib/features/change-bounds/model.js.map +1 -1
- package/lib/features/change-bounds/movement-restrictor.d.ts +3 -2
- package/lib/features/change-bounds/movement-restrictor.d.ts.map +1 -1
- package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
- package/lib/features/element-template/mouse-tracking-element-position-listener.d.ts +15 -5
- package/lib/features/element-template/mouse-tracking-element-position-listener.d.ts.map +1 -1
- package/lib/features/element-template/mouse-tracking-element-position-listener.js +27 -38
- package/lib/features/element-template/mouse-tracking-element-position-listener.js.map +1 -1
- package/lib/features/helper-lines/helper-line-manager-default.d.ts +4 -2
- package/lib/features/helper-lines/helper-line-manager-default.d.ts.map +1 -1
- package/lib/features/helper-lines/helper-line-manager-default.js +8 -12
- package/lib/features/helper-lines/helper-line-manager-default.js.map +1 -1
- package/lib/features/hints/type-hint-provider.d.ts +3 -0
- package/lib/features/hints/type-hint-provider.d.ts.map +1 -1
- package/lib/features/hints/type-hint-provider.js +10 -1
- package/lib/features/hints/type-hint-provider.js.map +1 -1
- package/lib/features/select/select-mouse-listener.d.ts +4 -3
- package/lib/features/select/select-mouse-listener.d.ts.map +1 -1
- package/lib/features/select/select-mouse-listener.js.map +1 -1
- package/lib/features/tools/base-tools.d.ts +23 -4
- package/lib/features/tools/base-tools.d.ts.map +1 -1
- package/lib/features/tools/base-tools.js +11 -6
- package/lib/features/tools/base-tools.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.d.ts +1 -35
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js +5 -206
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-module.d.ts +1 -0
- package/lib/features/tools/change-bounds/change-bounds-tool-module.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-module.js +1 -0
- package/lib/features/tools/change-bounds/change-bounds-tool-module.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.d.ts +67 -0
- package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.d.ts.map +1 -0
- package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.js +227 -0
- package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.js.map +1 -0
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts +34 -24
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.js +172 -180
- package/lib/features/tools/change-bounds/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/change-bounds/index.d.ts +1 -0
- package/lib/features/tools/change-bounds/index.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/index.js +1 -0
- package/lib/features/tools/change-bounds/index.js.map +1 -1
- package/lib/features/tools/change-bounds/view.d.ts +1 -1
- package/lib/features/tools/change-bounds/view.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/view.js +3 -0
- package/lib/features/tools/change-bounds/view.js.map +1 -1
- package/lib/features/tools/deletion/delete-tool.d.ts +16 -1
- package/lib/features/tools/deletion/delete-tool.d.ts.map +1 -1
- package/lib/features/tools/deletion/delete-tool.js +5 -2
- package/lib/features/tools/deletion/delete-tool.js.map +1 -1
- package/lib/features/tools/edge-creation/dangling-edge-feedback.d.ts +17 -1
- package/lib/features/tools/edge-creation/dangling-edge-feedback.d.ts.map +1 -1
- package/lib/features/tools/edge-creation/dangling-edge-feedback.js +3 -1
- package/lib/features/tools/edge-creation/dangling-edge-feedback.js.map +1 -1
- package/lib/features/tools/edge-creation/edge-creation-tool-feedback.d.ts +3 -1
- package/lib/features/tools/edge-creation/edge-creation-tool-feedback.d.ts.map +1 -1
- package/lib/features/tools/edge-creation/edge-creation-tool-feedback.js +4 -7
- package/lib/features/tools/edge-creation/edge-creation-tool-feedback.js.map +1 -1
- package/lib/features/tools/edge-creation/edge-creation-tool.d.ts +20 -2
- package/lib/features/tools/edge-creation/edge-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-creation/edge-creation-tool.js +23 -18
- package/lib/features/tools/edge-creation/edge-creation-tool.js.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool-feedback.d.ts +3 -1
- package/lib/features/tools/edge-edit/edge-edit-tool-feedback.d.ts.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool-feedback.js +5 -8
- package/lib/features/tools/edge-edit/edge-edit-tool-feedback.js.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool.d.ts +4 -4
- package/lib/features/tools/edge-edit/edge-edit-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool.js +27 -44
- package/lib/features/tools/edge-edit/edge-edit-tool.js.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.d.ts +3 -2
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.d.ts.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.js +4 -2
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.js.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.d.ts +14 -5
- package/lib/features/tools/node-creation/node-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.js +58 -24
- package/lib/features/tools/node-creation/node-creation-tool.js.map +1 -1
- package/lib/features/validation/marker-navigator.d.ts +7 -6
- package/lib/features/validation/marker-navigator.d.ts.map +1 -1
- package/lib/features/validation/marker-navigator.js.map +1 -1
- package/lib/features/validation/validate.d.ts +2 -5
- package/lib/features/validation/validate.d.ts.map +1 -1
- package/lib/features/validation/validate.js +4 -16
- package/lib/features/validation/validate.js.map +1 -1
- package/lib/utils/gmodel-util.d.ts +27 -2
- package/lib/utils/gmodel-util.d.ts.map +1 -1
- package/lib/utils/gmodel-util.js +30 -1
- package/lib/utils/gmodel-util.js.map +1 -1
- package/lib/utils/layout-utils.d.ts +8 -7
- package/lib/utils/layout-utils.d.ts.map +1 -1
- package/lib/utils/layout-utils.js +2 -4
- package/lib/utils/layout-utils.js.map +1 -1
- package/lib/utils/viewpoint-util.d.ts +4 -4
- package/lib/utils/viewpoint-util.d.ts.map +1 -1
- package/lib/utils/viewpoint-util.js.map +1 -1
- package/package.json +3 -3
- package/src/base/drag-aware-mouse-listener.ts +16 -2
- package/src/base/feedback/css-feedback.ts +4 -0
- package/src/base/feedback/feeback-emitter.ts +112 -0
- package/src/base/feedback/feedback-action-dispatcher.ts +41 -6
- package/src/base/feedback/index.ts +1 -0
- package/src/base/selection-service.spec.ts +5 -0
- package/src/base/selection-service.ts +2 -3
- package/src/features/accessibility/element-navigation/local-element-navigator.ts +4 -4
- package/src/features/accessibility/move-zoom/move-handler.ts +10 -5
- package/src/features/accessibility/resize-key-tool/resize-key-handler.ts +11 -7
- package/src/features/change-bounds/model.ts +25 -13
- package/src/features/change-bounds/movement-restrictor.ts +5 -4
- package/src/features/element-template/mouse-tracking-element-position-listener.ts +44 -44
- package/src/features/helper-lines/helper-line-manager-default.ts +12 -21
- package/src/features/hints/type-hint-provider.spec.ts +4 -1
- package/src/features/hints/type-hint-provider.ts +9 -2
- package/src/features/select/select-mouse-listener.ts +4 -3
- package/src/features/tools/base-tools.ts +15 -8
- package/src/features/tools/change-bounds/change-bounds-tool-feedback.ts +6 -232
- package/src/features/tools/change-bounds/change-bounds-tool-module.ts +1 -0
- package/src/features/tools/change-bounds/change-bounds-tool-move-feedback.ts +254 -0
- package/src/features/tools/change-bounds/change-bounds-tool.ts +217 -226
- package/src/features/tools/change-bounds/index.ts +1 -0
- package/src/features/tools/change-bounds/view.tsx +4 -1
- package/src/features/tools/deletion/delete-tool.ts +6 -6
- package/src/features/tools/edge-creation/dangling-edge-feedback.ts +7 -4
- package/src/features/tools/edge-creation/edge-creation-tool-feedback.ts +9 -9
- package/src/features/tools/edge-creation/edge-creation-tool.ts +33 -23
- package/src/features/tools/edge-edit/edge-edit-tool-feedback.ts +8 -8
- package/src/features/tools/edge-edit/edge-edit-tool.ts +42 -49
- package/src/features/tools/marquee-selection/marquee-mouse-tool.ts +7 -6
- package/src/features/tools/node-creation/node-creation-tool.ts +69 -25
- package/src/features/validation/marker-navigator.ts +6 -8
- package/src/features/validation/validate.ts +5 -20
- package/src/utils/gmodel-util.ts +44 -1
- package/src/utils/layout-utils.ts +9 -20
- package/src/utils/viewpoint-util.ts +3 -4
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Action,
|
|
1
|
+
import { Action, BoundsAware, Dimension, Disposable, EdgeRouterRegistry, ElementAndBounds, GModelElement, GModelRoot, GParentElement, MouseListener, Operation, Point } from '@eclipse-glsp/sprotty';
|
|
2
2
|
import { DragAwareMouseListener } from '../../../base/drag-aware-mouse-listener';
|
|
3
|
+
import { FeedbackEmitter } from '../../../base/feedback/feeback-emitter';
|
|
3
4
|
import { ISelectionListener, SelectionService } from '../../../base/selection-service';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
5
|
+
import { BoundsAwareModelElement, ResizableModelElement } from '../../../utils/gmodel-util';
|
|
6
|
+
import { PointPositionUpdater } from '../../change-bounds';
|
|
7
|
+
import { SResizeHandle } from '../../change-bounds/model';
|
|
6
8
|
import { IMovementRestrictor } from '../../change-bounds/movement-restrictor';
|
|
7
9
|
import { PositionSnapper } from '../../change-bounds/position-snapper';
|
|
8
10
|
import { BaseEditTool } from '../base-tools';
|
|
@@ -30,40 +32,48 @@ export declare class ChangeBoundsTool extends BaseEditTool {
|
|
|
30
32
|
protected createMoveMouseListener(): MouseListener;
|
|
31
33
|
protected createChangeBoundsListener(): MouseListener & ISelectionListener;
|
|
32
34
|
}
|
|
35
|
+
export interface ValidatedElementAndBounds extends ElementAndBounds {
|
|
36
|
+
valid: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare namespace ValidatedElementAndBounds {
|
|
39
|
+
function isValid(move: ElementAndBounds): boolean;
|
|
40
|
+
}
|
|
33
41
|
export declare class ChangeBoundsListener extends DragAwareMouseListener implements ISelectionListener, Disposable {
|
|
34
42
|
protected tool: ChangeBoundsTool;
|
|
35
43
|
static readonly CSS_CLASS_ACTIVE = "active";
|
|
36
|
-
protected initialBounds:
|
|
37
|
-
protected
|
|
38
|
-
protected activeResizeElement?:
|
|
44
|
+
protected initialBounds: ElementAndBounds | undefined;
|
|
45
|
+
protected positionUpdater: PointPositionUpdater;
|
|
46
|
+
protected activeResizeElement?: ResizableModelElement;
|
|
39
47
|
protected activeResizeHandle?: SResizeHandle;
|
|
48
|
+
protected handleFeedback: FeedbackEmitter;
|
|
49
|
+
protected resizeFeedback: FeedbackEmitter;
|
|
40
50
|
constructor(tool: ChangeBoundsTool);
|
|
41
51
|
mouseDown(target: GModelElement, event: MouseEvent): Action[];
|
|
42
|
-
|
|
52
|
+
protected updateResizeElement(target: GModelElement, event?: MouseEvent): boolean;
|
|
53
|
+
protected findResizeElement(target: GModelElement): ResizableModelElement | undefined;
|
|
54
|
+
protected draggingMouseMove(target: GModelElement, event: MouseEvent): Action[];
|
|
55
|
+
protected filterResizeOnClient(resize: ValidatedElementAndBounds, positionUpdate: Point): boolean;
|
|
56
|
+
protected addResizeFeedback(resizeActions: ValidatedElementAndBounds[], handle: SResizeHandle, target: GModelElement, event: MouseEvent): void;
|
|
57
|
+
protected resetBoundsAction(): Action[];
|
|
43
58
|
draggingMouseUp(target: GModelElement, _event: MouseEvent): Action[];
|
|
59
|
+
nonDraggingMouseUp(element: GModelElement, event: MouseEvent): Action[];
|
|
44
60
|
protected handleMoveOnServer(target: GModelElement): Action[];
|
|
45
61
|
protected handleMoveElementsOnServer(target: GModelElement): Operation[];
|
|
62
|
+
protected isValidElement(element: BoundsAwareModelElement, selectedElements?: Set<BoundsAwareModelElement>): boolean;
|
|
46
63
|
protected isChildOfSelected(selectedElements: Set<GModelElement>, element: GModelElement): boolean;
|
|
47
64
|
protected handleMoveRoutingPointsOnServer(target: GModelElement): Operation[];
|
|
48
|
-
protected
|
|
65
|
+
protected handleResizeOnServer(activeResizeHandle: SResizeHandle): Action[];
|
|
49
66
|
selectionChanged(root: GModelRoot, selectedElements: string[]): void;
|
|
50
|
-
protected setActiveResizeElement(target: GModelElement): boolean;
|
|
51
67
|
protected isActiveResizeElement(element?: GModelElement): element is GParentElement & BoundsAware;
|
|
52
|
-
protected
|
|
68
|
+
protected handleResizeOnClient(positionUpdate: Point): ValidatedElementAndBounds[];
|
|
69
|
+
protected handleTopLeftResize(resizeElement: ResizableModelElement, positionUpdate: Point): ValidatedElementAndBounds[];
|
|
70
|
+
protected handleTopRightResize(resizeElement: ResizableModelElement, positionUpdate: Point): ValidatedElementAndBounds[];
|
|
71
|
+
protected handleBottomLeftResize(resizeElement: ResizableModelElement, positionUpdate: Point): ValidatedElementAndBounds[];
|
|
72
|
+
protected handleBottomRightResize(resizeElement: ResizableModelElement, positionUpdate: Point): ValidatedElementAndBounds[];
|
|
73
|
+
protected createSetBoundsAction(element: BoundsAwareModelElement, newPosition: Point, newSize: Dimension): ValidatedElementAndBounds[];
|
|
74
|
+
protected isValidSize(element: BoundsAwareModelElement, size: Dimension): boolean;
|
|
75
|
+
protected isValidMove(element: BoundsAwareModelElement, newPosition: Point): boolean;
|
|
76
|
+
protected disposeAllButHandles(): void;
|
|
53
77
|
dispose(): void;
|
|
54
|
-
protected reset(resetBounds?: boolean): void;
|
|
55
|
-
protected resetFeedback(resetBounds?: boolean): void;
|
|
56
|
-
protected resetPosition(): void;
|
|
57
|
-
protected handleResizeOnClient(positionUpdate: Point): Action[];
|
|
58
|
-
protected handleTopLeftResize(resizeElement: GParentElement & Resizable, positionUpdate: Point): Action[];
|
|
59
|
-
protected handleTopRightResize(resizeElement: GParentElement & Resizable, positionUpdate: Point): Action[];
|
|
60
|
-
protected handleBottomLeftResize(resizeElement: GParentElement & Resizable, positionUpdate: Point): Action[];
|
|
61
|
-
protected handleBottomRightResize(resizeElement: GParentElement & Resizable, positionUpdate: Point): Action[];
|
|
62
|
-
protected createChangeBoundsAction(element: GModelElement & BoundsAware): Action[];
|
|
63
|
-
protected createElementAndBounds(element: GModelElement & BoundsAware): ElementAndBounds[];
|
|
64
|
-
protected createSetBoundsAction(element: GModelElement & BoundsAware, x: number, y: number, width: number, height: number): Action[];
|
|
65
|
-
protected isValidBoundChange(element: GModelElement & BoundsAware, newPosition: Point, newSize: Dimension): boolean;
|
|
66
|
-
protected isValidSize(element: GModelElement & BoundsAware, size: Dimension): boolean;
|
|
67
|
-
protected isValidMove(element: GModelElement & BoundsAware, newPosition: Point): boolean;
|
|
68
78
|
}
|
|
69
79
|
//# sourceMappingURL=change-bounds-tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-bounds-tool.d.ts","sourceRoot":"","sources":["../../../../src/features/tools/change-bounds/change-bounds-tool.ts"],"names":[],"mappings":"AAiBA,OAAO,EACH,MAAM,EACN,
|
|
1
|
+
{"version":3,"file":"change-bounds-tool.d.ts","sourceRoot":"","sources":["../../../../src/features/tools/change-bounds/change-bounds-tool.ts"],"names":[],"mappings":"AAiBA,OAAO,EACH,MAAM,EACN,WAAW,EAIX,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAIhB,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,EACb,SAAS,EACT,KAAK,EAGR,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEv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;IAW7B,OAAO,IAAI,IAAI;CAI3B"}
|
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
var ChangeBoundsTool_1;
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.ChangeBoundsListener = exports.ChangeBoundsTool = void 0;
|
|
13
|
+
exports.ChangeBoundsListener = exports.ValidatedElementAndBounds = exports.ChangeBoundsTool = void 0;
|
|
14
14
|
/********************************************************************************
|
|
15
15
|
* Copyright (c) 2019-2023 EclipseSource and others.
|
|
16
16
|
*
|
|
@@ -31,16 +31,17 @@ const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
|
31
31
|
const drag_aware_mouse_listener_1 = require("../../../base/drag-aware-mouse-listener");
|
|
32
32
|
const css_feedback_1 = require("../../../base/feedback/css-feedback");
|
|
33
33
|
const selection_service_1 = require("../../../base/selection-service");
|
|
34
|
-
const
|
|
34
|
+
const utils_1 = require("../../../utils");
|
|
35
35
|
const gmodel_util_1 = require("../../../utils/gmodel-util");
|
|
36
|
-
const
|
|
37
|
-
const
|
|
36
|
+
const bounds_1 = require("../../bounds");
|
|
37
|
+
const change_bounds_1 = require("../../change-bounds");
|
|
38
38
|
const model_1 = require("../../change-bounds/model");
|
|
39
39
|
const movement_restrictor_1 = require("../../change-bounds/movement-restrictor");
|
|
40
40
|
const position_snapper_1 = require("../../change-bounds/position-snapper");
|
|
41
|
-
const
|
|
41
|
+
const helper_lines_1 = require("../../helper-lines");
|
|
42
42
|
const base_tools_1 = require("../base-tools");
|
|
43
43
|
const change_bounds_tool_feedback_1 = require("./change-bounds-tool-feedback");
|
|
44
|
+
const change_bounds_tool_move_feedback_1 = require("./change-bounds-tool-move-feedback");
|
|
44
45
|
/**
|
|
45
46
|
* The change bounds tool has the license to move multiple elements or resize a single element by implementing the ChangeBounds operation.
|
|
46
47
|
* In contrast to Sprotty's implementation this tool only sends a `ChangeBoundsOperationAction` when an operation has finished and does not
|
|
@@ -69,10 +70,10 @@ let ChangeBoundsTool = ChangeBoundsTool_1 = class ChangeBoundsTool extends base_
|
|
|
69
70
|
if (sprotty_1.Disposable.is(changeBoundsListener)) {
|
|
70
71
|
this.toDisposeOnDisable.push(changeBoundsListener);
|
|
71
72
|
}
|
|
72
|
-
this.toDisposeOnDisable.push(this.mouseTool.registerListener(feedbackMoveMouseListener), this.mouseTool.registerListener(changeBoundsListener),
|
|
73
|
+
this.toDisposeOnDisable.push(this.mouseTool.registerListener(feedbackMoveMouseListener), this.mouseTool.registerListener(changeBoundsListener), this.selectionService.onSelectionChanged(change => changeBoundsListener.selectionChanged(change.root, change.selectedElements)));
|
|
73
74
|
}
|
|
74
75
|
createMoveMouseListener() {
|
|
75
|
-
return new
|
|
76
|
+
return new change_bounds_tool_move_feedback_1.FeedbackMoveMouseListener(this);
|
|
76
77
|
}
|
|
77
78
|
createChangeBoundsListener() {
|
|
78
79
|
return new ChangeBoundsListener(this);
|
|
@@ -101,11 +102,21 @@ __decorate([
|
|
|
101
102
|
exports.ChangeBoundsTool = ChangeBoundsTool = ChangeBoundsTool_1 = __decorate([
|
|
102
103
|
(0, inversify_1.injectable)()
|
|
103
104
|
], ChangeBoundsTool);
|
|
105
|
+
var ValidatedElementAndBounds;
|
|
106
|
+
(function (ValidatedElementAndBounds) {
|
|
107
|
+
function isValid(move) {
|
|
108
|
+
var _a;
|
|
109
|
+
return (_a = move.valid) !== null && _a !== void 0 ? _a : true;
|
|
110
|
+
}
|
|
111
|
+
ValidatedElementAndBounds.isValid = isValid;
|
|
112
|
+
})(ValidatedElementAndBounds || (exports.ValidatedElementAndBounds = ValidatedElementAndBounds = {}));
|
|
104
113
|
class ChangeBoundsListener extends drag_aware_mouse_listener_1.DragAwareMouseListener {
|
|
105
114
|
constructor(tool) {
|
|
106
115
|
super();
|
|
107
116
|
this.tool = tool;
|
|
108
|
-
this.
|
|
117
|
+
this.positionUpdater = new change_bounds_1.PointPositionUpdater(tool.positionSnapper);
|
|
118
|
+
this.handleFeedback = tool.createFeedbackEmitter();
|
|
119
|
+
this.resizeFeedback = tool.createFeedbackEmitter();
|
|
109
120
|
}
|
|
110
121
|
mouseDown(target, event) {
|
|
111
122
|
super.mouseDown(target, event);
|
|
@@ -115,83 +126,132 @@ class ChangeBoundsListener extends drag_aware_mouse_listener_1.DragAwareMouseLis
|
|
|
115
126
|
return [];
|
|
116
127
|
}
|
|
117
128
|
// check if we have a resize handle (only single-selection)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
129
|
+
this.updateResizeElement(target, event);
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
updateResizeElement(target, event) {
|
|
133
|
+
var _a, _b;
|
|
134
|
+
this.activeResizeHandle = target instanceof model_1.SResizeHandle ? target : undefined;
|
|
135
|
+
this.activeResizeElement = (_b = (_a = this.activeResizeHandle) === null || _a === void 0 ? void 0 : _a.parent) !== null && _b !== void 0 ? _b : this.findResizeElement(target);
|
|
124
136
|
if (this.activeResizeElement) {
|
|
125
|
-
|
|
137
|
+
if (event) {
|
|
138
|
+
this.positionUpdater.updateLastDragPosition(event);
|
|
139
|
+
}
|
|
140
|
+
this.initialBounds = {
|
|
141
|
+
newSize: this.activeResizeElement.bounds,
|
|
142
|
+
newPosition: this.activeResizeElement.bounds,
|
|
143
|
+
elementId: this.activeResizeElement.id
|
|
144
|
+
};
|
|
145
|
+
this.handleFeedback.add(change_bounds_tool_feedback_1.ShowChangeBoundsToolResizeFeedbackAction.create(this.activeResizeElement.id), change_bounds_tool_feedback_1.HideChangeBoundsToolResizeFeedbackAction.create());
|
|
146
|
+
this.handleFeedback.submit();
|
|
147
|
+
return true;
|
|
126
148
|
}
|
|
127
149
|
else {
|
|
128
|
-
this.
|
|
150
|
+
this.positionUpdater.resetPosition();
|
|
151
|
+
this.handleFeedback.dispose();
|
|
152
|
+
return false;
|
|
129
153
|
}
|
|
130
|
-
return [];
|
|
131
154
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
155
|
+
findResizeElement(target) {
|
|
156
|
+
// check if we have a selected, moveable element (multi-selection allowed)
|
|
157
|
+
// but only allow one element to have the element resize handles
|
|
158
|
+
return (0, sprotty_1.findParentByFeature)(target, model_1.isResizable);
|
|
159
|
+
}
|
|
160
|
+
draggingMouseMove(target, event) {
|
|
161
|
+
// rely on the FeedbackMoveMouseListener to update the element bounds of selected elements
|
|
162
|
+
// consider resize handles ourselves
|
|
163
|
+
if (this.activeResizeHandle && !this.positionUpdater.isLastDragPositionUndefined()) {
|
|
164
|
+
if (!this.initialBounds) {
|
|
165
|
+
const element = this.activeResizeHandle.parent;
|
|
166
|
+
this.initialBounds = { elementId: element.id, newSize: element.bounds, newPosition: element.bounds };
|
|
167
|
+
}
|
|
168
|
+
const positionUpdate = this.positionUpdater.updatePosition(target, event, (0, helper_lines_1.getDirectionFrom)(this.activeResizeHandle.location));
|
|
142
169
|
if (positionUpdate) {
|
|
143
|
-
const resizeActions = this.handleResizeOnClient(positionUpdate);
|
|
144
|
-
|
|
170
|
+
const resizeActions = this.handleResizeOnClient(positionUpdate).filter(action => action);
|
|
171
|
+
if (resizeActions.length > 0) {
|
|
172
|
+
this.resizeFeedback.add(bounds_1.SetBoundsFeedbackAction.create(resizeActions), () => this.resetBoundsAction());
|
|
173
|
+
this.addResizeFeedback(resizeActions, this.activeResizeHandle, target, event);
|
|
174
|
+
this.resizeFeedback.submit();
|
|
175
|
+
}
|
|
145
176
|
}
|
|
146
|
-
this.tool.registerFeedback(actions, this);
|
|
147
177
|
}
|
|
148
|
-
return
|
|
178
|
+
return super.draggingMouseMove(target, event);
|
|
179
|
+
}
|
|
180
|
+
filterResizeOnClient(resize, positionUpdate) {
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
addResizeFeedback(resizeActions, handle, target, event) {
|
|
184
|
+
// handle feedback
|
|
185
|
+
this.resizeFeedback.add((0, css_feedback_1.applyCssClasses)(handle, ChangeBoundsListener.CSS_CLASS_ACTIVE), (0, css_feedback_1.deleteCssClasses)(handle, ChangeBoundsListener.CSS_CLASS_ACTIVE));
|
|
186
|
+
// cursor feedback
|
|
187
|
+
const cursorClass = handle.isNeResize()
|
|
188
|
+
? css_feedback_1.CursorCSS.RESIZE_NE
|
|
189
|
+
: handle.isNwResize()
|
|
190
|
+
? css_feedback_1.CursorCSS.RESIZE_NW
|
|
191
|
+
: handle.isSeResize()
|
|
192
|
+
? css_feedback_1.CursorCSS.RESIZE_SE
|
|
193
|
+
: css_feedback_1.CursorCSS.RESIZE_SW;
|
|
194
|
+
this.resizeFeedback.add((0, css_feedback_1.cursorFeedbackAction)(cursorClass), (0, css_feedback_1.cursorFeedbackAction)(css_feedback_1.CursorCSS.DEFAULT));
|
|
195
|
+
// restriction feedback
|
|
196
|
+
resizeActions.forEach(elementResize => {
|
|
197
|
+
const element = handle.root.index.getById(elementResize.elementId);
|
|
198
|
+
if (element && this.tool.movementRestrictor) {
|
|
199
|
+
if (!elementResize.valid) {
|
|
200
|
+
this.resizeFeedback.add((0, movement_restrictor_1.createMovementRestrictionFeedback)(element, this.tool.movementRestrictor), () => (0, movement_restrictor_1.removeMovementRestrictionFeedback)(element, this.tool.movementRestrictor));
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
this.resizeFeedback.add((0, movement_restrictor_1.removeMovementRestrictionFeedback)(element, this.tool.movementRestrictor));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
resetBoundsAction() {
|
|
209
|
+
// reset the bounds to the initial bounds and ensure that we do not show helper line feedback anymore (MoveFinishedEventAction)
|
|
210
|
+
return this.initialBounds
|
|
211
|
+
? [bounds_1.SetBoundsFeedbackAction.create([this.initialBounds]), change_bounds_tool_feedback_1.MoveFinishedEventAction.create()]
|
|
212
|
+
: [change_bounds_tool_feedback_1.MoveFinishedEventAction.create()];
|
|
149
213
|
}
|
|
150
214
|
draggingMouseUp(target, _event) {
|
|
151
|
-
if (this.
|
|
152
|
-
this.resetPosition();
|
|
215
|
+
if (this.positionUpdater.isLastDragPositionUndefined()) {
|
|
153
216
|
return [];
|
|
154
217
|
}
|
|
155
218
|
const actions = [];
|
|
156
219
|
if (this.activeResizeHandle) {
|
|
157
|
-
|
|
158
|
-
actions.push(...this.handleResize(this.activeResizeHandle));
|
|
220
|
+
actions.push(...this.handleResizeOnServer(this.activeResizeHandle));
|
|
159
221
|
}
|
|
160
222
|
else {
|
|
161
|
-
// Move
|
|
162
223
|
actions.push(...this.handleMoveOnServer(target));
|
|
163
224
|
}
|
|
164
|
-
this.
|
|
165
|
-
this.tool.deregisterFeedback(this, [(0, css_feedback_1.cursorFeedbackAction)(css_feedback_1.CursorCSS.DEFAULT)]);
|
|
225
|
+
this.disposeAllButHandles();
|
|
166
226
|
return actions;
|
|
167
227
|
}
|
|
228
|
+
nonDraggingMouseUp(element, event) {
|
|
229
|
+
this.disposeAllButHandles();
|
|
230
|
+
return super.nonDraggingMouseUp(element, event);
|
|
231
|
+
}
|
|
168
232
|
handleMoveOnServer(target) {
|
|
169
233
|
const operations = [];
|
|
170
234
|
operations.push(...this.handleMoveElementsOnServer(target));
|
|
171
235
|
operations.push(...this.handleMoveRoutingPointsOnServer(target));
|
|
172
|
-
|
|
173
|
-
return [sprotty_1.CompoundOperation.create(operations)];
|
|
174
|
-
}
|
|
175
|
-
return operations;
|
|
236
|
+
return operations.length > 0 ? [sprotty_1.CompoundOperation.create(operations)] : [];
|
|
176
237
|
}
|
|
177
238
|
handleMoveElementsOnServer(target) {
|
|
178
|
-
const
|
|
179
|
-
const newBounds = [];
|
|
180
|
-
const selectedElements = [];
|
|
181
|
-
(0, gmodel_util_1.forEachElement)(target.index, gmodel_util_1.isNonRoutableSelectedMovableBoundsAware, element => {
|
|
182
|
-
selectedElements.push(element);
|
|
183
|
-
});
|
|
239
|
+
const selectedElements = (0, gmodel_util_1.getMatchingElements)(target.index, gmodel_util_1.isNonRoutableSelectedMovableBoundsAware);
|
|
184
240
|
const selectionSet = new Set(selectedElements);
|
|
185
|
-
selectedElements
|
|
186
|
-
.filter(element =>
|
|
187
|
-
.map(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
241
|
+
const newBounds = selectedElements
|
|
242
|
+
.filter(element => this.isValidElement(element, selectionSet))
|
|
243
|
+
.map(gmodel_util_1.toElementAndBounds);
|
|
244
|
+
return newBounds.length > 0 ? [sprotty_1.ChangeBoundsOperation.create(newBounds)] : [];
|
|
245
|
+
}
|
|
246
|
+
isValidElement(element, selectedElements = new Set()) {
|
|
247
|
+
return (this.isValidMove(element, element.bounds) &&
|
|
248
|
+
this.isValidSize(element, element.bounds) &&
|
|
249
|
+
!this.isChildOfSelected(selectedElements, element));
|
|
193
250
|
}
|
|
194
251
|
isChildOfSelected(selectedElements, element) {
|
|
252
|
+
if (selectedElements.size === 0) {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
195
255
|
while (element instanceof sprotty_1.GChildElement) {
|
|
196
256
|
element = element.parent;
|
|
197
257
|
if (selectedElements.has(element)) {
|
|
@@ -218,166 +278,98 @@ class ChangeBoundsListener extends drag_aware_mouse_listener_1.DragAwareMouseLis
|
|
|
218
278
|
}
|
|
219
279
|
return newRoutingPoints.length > 0 ? [sprotty_1.ChangeRoutingPointsOperation.create(newRoutingPoints)] : [];
|
|
220
280
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (this.isActiveResizeElement(resizeElement)) {
|
|
227
|
-
this.createChangeBoundsAction(resizeElement).forEach(action => actions.push(action));
|
|
228
|
-
}
|
|
229
|
-
return actions;
|
|
230
|
-
}
|
|
231
|
-
selectionChanged(root, selectedElements) {
|
|
232
|
-
if (this.activeResizeElement) {
|
|
233
|
-
if (selectedElements.includes(this.activeResizeElement.id)) {
|
|
234
|
-
// our active element is still selected, nothing to do
|
|
235
|
-
return;
|
|
281
|
+
handleResizeOnServer(activeResizeHandle) {
|
|
282
|
+
if (this.isValidElement(activeResizeHandle.parent) && this.initialBounds) {
|
|
283
|
+
const elementAndBounds = (0, gmodel_util_1.toElementAndBounds)(activeResizeHandle.parent);
|
|
284
|
+
if (!this.initialBounds.newPosition || !elementAndBounds.newPosition) {
|
|
285
|
+
return [];
|
|
236
286
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
287
|
+
if (!sprotty_1.Point.equals(this.initialBounds.newPosition, elementAndBounds.newPosition) ||
|
|
288
|
+
!sprotty_1.Dimension.equals(this.initialBounds.newSize, elementAndBounds.newSize)) {
|
|
289
|
+
// UX: we do not want the element positions to be reset to their start as they will be moved to their start and
|
|
290
|
+
// only afterwards moved by the move action again, leading to a ping-pong movement.
|
|
291
|
+
// We therefore clear our element map so that they cannot be reset.
|
|
292
|
+
this.initialBounds = undefined;
|
|
293
|
+
return [sprotty_1.ChangeBoundsOperation.create([elementAndBounds])];
|
|
243
294
|
}
|
|
244
|
-
this.reset();
|
|
245
295
|
}
|
|
296
|
+
return [];
|
|
246
297
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
298
|
+
selectionChanged(root, selectedElements) {
|
|
299
|
+
if (this.activeResizeElement && selectedElements.includes(this.activeResizeElement.id)) {
|
|
300
|
+
// our active element is still selected, nothing to do
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
// try to find some other selected element and mark that active
|
|
304
|
+
for (const elementId of selectedElements.reverse()) {
|
|
305
|
+
const element = root.index.getById(elementId);
|
|
306
|
+
if (element && this.updateResizeElement(element)) {
|
|
307
|
+
return;
|
|
255
308
|
}
|
|
256
|
-
return true;
|
|
257
309
|
}
|
|
258
|
-
|
|
310
|
+
this.updateResizeElement(root);
|
|
311
|
+
this.disposeAllButHandles();
|
|
259
312
|
}
|
|
260
313
|
isActiveResizeElement(element) {
|
|
261
314
|
return element !== undefined && this.activeResizeElement !== undefined && element.id === this.activeResizeElement.id;
|
|
262
315
|
}
|
|
263
|
-
initPosition(event) {
|
|
264
|
-
this.pointPositionUpdater.updateLastDragPosition(event);
|
|
265
|
-
if (this.activeResizeHandle) {
|
|
266
|
-
const resizeElement = (0, sprotty_1.findParentByFeature)(this.activeResizeHandle, model_1.isResizable);
|
|
267
|
-
this.initialBounds = {
|
|
268
|
-
x: resizeElement.bounds.x,
|
|
269
|
-
y: resizeElement.bounds.y,
|
|
270
|
-
width: resizeElement.bounds.width,
|
|
271
|
-
height: resizeElement.bounds.height
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
dispose() {
|
|
276
|
-
this.reset(true);
|
|
277
|
-
}
|
|
278
|
-
reset(resetBounds = false) {
|
|
279
|
-
this.resetFeedback(resetBounds);
|
|
280
|
-
this.resetPosition();
|
|
281
|
-
}
|
|
282
|
-
resetFeedback(resetBounds = false) {
|
|
283
|
-
const resetFeedback = [];
|
|
284
|
-
if (this.activeResizeElement && (0, model_1.isResizable)(this.activeResizeElement)) {
|
|
285
|
-
if (this.initialBounds && this.activeResizeHandle && resetBounds) {
|
|
286
|
-
// we only reset the bounds if an active resize operation was cancelled due to the tool being disabled
|
|
287
|
-
resetFeedback.push(set_bounds_feedback_command_1.SetBoundsFeedbackAction.create([
|
|
288
|
-
{
|
|
289
|
-
elementId: this.activeResizeElement.id,
|
|
290
|
-
newPosition: this.initialBounds,
|
|
291
|
-
newSize: this.initialBounds
|
|
292
|
-
}
|
|
293
|
-
]));
|
|
294
|
-
}
|
|
295
|
-
this.tool.deregisterFeedback(this.activeResizeElement, [change_bounds_tool_feedback_1.HideChangeBoundsToolResizeFeedbackAction.create()]);
|
|
296
|
-
}
|
|
297
|
-
resetFeedback.push((0, css_feedback_1.cursorFeedbackAction)(css_feedback_1.CursorCSS.DEFAULT));
|
|
298
|
-
this.tool.deregisterFeedback(this, resetFeedback);
|
|
299
|
-
}
|
|
300
|
-
resetPosition() {
|
|
301
|
-
this.activeResizeHandle = undefined;
|
|
302
|
-
this.pointPositionUpdater.resetPosition();
|
|
303
|
-
}
|
|
304
316
|
handleResizeOnClient(positionUpdate) {
|
|
305
317
|
if (!this.activeResizeHandle) {
|
|
306
318
|
return [];
|
|
307
319
|
}
|
|
308
|
-
|
|
309
|
-
if (this.isActiveResizeElement(resizeElement)) {
|
|
320
|
+
if (this.isActiveResizeElement(this.activeResizeHandle.parent)) {
|
|
310
321
|
switch (this.activeResizeHandle.location) {
|
|
311
322
|
case model_1.ResizeHandleLocation.TopLeft:
|
|
312
|
-
return this.handleTopLeftResize(
|
|
323
|
+
return this.handleTopLeftResize(this.activeResizeHandle.parent, positionUpdate);
|
|
313
324
|
case model_1.ResizeHandleLocation.TopRight:
|
|
314
|
-
return this.handleTopRightResize(
|
|
325
|
+
return this.handleTopRightResize(this.activeResizeHandle.parent, positionUpdate);
|
|
315
326
|
case model_1.ResizeHandleLocation.BottomLeft:
|
|
316
|
-
return this.handleBottomLeftResize(
|
|
327
|
+
return this.handleBottomLeftResize(this.activeResizeHandle.parent, positionUpdate);
|
|
317
328
|
case model_1.ResizeHandleLocation.BottomRight:
|
|
318
|
-
return this.handleBottomRightResize(
|
|
329
|
+
return this.handleBottomRightResize(this.activeResizeHandle.parent, positionUpdate);
|
|
319
330
|
}
|
|
320
331
|
}
|
|
321
332
|
return [];
|
|
322
333
|
}
|
|
323
334
|
handleTopLeftResize(resizeElement, positionUpdate) {
|
|
324
|
-
return this.createSetBoundsAction(resizeElement, resizeElement.bounds.x + positionUpdate.x, resizeElement.bounds.y + positionUpdate.y, resizeElement.bounds.width - positionUpdate.x, resizeElement.bounds.height - positionUpdate.y);
|
|
335
|
+
return this.createSetBoundsAction(resizeElement, { x: resizeElement.bounds.x + positionUpdate.x, y: resizeElement.bounds.y + positionUpdate.y }, { width: resizeElement.bounds.width - positionUpdate.x, height: resizeElement.bounds.height - positionUpdate.y });
|
|
325
336
|
}
|
|
326
337
|
handleTopRightResize(resizeElement, positionUpdate) {
|
|
327
|
-
return this.createSetBoundsAction(resizeElement, resizeElement.bounds.x, resizeElement.bounds.y + positionUpdate.y, resizeElement.bounds.width + positionUpdate.x, resizeElement.bounds.height - positionUpdate.y);
|
|
338
|
+
return this.createSetBoundsAction(resizeElement, { x: resizeElement.bounds.x, y: resizeElement.bounds.y + positionUpdate.y }, { width: resizeElement.bounds.width + positionUpdate.x, height: resizeElement.bounds.height - positionUpdate.y });
|
|
328
339
|
}
|
|
329
340
|
handleBottomLeftResize(resizeElement, positionUpdate) {
|
|
330
|
-
return this.createSetBoundsAction(resizeElement, resizeElement.bounds.x + positionUpdate.x, resizeElement.bounds.y, resizeElement.bounds.width - positionUpdate.x, resizeElement.bounds.height + positionUpdate.y);
|
|
341
|
+
return this.createSetBoundsAction(resizeElement, { x: resizeElement.bounds.x + positionUpdate.x, y: resizeElement.bounds.y }, { width: resizeElement.bounds.width - positionUpdate.x, height: resizeElement.bounds.height + positionUpdate.y });
|
|
331
342
|
}
|
|
332
343
|
handleBottomRightResize(resizeElement, positionUpdate) {
|
|
333
|
-
return this.createSetBoundsAction(resizeElement, resizeElement.bounds.x, resizeElement.bounds.y, resizeElement.bounds.width + positionUpdate.x, resizeElement.bounds.height + positionUpdate.y);
|
|
344
|
+
return this.createSetBoundsAction(resizeElement, { x: resizeElement.bounds.x, y: resizeElement.bounds.y }, { width: resizeElement.bounds.width + positionUpdate.x, height: resizeElement.bounds.height + positionUpdate.y });
|
|
334
345
|
}
|
|
335
|
-
|
|
336
|
-
if (
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
else if (this.initialBounds) {
|
|
340
|
-
const actions = [];
|
|
341
|
-
if (this.tool.movementRestrictor) {
|
|
342
|
-
actions.push((0, movement_restrictor_1.removeMovementRestrictionFeedback)(element, this.tool.movementRestrictor));
|
|
343
|
-
}
|
|
344
|
-
actions.push(set_bounds_feedback_command_1.SetBoundsFeedbackAction.create([{ elementId: element.id, newPosition: this.initialBounds, newSize: this.initialBounds }]));
|
|
345
|
-
return actions;
|
|
346
|
-
}
|
|
347
|
-
return [];
|
|
348
|
-
}
|
|
349
|
-
createElementAndBounds(element) {
|
|
350
|
-
if (this.isValidBoundChange(element, element.bounds, element.bounds)) {
|
|
351
|
-
return [(0, gmodel_util_1.toElementAndBounds)(element)];
|
|
352
|
-
}
|
|
353
|
-
return [];
|
|
354
|
-
}
|
|
355
|
-
createSetBoundsAction(element, x, y, width, height) {
|
|
356
|
-
const newPosition = { x, y };
|
|
357
|
-
const newSize = { width, height };
|
|
358
|
-
const result = [];
|
|
359
|
-
if (this.isValidBoundChange(element, newPosition, newSize)) {
|
|
360
|
-
if (this.tool.movementRestrictor) {
|
|
361
|
-
result.push((0, movement_restrictor_1.removeMovementRestrictionFeedback)(element, this.tool.movementRestrictor));
|
|
362
|
-
}
|
|
363
|
-
result.push(set_bounds_feedback_command_1.SetBoundsFeedbackAction.create([{ elementId: element.id, newPosition, newSize }]));
|
|
364
|
-
}
|
|
365
|
-
else if (this.isValidSize(element, newSize)) {
|
|
366
|
-
if (this.tool.movementRestrictor) {
|
|
367
|
-
result.push((0, movement_restrictor_1.createMovementRestrictionFeedback)(element, this.tool.movementRestrictor));
|
|
368
|
-
}
|
|
369
|
-
result.push(set_bounds_feedback_command_1.SetBoundsFeedbackAction.create([{ elementId: element.id, newPosition, newSize }]));
|
|
346
|
+
createSetBoundsAction(element, newPosition, newSize) {
|
|
347
|
+
if (!(0, utils_1.isValidSize)(element, newSize)) {
|
|
348
|
+
// we are not allowing any invalid sizes (breaking min size), not even during client feedback
|
|
349
|
+
return [];
|
|
370
350
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
isValidBoundChange(element, newPosition, newSize) {
|
|
374
|
-
return this.isValidSize(element, newSize) && this.isValidMove(element, newPosition);
|
|
351
|
+
const valid = this.isValidMove(element, newPosition);
|
|
352
|
+
return [{ elementId: element.id, newPosition, newSize, valid }];
|
|
375
353
|
}
|
|
376
354
|
isValidSize(element, size) {
|
|
377
|
-
return (0,
|
|
355
|
+
return (0, utils_1.isValidSize)(element, size);
|
|
378
356
|
}
|
|
379
357
|
isValidMove(element, newPosition) {
|
|
380
|
-
return (0,
|
|
358
|
+
return (0, utils_1.isValidMove)(element, newPosition, this.tool.movementRestrictor);
|
|
359
|
+
}
|
|
360
|
+
disposeAllButHandles() {
|
|
361
|
+
// We do not dispose the handle feedback as we want to keep showing the handles on selected elements
|
|
362
|
+
// this.handleFeedback.dispose();
|
|
363
|
+
this.resizeFeedback.dispose();
|
|
364
|
+
this.positionUpdater.resetPosition();
|
|
365
|
+
this.activeResizeElement = undefined;
|
|
366
|
+
this.activeResizeHandle = undefined;
|
|
367
|
+
this.initialBounds = undefined;
|
|
368
|
+
super.dispose();
|
|
369
|
+
}
|
|
370
|
+
dispose() {
|
|
371
|
+
this.handleFeedback.dispose();
|
|
372
|
+
this.disposeAllButHandles();
|
|
381
373
|
}
|
|
382
374
|
}
|
|
383
375
|
exports.ChangeBoundsListener = ChangeBoundsListener;
|