@eclipse-glsp/client
Version:
A sprotty-based client for GLSP
83 lines • 5.23 kB
TypeScript
import { Action, BoundsAware, EdgeRouterRegistry, ElementAndBounds, GModelElement, GModelRoot, GParentElement, KeyListener, MouseListener, Operation } from '@eclipse-glsp/sprotty';
import { DragAwareMouseListener } from '../../../base/drag-aware-mouse-listener';
import { FeedbackEmitter } from '../../../base/feedback/feedback-emitter';
import { ISelectionListener, SelectionService } from '../../../base/selection-service';
import type { IShortcutManager } from '../../../base/shortcuts/shortcuts-manager';
import { BoundsAwareModelElement, ResizableModelElement, SelectableBoundsAware } from '../../../utils/gmodel-util';
import { SetBoundsFeedbackAction } from '../../bounds/set-bounds-feedback-command';
import { GResizeHandle } from '../../change-bounds/model';
import { IMovementRestrictor } from '../../change-bounds/movement-restrictor';
import { Grid } from '../../grid/grid';
import { BaseEditTool } from '../base-tools';
import { IChangeBoundsManager } from './change-bounds-manager';
import { ChangeBoundsTracker, TrackedElementResize, TrackedResize } from './change-bounds-tracker';
export interface IMovementOptions {
/** If set to true, a move with multiple elements is only performed if each individual move is valid. */
readonly allElementsNeedToBeValid: boolean;
}
/**
* The change bounds tool has the license to move multiple elements or resize a single element by implementing the ChangeBounds operation.
* In contrast to Sprotty's implementation this tool only sends a `ChangeBoundsOperationAction` when an operation has finished and does not
* provide client-side live updates to improve performance.
*
* | Operation | Client Update | Server Update
* +-----------+------------------+----------------------------
* | Move | MoveAction | ChangeBoundsOperationAction
* | Resize | SetBoundsAction | ChangeBoundsOperationAction
*
* To provide a visual client updates during move we install the `FeedbackMoveMouseListener` and to provide visual client updates during
* resize and send the server updates we install the `ChangeBoundsListener`.
*/
export declare class ChangeBoundsTool extends BaseEditTool {
static ID: string;
static TOKEN: symbol;
protected selectionService: SelectionService;
readonly edgeRouterRegistry?: EdgeRouterRegistry;
readonly movementRestrictor?: IMovementRestrictor;
readonly changeBoundsManager: IChangeBoundsManager;
readonly movementOptions: IMovementOptions;
readonly grid?: Grid;
protected readonly shortcutManager: IShortcutManager;
get id(): string;
enable(): void;
createChangeBoundsTracker(): ChangeBoundsTracker;
protected createMoveMouseListener(): MouseListener;
protected createMoveKeyListener(): KeyListener;
protected createChangeBoundsListener(): MouseListener & ISelectionListener;
}
export declare class ChangeBoundsListener extends DragAwareMouseListener implements ISelectionListener {
protected tool: ChangeBoundsTool;
static readonly CSS_CLASS_ACTIVE = "active";
protected initialBounds: ElementAndBounds | undefined;
protected tracker: ChangeBoundsTracker;
protected activeResizeElement?: ResizableModelElement;
protected activeResizeHandle?: GResizeHandle;
protected handleFeedback: FeedbackEmitter;
protected resizeFeedback: FeedbackEmitter;
constructor(tool: ChangeBoundsTool);
mouseDown(target: GModelElement, event: MouseEvent): Action[];
protected updateResizeElement(target: GModelElement, event?: MouseEvent): boolean;
protected findResizeElement(target: GModelElement): ResizableModelElement | undefined;
protected draggingMouseMove(target: GModelElement, event: MouseEvent): Action[];
protected resizeBoundsAction(resize: TrackedResize): SetBoundsFeedbackAction;
protected toElementAndBounds(elementResize: TrackedElementResize): ElementAndBounds;
protected addResizeFeedback(resize: TrackedResize, target: GModelElement, event: MouseEvent): void;
protected resetBounds(): Action[];
draggingMouseUp(target: GModelElement, event: MouseEvent): Action[];
nonDraggingMouseUp(element: GModelElement, event: MouseEvent): Action[];
protected handleMoveOnServer(target: GModelElement): Action[];
protected getElementsToMove(target: GModelElement): SelectableBoundsAware[];
protected handleMoveElementsOnServer(elementsToMove: SelectableBoundsAware[]): Operation[];
protected isValidMove(element: BoundsAwareModelElement, selectedElements?: Set<BoundsAwareModelElement>): boolean;
protected isChildOfSelected(selectedElements: Set<GModelElement>, element: GModelElement): boolean;
protected handleMoveRoutingPointsOnServer(elementsToMove: SelectableBoundsAware[]): Operation[];
protected handleResizeOnServer(activeResizeHandle: GResizeHandle): Action[];
protected isValidResize(element: BoundsAwareModelElement): boolean;
selectionChanged(root: GModelRoot, selectedElements: string[]): void;
protected isActiveResizeElement(element?: GModelElement): element is GParentElement & BoundsAware;
protected disposeResize(opts?: {
keepHandles: boolean;
}): void;
dispose(): void;
}
//# sourceMappingURL=change-bounds-tool.d.ts.map