import type { Movable } from "./movable"; import type { Constraint, ConstraintCallbacks, Coord } from "./types"; import type { Graphie } from "../util/graphie"; type State = { add: unknown[]; added: boolean; constraints: Constraint[]; coord: Coord; cursor: "move"; draw: ((state: State, prevState: State) => void)[]; hasMoved: boolean; id: string; modify: unknown[]; onClick: unknown[]; onMove: ((coord: Coord, prevCoord: Coord) => void)[]; onMoveEnd: unknown[]; onMoveStart: unknown[]; onRemove?: () => void; outOfBounds: boolean; pointSize: number; remove: (() => void)[]; shadow: boolean; static: boolean; tooltip: boolean; touchOffset: null | Coord; mouseTarget: unknown; visibleShape: { wrapper: HTMLElement; toBack(): void; toFront(): void; }; normalStyle: Record; highlightStyle: Record; }; export declare class MovablePoint { graphie: Graphie; movable: Movable>; state: State; prevState: State; _tooltip?: HTMLElement; _listenerMap: Record; constructor(graphie: Graphie, movable: Movable>, options: Partial); modify(options: any): void; _createDefaultState(): { coord: readonly [0, 0]; pointSize: 4; static: false; cursor: "move"; normalStyle: null; highlightStyle: null; shadow: false; tooltip: false; id: string; }; cloneState(): { add: unknown[]; added: boolean; constraints: Constraint[]; coord: Coord; cursor: "move"; draw: ((state: State, prevState: State) => void)[]; hasMoved: boolean; id: string; modify: unknown[]; onClick: unknown[]; onMove: ((coord: Coord, prevCoord: Coord) => void)[]; onMoveEnd: unknown[]; onMoveStart: unknown[]; onRemove?: () => void; outOfBounds: boolean; pointSize: number; remove: (() => void)[]; shadow: boolean; static: boolean; tooltip: boolean; touchOffset: null | Coord; mouseTarget: unknown; visibleShape: { wrapper: HTMLElement; toBack(): void; toFront(): void; }; normalStyle: Record; highlightStyle: Record; isHovering?: boolean; isMouseOver?: boolean; isDragging?: boolean; }; update(options: Partial): void; draw(): void; constrain(): boolean; /** * Fire an onSomething type event to all functions in listeners */ _fireEvent any>(listeners: F[], ...args: Parameters): void; /** * Combine the array of constraints functions * Returns either an [x, y] coordinate or false */ _applyConstraints(current: Coord, previous: Coord, extraOptions?: ConstraintCallbacks): Coord | false; /** * Displays a tooltip above the point, replacing any previous contents. If * there is no tooltip initialized, adds the tooltip. * * If the type of contents is string, the contents will be rendered as TeX * Otherwise, the content will be assumed to be a DOM node and will be * appended inside the tooltip. */ _showTooltip(contents: any): void; _hideTooltip(): void; coord(): Coord; setCoord(coord: Coord): void; setCoordConstrained(coord: any): void; /** * Add a listener to any event: startMove, constraints, onMove, onMoveEnd, * etc. If a listener is already bound to the given eventName and id, then * it is overwritten by func. * * eventName: the string name of the event to listen to. one of: * "onMoveStart", "onMove", "onMoveEnd", "draw", "remove" * * id: a string id that can be used to remove this event at a later time * note: adding multiple listeners with the same id is undefined behavior * * func: the function to call when the event happens, which is called * with the event's standard parameters [usually (coord, prevCoord) or * (state, prevState)] */ listen(eventName: string, id: string, func: () => unknown): void; /** * Remove a previously added listener, by the id specified in the * corresponding listen() call * * If the given id has not been registered already, this is a no-op */ unlisten(eventName: any, id: any): void; grab(coord: Coord): void; moveTo(coord: Coord): void; remove(): void; pointSize(): number; static(): boolean; cursor(): "move"; normalStyle(): Record; highlightStyle(): Record; shadow(): boolean; tooltip(): boolean; added(): boolean; hasMoved(): boolean; visibleShape(): { wrapper: HTMLElement; toBack(): void; toFront(): void; }; outOfBounds(): boolean; mouseTarget(): unknown; touchOffset(): Coord | null; /** * Forwarding methods to this.movable: */ isHovering(): boolean | undefined; isDragging(): boolean | undefined; toBack(): void; toFront(): void; static add: { readonly constrain: () => void; }; static modify: { readonly draw: () => void; }; static draw: { readonly basic: (state: any, prevState: any) => void; readonly highlight: (state: any, prevState: any) => void; }; static remove: { readonly basic: () => void; }; static onMoveStart: { standard: null; }; static constraints: { readonly fixed: () => Constraint; readonly snap: (snap?: number | null) => Constraint; readonly bound: (range?: [import("../util/interval").Interval, import("../util/interval").Interval], snap?: Coord | number, optionalPaddingPx?: number) => Constraint; }; static onMove: { standard: null; }; static onMoveEnd: { standard: null; }; static onClick: { standard: null; }; } export {};