plotomics
    Preparing search index...

    Interface PlotBox

    The frame of a plot and the box in it that holds the plot's layers.

    The frame fills the element's padding box and takes the theme background. The box sits the theme padding in from each side of the frame, so every layer in it, and every coordinate a layer draws at, starts inside the padding.

    interface PlotBox {
        box: HTMLDivElement;
        padding: PlotPadding;
        fit(
            width: number,
            height: number,
            theme: Pick<PlotomicsTheme, "padding" | "background">,
        ): { height: number; width: number };
        pointer(clientX: number, clientY: number): { x: number; y: number };
        remove(): void;
    }
    Index
    box: HTMLDivElement

    The element the plot's layers go in.

    padding: PlotPadding

    The padding in px, from the last PlotBox.fit.

    • Place the box in an element width x height px, with the padding and the background of theme. Returns the size of the box: the size of the element less the padding, never below 0.

      Parameters

      • width: number
      • height: number
      • theme: Pick<PlotomicsTheme, "padding" | "background">

      Returns { height: number; width: number }

    • The point clientX, clientY in px from the top left corner of the box. It is read from the box itself, so it lines up with the layers in an element with a CSS border too.

      Parameters

      • clientX: number
      • clientY: number

      Returns { x: number; y: number }

    • Remove the frame and the layers in it.

      Returns void