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

    Function overlayGrid

    • Create a grid overlay postprocess function

      Helper function that returns a Postprocess function for backwards compatibility.

      Parameters

      • svgIcons: Record<string, string>

        Record mapping icon IDs to SVG strings

      Returns (
          ctx: CanvasRenderingContext2D,
          W: number,
          H: number,
          params: Record<string, string>,
      ) => Promise<void> & {
          measure?: (
              params: Record<string, string>,
          ) => { width: number; height: number };
      }

      Postprocess function that overlays a grid of icons

        • (
              ctx: CanvasRenderingContext2D,
              W: number,
              H: number,
              params: Record<string, string>,
          ): Promise<void>
        • 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>

      • Optionalmeasure?: (params: Record<string, string>) => { width: number; height: number }
      const postprocess = overlayGrid({ icon1: '<svg>...</svg>', icon2: '<svg>...</svg>' });
      // Use in registerNamedImageHandlers