ixfx
    Preparing search index...

    Type Alias SvgHelper

    Helper to make SVG elements with a common parent.

    Create with makeHelper.

    type SvgHelper = {
        get height(): number;
        set height(height: number): void;
        get parent(): SVGElement;
        get width(): number;
        set width(width: number): void;
        circle(
            circle: CirclePositioned,
            opts?: CircleDrawingOpts,
            queryOrExisting?: string | SVGCircleElement,
        ): SVGCircleElement;
        clear(): void;
        grid(
            center: Point,
            spacing: number,
            width: number,
            height: number,
            opts?: LineDrawingOpts,
        ): SVGGElement;
        line(
            line: Line,
            opts?: LineDrawingOpts,
            queryOrExisting?: string | SVGLineElement,
        ): SVGLineElement;
        path(
            svgString: string | readonly string[],
            opts?: PathDrawingOpts,
            queryOrExisting?: string | SVGPathElement,
        ): SVGPathElement;
        query<V extends SVGElement>(selectors: string): null | V;
        remove(queryOrExisting: string | SVGElement): void;
        text(
            text: string,
            pos: Point,
            opts?: TextDrawingOpts,
            queryOrExisting?: string | SVGTextElement,
        ): SVGTextElement;
        textPath(
            pathReference: string,
            text: string,
            opts?: TextDrawingOpts,
            textQueryOrExisting?: string | SVGTextElement,
            pathQueryOrExisting?: string | SVGTextPathElement,
        ): SVGTextPathElement;
    }
    Index

    Accessors

    Methods

    • Creates a grid of horizontal and vertical lines inside of a group

      Parameters

      • center: Point

        Grid origin

      • spacing: number

        Cell size

      • width: number

        Width of grid

      • height: number

        Height of grid

      • Optionalopts: LineDrawingOpts

        Drawing options

      Returns SVGGElement

    • Creates a line

      Parameters

      • line: Line

        Line

      • Optionalopts: LineDrawingOpts

        Drawing options

      • OptionalqueryOrExisting: string | SVGLineElement

        DOM query to look up existing element, or the element instance

      Returns SVGLineElement

    • Creates a path

      Parameters

      • svgString: string | readonly string[]

        Path description, or empty string

      • Optionalopts: PathDrawingOpts

        Drawing options

      • OptionalqueryOrExisting: string | SVGPathElement

        DOM query to look up existing element, or the element instance

      Returns SVGPathElement

    • Returns an element if it exists in parent

      Type Parameters

      • V extends SVGElement

      Parameters

      • selectors: string

        Eg #path

      Returns null | V

    • Parameters

      • queryOrExisting: string | SVGElement

      Returns void

    • Creates a text element

      Parameters

      • text: string

        Text

      • pos: Point

        Position

      • Optionalopts: TextDrawingOpts

        Drawing options

      • OptionalqueryOrExisting: string | SVGTextElement

        DOM query to look up existing element, or the element instance

      Returns SVGTextElement

    • Creates text on a path

      Parameters

      • pathReference: string

        Reference to path element

      • text: string

        Text

      • Optionalopts: TextDrawingOpts

        Drawing options

      • OptionaltextQueryOrExisting: string | SVGTextElement

        DOM query to look up existing element, or the element instance

      • OptionalpathQueryOrExisting: string | SVGTextPathElement

        DOM query to look up existing element, or the element instance

      Returns SVGTextPathElement