maplibre-gl-svg-sprite - v0.2.0
    Preparing search index...

    Class OverlayGrid

    Post-processing operation to overlay a grid of SVG icons

    Supports query parameters: icons, grid, gap, columns, gridFg, gfg, gridBg, gbg, fg, bg, itemW, itemH, gridAnchor, anchor, gx, gy, bgFill, pixelRatio

    Create a grid overlay operation for displaying multiple icons.

    const op = new OverlayGrid({ icon1: '<svg>...</svg>', icon2: '<svg>...</svg>' });
    // Use with params: ?icons=icon1,icon2&columns=2&gap=4

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Create a new grid overlay operation

      Parameters

      • svgIcons: Record<string, string>

        Record mapping icon IDs to SVG strings

      • id: string = 'overlayGrid'

        Optional identifier for debugging

      Returns OverlayGrid

    Properties

    id?: string

    Unique identifier or descriptive name

    Methods

    • Compute the natural grid size (CSS pixels) for the current params. Returns { width, height } that fits icons using itemW/itemH or inferred sizes, including gaps between cells.

      Parameters

      • params: Record<string, string>

      Returns { width: number; height: number }

    • Execute the post-processing operation

      Parameters

      • ctx: CanvasRenderingContext2D

        Canvas 2D rendering context

      • W: number
      • H: number
      • params: Record<string, string>

        Query parameters from the image request

      Returns Promise<void>