import { Point } from '../util/canvas-util'; import { DiagramElement } from './model/diagram-element'; import { DiagramNode } from './model/diagram-node'; /** * Represents an action taken by the user on the diagram which doesn't have an impact on the diagram's model. * Contrast with {@link DiagramAction} which does have an impact on the diagram's model. * @public */ export declare abstract class DiagramEvent { readonly type: DiagramEvents; defaultPrevented: boolean; constructor(type: DiagramEvents); preventDefault(): void; } /** * Diagram user events. * @public */ export declare enum DiagramEvents { Zoom = 0, DoubleClick = 1, SecondaryClick = 2, Selection = 3, Highlight = 4, DraggingNode = 5 } /** * Diagram event which consists of the user zooming or panning. */ export declare class DiagramZoomEvent extends DiagramEvent { coords: Point; zoom: number; /** * Create a diagram zoom event. * * @param coords Coordinates to which the user panned. Calling the method `canvas.translateTo()` with these coordinates after this event should cause no changes. * @param zoom Zoom level to which the user zoomed. Calling the method `canvas.zoomTo()` with this zoom level after this event should cause no changes. */ constructor(coords: Point, zoom: number); } /** * Diagram event which consists of the user performing a double click on the diagram. */ export declare class DiagramDoubleClickEvent extends DiagramEvent { cause: MouseEvent; target: DiagramElement | null; coords?: Point; /** * Create a diagram double click event. * * @param cause Mouse event which triggered this event. * @param target Diagram element which is targeted by the event, or null if no element was targeted (the diagram background was targeted). * @param coords Optionally, coordinates of the point of the diagram where the event happened. */ constructor(cause: MouseEvent, target: DiagramElement | null, coords?: Point); } /** * Diagram event which consists of the user performing a secondary click on the diagram. */ export declare class DiagramSecondaryClickEvent extends DiagramEvent { cause: MouseEvent; target: DiagramElement | null; coords?: Point; /** * Create a diagram secondary click event. * * @param cause Mouse event which triggered this event. * @param target Diagram element which is targeted by the event, or null if no element was targeted (the diagram background was targeted). * @param coords Optionally, coordinates of the point of the diagram where the event happened. */ constructor(cause: MouseEvent, target: DiagramElement | null, coords?: Point); } /** * Diagram event which consists of the user either adding or removing one or several diagram elements from the user selection. */ export declare class DiagramSelectionEvent extends DiagramEvent { targets: DiagramElement[]; selected: boolean; /** * Create a diagram selection event. * * @param targets Diagram elements which are targeted by the event. * @param selected `true` if the targets were selected, `false` if the targets were deselected. */ constructor(targets: DiagramElement[], selected: boolean); } /** * Diagram event which consists of the user highlighting a diagram element. * If the target is `null`, that means that the previously highlighted element was unhighlighted. */ export declare class DiagramHighlightedEvent extends DiagramEvent { target: DiagramElement | null; /** * Create a diagram highlight event. * * @param target Diagram element which is targeted by the event. */ constructor(target: DiagramElement | null); } /** * Diagram event which consists of the user dragging a diagram node. */ export declare class DiagramDraggingNodeEvent extends DiagramEvent { target: DiagramNode; /** * Create a diagram dragging node event. * * @param target Diagram node which is targeted by the event. */ constructor(target: DiagramNode); }