@eclipse-glsp/client 2.3.0-next.378 → 2.3.0-next.381
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/lib/base/mouse-position-tracker.d.ts +1 -3
- package/lib/base/mouse-position-tracker.d.ts.map +1 -1
- package/lib/base/mouse-position-tracker.js +2 -13
- package/lib/base/mouse-position-tracker.js.map +1 -1
- package/lib/features/accessibility/view-key-tools/movement-key-tool.d.ts +2 -2
- package/lib/features/accessibility/view-key-tools/movement-key-tool.d.ts.map +1 -1
- package/lib/features/accessibility/view-key-tools/movement-key-tool.js +2 -3
- package/lib/features/accessibility/view-key-tools/movement-key-tool.js.map +1 -1
- package/lib/features/debug/debug-bounds-decorator.d.ts +2 -2
- package/lib/features/debug/debug-bounds-decorator.d.ts.map +1 -1
- package/lib/features/debug/debug-bounds-decorator.js +2 -3
- package/lib/features/debug/debug-bounds-decorator.js.map +1 -1
- package/lib/features/debug/debug-manager.d.ts +13 -1
- package/lib/features/debug/debug-manager.d.ts.map +1 -1
- package/lib/features/debug/debug-manager.js +4 -0
- package/lib/features/debug/debug-manager.js.map +1 -1
- package/lib/features/debug/debug-module.js +1 -1
- package/lib/features/debug/debug-module.js.map +1 -1
- package/lib/features/element-template/mouse-tracking-element-position-listener.d.ts +2 -2
- package/lib/features/element-template/mouse-tracking-element-position-listener.d.ts.map +1 -1
- package/lib/features/grid/grid-manager.d.ts +15 -1
- package/lib/features/grid/grid-manager.d.ts.map +1 -1
- package/lib/features/grid/grid-manager.js +4 -0
- package/lib/features/grid/grid-manager.js.map +1 -1
- package/lib/features/grid/grid-module.d.ts.map +1 -1
- package/lib/features/grid/grid-module.js +1 -1
- package/lib/features/grid/grid-module.js.map +1 -1
- package/lib/features/select/select-mouse-listener.d.ts +2 -2
- package/lib/features/select/select-mouse-listener.d.ts.map +1 -1
- package/lib/features/select/select-mouse-listener.js +2 -3
- package/lib/features/select/select-mouse-listener.js.map +1 -1
- package/lib/features/tool-palette/tool-palette.d.ts +4 -4
- package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
- package/lib/features/tool-palette/tool-palette.js +4 -6
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-manager.d.ts +110 -4
- package/lib/features/tools/change-bounds/change-bounds-manager.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-manager.js +6 -3
- package/lib/features/tools/change-bounds/change-bounds-manager.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.d.ts +2 -2
- 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 +2 -3
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-module.js +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-module.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts +2 -2
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.js +2 -2
- package/lib/features/tools/change-bounds/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool-feedback.d.ts +3 -3
- 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.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool.d.ts +2 -2
- package/lib/features/tools/edge-edit/edge-edit-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool.js +2 -3
- package/lib/features/tools/edge-edit/edge-edit-tool.js.map +1 -1
- package/lib/features/tools/node-creation/container-manager.d.ts +2 -2
- package/lib/features/tools/node-creation/container-manager.d.ts.map +1 -1
- package/lib/features/tools/node-creation/container-manager.js +2 -3
- package/lib/features/tools/node-creation/container-manager.js.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.d.ts +2 -2
- package/lib/features/tools/node-creation/node-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.js +2 -3
- package/lib/features/tools/node-creation/node-creation-tool.js.map +1 -1
- package/lib/views/ggraph-view.d.ts +3 -3
- package/lib/views/ggraph-view.d.ts.map +1 -1
- package/lib/views/ggraph-view.js +2 -3
- package/lib/views/ggraph-view.js.map +1 -1
- package/lib/views/glsp-projection-view.d.ts +3 -3
- package/lib/views/glsp-projection-view.d.ts.map +1 -1
- package/lib/views/glsp-projection-view.js +2 -3
- package/lib/views/glsp-projection-view.js.map +1 -1
- package/package.json +3 -3
- package/src/base/mouse-position-tracker.ts +4 -16
- package/src/features/accessibility/view-key-tools/movement-key-tool.ts +2 -2
- package/src/features/debug/debug-bounds-decorator.tsx +3 -3
- package/src/features/debug/debug-manager.ts +14 -1
- package/src/features/debug/debug-module.ts +1 -1
- package/src/features/element-template/mouse-tracking-element-position-listener.ts +2 -2
- package/src/features/grid/grid-manager.ts +16 -1
- package/src/features/grid/grid-module.ts +2 -2
- package/src/features/select/select-mouse-listener.ts +3 -3
- package/src/features/tool-palette/tool-palette.ts +7 -6
- package/src/features/tools/change-bounds/change-bounds-manager.ts +129 -3
- package/src/features/tools/change-bounds/change-bounds-tool-feedback.ts +2 -2
- package/src/features/tools/change-bounds/change-bounds-tool-module.ts +1 -1
- package/src/features/tools/change-bounds/change-bounds-tool.ts +2 -2
- package/src/features/tools/edge-edit/edge-edit-tool-feedback.ts +2 -2
- package/src/features/tools/edge-edit/edge-edit-tool.ts +3 -2
- package/src/features/tools/node-creation/container-manager.ts +3 -3
- package/src/features/tools/node-creation/node-creation-tool.ts +2 -2
- package/src/views/ggraph-view.tsx +4 -4
- package/src/views/glsp-projection-view.tsx +4 -3
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
movementRestrictionFeedback,
|
|
47
47
|
removeMovementRestrictionFeedback
|
|
48
48
|
} from '../../change-bounds/movement-restrictor';
|
|
49
|
-
import {
|
|
49
|
+
import { IGridManager } from '../../grid/grid-manager';
|
|
50
50
|
import { IHelperLineManager } from '../../helper-lines/helper-line-manager';
|
|
51
51
|
import { InsertIndicator } from '../node-creation/insert-indicator';
|
|
52
52
|
import { ChangeBoundsTracker, TrackedElementMove, TrackedElementResize, TrackedMove, TrackedResize } from './change-bounds-tracker';
|
|
@@ -55,14 +55,140 @@ export const CSS_RESIZE_MODE = 'resize-mode';
|
|
|
55
55
|
export const CSS_RESTRICTED_RESIZE = 'resize-not-allowed';
|
|
56
56
|
export const CSS_ACTIVE_HANDLE = 'active';
|
|
57
57
|
|
|
58
|
+
export interface IChangeBoundsManager {
|
|
59
|
+
/**
|
|
60
|
+
* Unsnap the modifier used for changing bounds.
|
|
61
|
+
* @returns The unsnapped keyboard modifier, or undefined if no modifier was snapped.
|
|
62
|
+
*/
|
|
63
|
+
unsnapModifier(): KeyboardModifier | undefined;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Determine whether to use position snap for changing bounds.
|
|
67
|
+
* @param arg - The event argument.
|
|
68
|
+
* @returns True if position snap should be used, false otherwise.
|
|
69
|
+
*/
|
|
70
|
+
usePositionSnap(arg: MouseEvent | KeyboardEvent | any): boolean;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Snap the position of an element.
|
|
74
|
+
* @param element - The element to snap.
|
|
75
|
+
* @param position - The position to snap.
|
|
76
|
+
* @returns The snapped position.
|
|
77
|
+
*/
|
|
78
|
+
snapPosition(element: GModelElement, position: Point): Point;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Check if an element is valid for changing bounds.
|
|
82
|
+
* @param element - The element to check.
|
|
83
|
+
* @returns True if the element is valid, false otherwise.
|
|
84
|
+
*/
|
|
85
|
+
isValid(element: GModelElement): boolean;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Check if an element has a valid position for changing bounds.
|
|
89
|
+
* @param element - The element to check.
|
|
90
|
+
* @param position - The position to check.
|
|
91
|
+
* @returns True if the element has a valid position, false otherwise.
|
|
92
|
+
*/
|
|
93
|
+
hasValidPosition(element: GModelElement, position?: Point): boolean;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Check if an element has a valid size for changing bounds.
|
|
97
|
+
* @param element - The element to check.
|
|
98
|
+
* @param size - The size to check.
|
|
99
|
+
* @returns True if the element has a valid size, false otherwise.
|
|
100
|
+
*/
|
|
101
|
+
hasValidSize(element: GModelElement, size?: Dimension): boolean;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Get the minimum size of an element for changing bounds.
|
|
105
|
+
* @param element - The element to get the minimum size for.
|
|
106
|
+
* @returns The minimum size of the element.
|
|
107
|
+
*/
|
|
108
|
+
getMinimumSize(element: GModelElement): Dimension;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Determine whether to use movement restriction for changing bounds.
|
|
112
|
+
* @param arg - The event argument.
|
|
113
|
+
* @returns True if movement restriction should be used, false otherwise.
|
|
114
|
+
*/
|
|
115
|
+
useMovementRestriction(arg: MouseEvent | KeyboardEvent | any): boolean;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Restrict the movement of an element.
|
|
119
|
+
* @param element - The element to restrict movement for.
|
|
120
|
+
* @param movement - The movement to restrict.
|
|
121
|
+
* @returns The restricted movement.
|
|
122
|
+
*/
|
|
123
|
+
restrictMovement(element: GModelElement, movement: Movement): Movement;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Add move feedback for changing bounds.
|
|
127
|
+
* @param feedback - The feedback emitter.
|
|
128
|
+
* @param trackedMove - The tracked move.
|
|
129
|
+
* @param ctx - The context element. (optional)
|
|
130
|
+
* @param event - The mouse event. (optional)
|
|
131
|
+
* @returns The feedback emitter.
|
|
132
|
+
*/
|
|
133
|
+
addMoveFeedback(feedback: FeedbackEmitter, trackedMove: TrackedMove, ctx?: GModelElement, event?: MouseEvent): FeedbackEmitter;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Add resize feedback for changing bounds.
|
|
137
|
+
* @param feedback - The feedback emitter.
|
|
138
|
+
* @param resize - The tracked resize.
|
|
139
|
+
* @param ctx - The context element. (optional)
|
|
140
|
+
* @param event - The mouse event. (optional)
|
|
141
|
+
* @returns The feedback emitter.
|
|
142
|
+
*/
|
|
143
|
+
addResizeFeedback(feedback: FeedbackEmitter, resize: TrackedResize, ctx?: GModelElement, event?: MouseEvent): FeedbackEmitter;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Add move restriction feedback for changing bounds.
|
|
147
|
+
* @param feedback - The feedback emitter.
|
|
148
|
+
* @param change - The tracked element resize or move.
|
|
149
|
+
* @param ctx - The context element. (optional)
|
|
150
|
+
* @param event - The mouse event. (optional)
|
|
151
|
+
* @returns The feedback emitter.
|
|
152
|
+
*/
|
|
153
|
+
addMoveRestrictionFeedback(
|
|
154
|
+
feedback: FeedbackEmitter,
|
|
155
|
+
change: TrackedElementResize | TrackedElementMove,
|
|
156
|
+
ctx?: GModelElement,
|
|
157
|
+
event?: MouseEvent
|
|
158
|
+
): FeedbackEmitter;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Get the default resize locations for changing bounds.
|
|
162
|
+
* @returns The default resize handle locations.
|
|
163
|
+
*/
|
|
164
|
+
defaultResizeLocations(): ResizeHandleLocation[];
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Determine whether to use symmetric resize for changing bounds.
|
|
168
|
+
* @param arg - The event argument.
|
|
169
|
+
* @returns True if symmetric resize should be used, false otherwise.
|
|
170
|
+
*/
|
|
171
|
+
useSymmetricResize(arg: MouseEvent | KeyboardEvent | any): boolean;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Create a tracker for changing bounds.
|
|
175
|
+
* @returns The change bounds tracker.
|
|
176
|
+
*/
|
|
177
|
+
createTracker(): ChangeBoundsTracker;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* The default {@link IChangeBoundsManager} implementation. It is responsible for managing
|
|
182
|
+
* the change of bounds for {@link GModelElement}s.
|
|
183
|
+
*/
|
|
58
184
|
@injectable()
|
|
59
|
-
export class ChangeBoundsManager {
|
|
185
|
+
export class ChangeBoundsManager implements IChangeBoundsManager {
|
|
60
186
|
constructor(
|
|
61
187
|
@inject(MousePositionTracker) readonly positionTracker: MousePositionTracker,
|
|
62
188
|
@optional() @inject(TYPES.IMovementRestrictor) readonly movementRestrictor?: IMovementRestrictor,
|
|
63
189
|
@optional() @inject(TYPES.ISnapper) readonly snapper?: ISnapper,
|
|
64
190
|
@optional() @inject(TYPES.IHelperLineManager) readonly helperLineManager?: IHelperLineManager,
|
|
65
|
-
@optional() @inject(
|
|
191
|
+
@optional() @inject(TYPES.IGridManager) protected gridManager?: IGridManager
|
|
66
192
|
) {}
|
|
67
193
|
|
|
68
194
|
unsnapModifier(): KeyboardModifier | undefined {
|
|
@@ -20,7 +20,7 @@ import { FeedbackCommand } from '../../../base/feedback/feedback-command';
|
|
|
20
20
|
import { OptionalAction } from '../../../base/model/glsp-model-source';
|
|
21
21
|
import { forEachElement } from '../../../utils/gmodel-util';
|
|
22
22
|
import { ResizeHandleLocation, addResizeHandles, isResizable, removeResizeHandles } from '../../change-bounds/model';
|
|
23
|
-
import {
|
|
23
|
+
import { IChangeBoundsManager } from './change-bounds-manager';
|
|
24
24
|
|
|
25
25
|
export interface ShowChangeBoundsToolResizeFeedbackAction extends Action {
|
|
26
26
|
kind: typeof ShowChangeBoundsToolResizeFeedbackAction.KIND;
|
|
@@ -71,7 +71,7 @@ export class ShowChangeBoundsToolResizeFeedbackCommand extends FeedbackCommand {
|
|
|
71
71
|
static readonly KIND = ShowChangeBoundsToolResizeFeedbackAction.KIND;
|
|
72
72
|
|
|
73
73
|
@inject(TYPES.Action) protected action: ShowChangeBoundsToolResizeFeedbackAction;
|
|
74
|
-
@inject(
|
|
74
|
+
@inject(TYPES.IChangeBoundsManager) protected changeBoundsManager: IChangeBoundsManager;
|
|
75
75
|
|
|
76
76
|
execute(context: CommandExecutionContext): CommandReturn {
|
|
77
77
|
const index = context.root.index;
|
|
@@ -24,7 +24,7 @@ import { GResizeHandleView } from './view';
|
|
|
24
24
|
export const changeBoundsToolModule = new FeatureModule(
|
|
25
25
|
(bind, unbind, isBound, rebind) => {
|
|
26
26
|
const context = { bind, unbind, isBound, rebind };
|
|
27
|
-
|
|
27
|
+
bindAsService(context, TYPES.IChangeBoundsManager, ChangeBoundsManager);
|
|
28
28
|
bindAsService(context, TYPES.IDefaultTool, ChangeBoundsTool);
|
|
29
29
|
configureCommand(context, ShowChangeBoundsToolResizeFeedbackCommand);
|
|
30
30
|
configureCommand(context, HideChangeBoundsToolResizeFeedbackCommand);
|
|
@@ -54,7 +54,7 @@ import { SetBoundsFeedbackAction } from '../../bounds/set-bounds-feedback-comman
|
|
|
54
54
|
import { GResizeHandle, isResizable } from '../../change-bounds/model';
|
|
55
55
|
import { IMovementRestrictor } from '../../change-bounds/movement-restrictor';
|
|
56
56
|
import { BaseEditTool } from '../base-tools';
|
|
57
|
-
import { CSS_ACTIVE_HANDLE,
|
|
57
|
+
import { CSS_ACTIVE_HANDLE, IChangeBoundsManager } from './change-bounds-manager';
|
|
58
58
|
import {
|
|
59
59
|
HideChangeBoundsToolResizeFeedbackAction,
|
|
60
60
|
MoveFinishedEventAction,
|
|
@@ -83,7 +83,7 @@ export class ChangeBoundsTool extends BaseEditTool {
|
|
|
83
83
|
@inject(SelectionService) protected selectionService: SelectionService;
|
|
84
84
|
@inject(EdgeRouterRegistry) @optional() readonly edgeRouterRegistry?: EdgeRouterRegistry;
|
|
85
85
|
@inject(TYPES.IMovementRestrictor) @optional() readonly movementRestrictor?: IMovementRestrictor;
|
|
86
|
-
@inject(
|
|
86
|
+
@inject(TYPES.IChangeBoundsManager) readonly changeBoundsManager: IChangeBoundsManager;
|
|
87
87
|
|
|
88
88
|
get id(): string {
|
|
89
89
|
return ChangeBoundsTool.ID;
|
|
@@ -48,7 +48,7 @@ import { FeedbackEmitter } from '../../../base/feedback/feedback-emitter';
|
|
|
48
48
|
import { forEachElement, getMatchingElements, isRoutable, isRoutingHandle } from '../../../utils/gmodel-util';
|
|
49
49
|
import { getAbsolutePosition, toAbsoluteBounds } from '../../../utils/viewpoint-util';
|
|
50
50
|
import { addReconnectHandles, removeReconnectHandles } from '../../reconnect/model';
|
|
51
|
-
import {
|
|
51
|
+
import { IChangeBoundsManager } from '../change-bounds/change-bounds-manager';
|
|
52
52
|
import { ChangeBoundsTracker, MoveableRoutingHandle } from '../change-bounds/change-bounds-tracker';
|
|
53
53
|
import { FeedbackEdgeEnd, feedbackEdgeEndId, feedbackEdgeId } from '../edge-creation/dangling-edge-feedback';
|
|
54
54
|
import { FeedbackEdgeEndMovingMouseListener } from '../edge-creation/edge-creation-tool-feedback';
|
|
@@ -259,7 +259,7 @@ export class FeedbackEdgeRouteMovingMouseListener extends DragAwareMouseListener
|
|
|
259
259
|
protected tracker: ChangeBoundsTracker;
|
|
260
260
|
|
|
261
261
|
constructor(
|
|
262
|
-
protected changeBoundsManager:
|
|
262
|
+
protected changeBoundsManager: IChangeBoundsManager,
|
|
263
263
|
protected edgeRouterRegistry?: EdgeRouterRegistry
|
|
264
264
|
) {
|
|
265
265
|
super();
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
GRoutableElement,
|
|
25
25
|
GRoutingHandle,
|
|
26
26
|
ReconnectEdgeOperation,
|
|
27
|
+
TYPES,
|
|
27
28
|
canEditRouting,
|
|
28
29
|
findParentByFeature,
|
|
29
30
|
isConnectable,
|
|
@@ -37,7 +38,7 @@ import { ISelectionListener, SelectionService } from '../../../base/selection-se
|
|
|
37
38
|
import { calcElementAndRoutingPoints, isRoutable, isRoutingHandle } from '../../../utils/gmodel-util';
|
|
38
39
|
import { GReconnectHandle, isReconnectHandle, isReconnectable, isSourceRoutingHandle, isTargetRoutingHandle } from '../../reconnect/model';
|
|
39
40
|
import { BaseEditTool } from '../base-tools';
|
|
40
|
-
import {
|
|
41
|
+
import { IChangeBoundsManager } from '../change-bounds/change-bounds-manager';
|
|
41
42
|
import { DrawFeedbackEdgeAction, RemoveFeedbackEdgeAction, feedbackEdgeId } from '../edge-creation/dangling-edge-feedback';
|
|
42
43
|
import {
|
|
43
44
|
DrawFeedbackEdgeSourceAction,
|
|
@@ -56,7 +57,7 @@ export class EdgeEditTool extends BaseEditTool {
|
|
|
56
57
|
@inject(SelectionService) protected selectionService: SelectionService;
|
|
57
58
|
@inject(AnchorComputerRegistry) protected anchorRegistry: AnchorComputerRegistry;
|
|
58
59
|
@inject(EdgeRouterRegistry) @optional() readonly edgeRouterRegistry?: EdgeRouterRegistry;
|
|
59
|
-
@inject(
|
|
60
|
+
@inject(TYPES.IChangeBoundsManager) readonly changeBoundsManager: IChangeBoundsManager;
|
|
60
61
|
|
|
61
62
|
protected feedbackEdgeSourceMovingListener: FeedbackEdgeSourceMovingMouseListener;
|
|
62
63
|
protected feedbackEdgeTargetMovingListener: FeedbackEdgeTargetMovingMouseListener;
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { GModelElement, Point, findChildrenAtPosition } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { GModelElement, Point, TYPES, findChildrenAtPosition } from '@eclipse-glsp/sprotty';
|
|
18
18
|
import { inject, injectable } from 'inversify';
|
|
19
19
|
import { CSS_GHOST_ELEMENT, CursorCSS, cursorFeedbackAction } from '../../../base/feedback/css-feedback';
|
|
20
20
|
import { FeedbackEmitter } from '../../../base/feedback/feedback-emitter';
|
|
21
21
|
import { ContainerElement, isContainable } from '../../hints/model';
|
|
22
|
-
import {
|
|
22
|
+
import { IChangeBoundsManager } from '../change-bounds/change-bounds-manager';
|
|
23
23
|
|
|
24
24
|
export interface InsertOptions extends Record<string, unknown> {
|
|
25
25
|
/** Flag to indicate whether the location within a container needs to be valid. Default: false */
|
|
@@ -58,7 +58,7 @@ export interface IContainerManager {
|
|
|
58
58
|
*/
|
|
59
59
|
@injectable()
|
|
60
60
|
export class ContainerManager implements IContainerManager {
|
|
61
|
-
@inject(
|
|
61
|
+
@inject(TYPES.IChangeBoundsManager) protected readonly changeBoundsManager: IChangeBoundsManager;
|
|
62
62
|
|
|
63
63
|
insert(proxy: GModelElement, location: Point, elementTypeId: string, opts?: Partial<InsertOptions>): TrackedInsert {
|
|
64
64
|
const options = { ...DEFAULT_INSERT_OPTIONS, ...opts };
|
|
@@ -43,7 +43,7 @@ import { AddTemplateElementsAction, getTemplateElementId } from '../../element-t
|
|
|
43
43
|
import { MouseTrackingElementPositionListener, PositioningTool } from '../../element-template/mouse-tracking-element-position-listener';
|
|
44
44
|
import { RemoveTemplateElementsAction } from '../../element-template/remove-template-element';
|
|
45
45
|
import { BaseCreationTool } from '../base-tools';
|
|
46
|
-
import {
|
|
46
|
+
import { IChangeBoundsManager } from '../change-bounds/change-bounds-manager';
|
|
47
47
|
import { TrackedMove } from '../change-bounds/change-bounds-tracker';
|
|
48
48
|
import { IContainerManager, TrackedInsert } from './container-manager';
|
|
49
49
|
import { InsertIndicator } from './insert-indicator';
|
|
@@ -54,7 +54,7 @@ export class NodeCreationTool extends BaseCreationTool<TriggerNodeCreationAction
|
|
|
54
54
|
|
|
55
55
|
protected isTriggerAction = TriggerNodeCreationAction.is;
|
|
56
56
|
|
|
57
|
-
@inject(
|
|
57
|
+
@inject(TYPES.IChangeBoundsManager) readonly changeBoundsManager: IChangeBoundsManager;
|
|
58
58
|
@inject(TYPES.IContainerManager) readonly containerManager: IContainerManager;
|
|
59
59
|
@inject(TYPES.IModelFactory) modelFactory: IModelFactory;
|
|
60
60
|
|
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Bounds, Dimension, Point, RenderingContext, SGraphImpl, SGraphView, Writable } from '@eclipse-glsp/sprotty';
|
|
16
|
+
import { Bounds, Dimension, Point, RenderingContext, SGraphImpl, SGraphView, TYPES, Writable } from '@eclipse-glsp/sprotty';
|
|
17
17
|
import { inject, injectable, optional } from 'inversify';
|
|
18
18
|
import { VNode } from 'snabbdom';
|
|
19
|
-
import {
|
|
19
|
+
import { GridStyle, IGridManager } from '../features/grid/grid-manager';
|
|
20
20
|
import { GridProperty } from '../features/grid/grid-style';
|
|
21
21
|
|
|
22
22
|
@injectable()
|
|
23
23
|
export class GGraphView extends SGraphView {
|
|
24
|
-
@inject(
|
|
24
|
+
@inject(TYPES.IGridManager) @optional() protected gridManager?: IGridManager;
|
|
25
25
|
|
|
26
26
|
override render(model: Readonly<SGraphImpl>, context: RenderingContext): VNode {
|
|
27
27
|
const graph = super.render(model, context);
|
|
@@ -45,7 +45,7 @@ export class GGraphView extends SGraphView {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
protected getBackgroundBounds(viewport: Readonly<SGraphImpl>, context: RenderingContext, gridManager:
|
|
48
|
+
protected getBackgroundBounds(viewport: Readonly<SGraphImpl>, context: RenderingContext, gridManager: IGridManager): Writable<Bounds> {
|
|
49
49
|
const position = Point.multiplyScalar(Point.subtract(gridManager.grid, viewport.scroll), viewport.zoom);
|
|
50
50
|
const size = Dimension.fromPoint(Point.multiplyScalar(gridManager.grid, viewport.zoom));
|
|
51
51
|
return { ...position, ...size };
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
ProjectionParams,
|
|
26
26
|
RenderingContext,
|
|
27
27
|
SGraphImpl,
|
|
28
|
+
TYPES,
|
|
28
29
|
ViewProjection,
|
|
29
30
|
Writable,
|
|
30
31
|
html,
|
|
@@ -33,7 +34,7 @@ import {
|
|
|
33
34
|
} from '@eclipse-glsp/sprotty';
|
|
34
35
|
import { inject, injectable, optional } from 'inversify';
|
|
35
36
|
import { VNode, VNodeStyle, h } from 'snabbdom';
|
|
36
|
-
import {
|
|
37
|
+
import { GridStyle, IGridManager } from '../features/grid/grid-manager';
|
|
37
38
|
import { GridProperty } from '../features/grid/grid-style';
|
|
38
39
|
|
|
39
40
|
/**
|
|
@@ -42,7 +43,7 @@ import { GridProperty } from '../features/grid/grid-style';
|
|
|
42
43
|
@injectable()
|
|
43
44
|
export class GLSPProjectionView extends ProjectedViewportView {
|
|
44
45
|
@inject(EdgeRouterRegistry) edgeRouterRegistry: EdgeRouterRegistry;
|
|
45
|
-
@inject(
|
|
46
|
+
@inject(TYPES.IGridManager) @optional() protected gridManager?: IGridManager;
|
|
46
47
|
|
|
47
48
|
override render(model: Readonly<GViewportRootElement>, context: RenderingContext, args?: IViewArgs): VNode {
|
|
48
49
|
const rootNode: VNode = (
|
|
@@ -83,7 +84,7 @@ export class GLSPProjectionView extends ProjectedViewportView {
|
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
protected getBackgroundBounds(viewport: Readonly<SGraphImpl>, context: RenderingContext, gridManager:
|
|
87
|
+
protected getBackgroundBounds(viewport: Readonly<SGraphImpl>, context: RenderingContext, gridManager: IGridManager): Writable<Bounds> {
|
|
87
88
|
const position = Point.multiplyScalar(Point.subtract(gridManager.grid, viewport.scroll), viewport.zoom);
|
|
88
89
|
const size = Dimension.fromPoint(Point.multiplyScalar(gridManager.grid, viewport.zoom));
|
|
89
90
|
return { ...position, ...size };
|