@eclipse-glsp/client
Version:
A sprotty-based client for GLSP
61 lines • 3.81 kB
TypeScript
/********************************************************************************
* Copyright (c) 2019-2024 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import { Action, ElementMove, GModelElement, GModelRoot, MoveAction, Point, TypeGuard } from '@eclipse-glsp/sprotty';
import { DebouncedFunc } from 'lodash';
import { DragAwareMouseListener } from '../../../base/drag-aware-mouse-listener';
import { FeedbackEmitter } from '../../../base/feedback/feedback-emitter';
import { ISelectionListener } from '../../../base/selection-service';
import { MoveableElement } from '../../../utils/gmodel-util';
import { ChangeBoundsTool } from './change-bounds-tool';
import { ChangeBoundsTracker, TrackedMove } from './change-bounds-tracker';
/**
* This mouse listener provides visual feedback for moving by sending client-side
* `MoveAction`s while elements are selected and dragged. This will also update
* their bounds, which is important, as it is not only required for rendering
* the visual feedback but also the basis for sending the change to the server
* (see also `tools/MoveTool`).
*/
export declare class FeedbackMoveMouseListener extends DragAwareMouseListener implements ISelectionListener {
protected tool: ChangeBoundsTool;
protected rootElement?: GModelRoot;
protected tracker: ChangeBoundsTracker;
protected elementId2startPos: Map<string, Point>;
protected pendingMoveInitialized?: DebouncedFunc<() => void>;
protected moveInitializedFeedback: FeedbackEmitter;
protected moveFeedback: FeedbackEmitter;
constructor(tool: ChangeBoundsTool);
mouseDown(target: GModelElement, event: MouseEvent): Action[];
protected initializeMove(target: GModelElement, event: MouseEvent): void;
protected scheduleMoveInitialized(): void;
protected moveInitializationTimeout(): number;
protected moveInitialized(): void;
protected isValidMoveable(element?: GModelElement): element is MoveableElement;
protected isValidRevertable(element?: GModelElement): element is MoveableElement;
nonDraggingMouseUp(element: GModelElement, event: MouseEvent): Action[];
draggingMouseMove(target: GModelElement, event: MouseEvent): Action[];
protected moveElements(target: GModelElement, event: MouseEvent): Action[];
protected createMoveAction(trackedMove: TrackedMove): Action;
protected addMoveFeedback(trackedMove: TrackedMove, ctx: GModelElement, event: MouseEvent): void;
protected initializeElementsToMove(root: GModelRoot): void;
protected collectElementsToMove(root: GModelRoot): MoveableElement[];
protected getElementsToMove(context: GModelElement, moveable?: TypeGuard<MoveableElement>): MoveableElement[];
protected resetElementPositions(context: GModelElement): MoveAction | undefined;
protected revertElementMoves(context?: GModelElement): ElementMove[];
draggingMouseUp(target: GModelElement, event: MouseEvent): Action[];
selectionChanged(root: Readonly<GModelRoot>, selectedElements: string[], deselectedElements?: string[]): void;
dispose(): void;
}
//# sourceMappingURL=change-bounds-tool-move-feedback.d.ts.map