interface IPrimitive {
    afterAutoscale(): void;
    attached(host: PrimitiveHost): void;
    autoscaleInfo(): null | { max: number; min: number };
    detached(): void;
    draw(ctx: CanvasRenderingContext2D, rc: PrimitiveRenderContext): void;
    hitTest(
        x: number,
        y: number,
        rc: PrimitiveRenderContext,
    ): null | PrimitiveHit;
    zOrder(): ZOrder;
}

Implemented by

Methods

  • Optional: run once per frame after every scale on the pane has been measured, and before anything is painted.

    draw is too late for anything that has to change a scale, because the price axis is painted near the top of paintBase while primitives draw further down: a range corrected in draw labels its axis one frame late, and on a static chart that frame never comes. A comparison overlay lining its scale up with the pane's own is the case this exists for.

    Returns void

  • Optional: expand the pane's autoscale range so this primitive isn't clipped.

    Returns null | { max: number; min: number }