import type { VNode } from "snabbdom"; import type { IView, IViewArgs, RenderingContext } from "sprotty"; import type { SCanvasElement } from "../../model/canvas/sCanvasElement.js"; import { EditableCanvasContentView } from "./editableCanvasContentView.js"; /** * IView that represents a CanvasElement */ export declare class CanvasElementView extends EditableCanvasContentView implements IView { /** * Class assigned to the rotate icon */ static readonly ROTATE_ICON_CLASS = "canvas-rotate-icon"; /** * Class assigned to resize lines */ static readonly RESIZE_CLASS = "resize"; /** * Class assigned to resize borders */ static readonly RESIZE_BORDER_CLASS = "resize-border"; /** * Class assigned to resize corners */ static readonly RESIZE_CORNER_CLASS = "resize-corner"; /** * The offset of the selection rectangle */ static readonly SELECTION_OFFSET = 6; /** * Distance of the rotation icon to the center */ static readonly ROTATE_ICON_DISTANCE = 30; render(model: Readonly, context: RenderingContext, _args?: IViewArgs | undefined): VNode | undefined; /** * Generates a rectangle that is displayed if the element is selected. * Does NOT check if the element is selected. * * @param model The model of the element * @returns The rectangle and its children */ private generateSelectedRect; /** * Generates a corner of the selection rectangle. * Does not check if the element is selected. * * @param model The model of the element * @param zoom The zoom level of the diagram * @param pos The position of the corner * @returns The corner */ private generateSelectedOutlineCorner; /** * Generates the rotate icon. * Does not check if the element is selected or rotateable. * * @param model The model of the element * @param zoom The zoom level of the diagram * @returns The rotate icon */ private generateRotationIcon; /** * Generates resize lines. * Checks if the element is resizable, but does not check if the element is selected. * * @param model The model of the element * @param zoom The zoom level of the diagram * @returns The resize lines */ private generateResizeBorder; /** * Computes the offset to the index of a resize icon based on the elements rotation relative to the diagram root. * The resize icon index ranges from 0 to 7, where each step is a 45 degree rotation. * The computed offset can be applied to the index based on the location of the resize border, e.g. 0 for the top left corner, * to obtain the index of the icon which is rotated according to the element's rotation relative to the diagram root. * * @param model the canvas element to compute the offset for * @returns the offset for the rotation of the canvas element */ private computeResizeIconOffset; /** * Generates a resize line. * Applies the class resize-edge if the start and end position are different. * Applies the class resize-corner if the start and end position are the same. * * @param model the canvas element to generate the resize line for * @param zoom the zoom level of the diagram * @param startPos the start position of the line * @param endPos the end position of the line * @param cursorIconOffset the numerical offset for the resize icon, will be added to (startPos + endPos) * @param pos classes applied to the line * @returns the generated line */ private generateResizeLine; /** * Computes the position of a point on the selection rectangle. * 0 is the top left corner, 1 is the top right corner, 2 is the bottom right corner and 3 is the bottom left corner. * * @param model the model for which the point should be computed * @param zoom the zoom level of the diagram * @param pos the position of the point, taken modulo 4 * @returns the point */ private generatePoint; } /** * Different resize line positions */ export declare enum ResizePosition { TOP = "resize-top", RIGHT = "resize-right", BOTTOM = "resize-bottom", LEFT = "resize-left" } //# sourceMappingURL=canvasElementView.d.ts.map