import { SharedSettings } from "@hylimo/diagram-protocol"; import { type HandleMoveResult } from "../../move/moveHandler.js"; import type { Point } from "@hylimo/diagram-common"; import type { Matrix } from "transformation-matrix"; import { type SnapLines } from "../../snap/model.js"; import type { SModelElementImpl } from "sprotty"; import type { SRoot } from "../../../model/sRoot.js"; import type { SElement } from "../../../model/sElement.js"; import { SnapHandler } from "../../snap/snapHandler.js"; import { SnapMoveHandler } from "../../snap/snapMoveHandler.js"; /** * Entry for a translation move operation */ export interface ElementsGroupedByTransformation { /** * The transformation applied to the dx and dy values */ transformation: Matrix; /** * The global rotaiton of the context */ globalRotation: number; /** * The elements to move */ elements: string[]; /** * If the x coordinate should be modified */ moveX: boolean; /** * If the y coordinate should be modified */ moveY: boolean; } /** * Move handler for translations of absolute and relative points. * Expects relative coordinates in the root canvas coordinate system. */ export declare class TranslationMoveHandler extends SnapMoveHandler { private readonly elementsByTransformation; /** * True if the x coordinate should be snapped */ readonly snapX: boolean; /** * True if the y coordinate should be snapped */ readonly snapY: boolean; /** * Creates a new TranslationMoveHandler * * @param elementsByTransformation the ids of the points to move grouped by transformation * @param elements the elements to consider for snapping * @param ignoredElements the elements to ignore for snapping * @param root the root element containing the diagram * @param settings shared settings for the diagram * @param snappingEnabled whether snapping is enabled * @param transformationMatrix the transformation matrix to apply to obtain the relative position */ constructor(elementsByTransformation: ElementsGroupedByTransformation[], elements: SElement[], ignoredElements: Set, root: SRoot, settings: SharedSettings | undefined, snappingEnabled: boolean, transformationMatrix: Matrix); handleMove(x: number, y: number, event: MouseEvent, target: SModelElementImpl): HandleMoveResult; } /** * Snap handler for translating elements */ declare class TranslationSnapHandler extends SnapHandler { /** * Intitial snap element data for a drag vector (0, 0) */ private readonly snapElementData; /** * Creates a new create element snap handler * * @param elements the elements to snap to * @param ignoredElements the elements to ignore * @param root the root element * @param settings the shared settings for snap data computation */ constructor(elements: SElement[], ignoredElements: Set, root: SRoot, settings: SharedSettings | undefined); /** * Gets the snapped values and snap lines based on the current translation * * @param dragVector the current translation * @param snapX true if the x coordinate should be snapped * @param snapY true if the y coordinate should be snapped * @param zoom the current zoom level * @returns the snapped values and snap lines */ snap(dragVector: Point, snapX: boolean, snapY: boolean, zoom: number): { snappedDragVector: Point; snapLines: SnapLines | undefined; }; /** * Creates a translation matrix with rounded coordinates * * @param point the point to translate by after rounding * @returns a translation matrix with the rounded coordinates */ private createRoundedTranslation; /** * Rounds the coordinates of a point to the translation precision specified in the settings. * This ensures consistent precision when elements are moved or created on the canvas. * * @param point The point whose coordinates need to be rounded * @returns A new point with coordinates rounded according to translation precision settings */ private roundToTranslationPrecision; } export {}; //# sourceMappingURL=translationMoveHandler.d.ts.map