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

    Function computeTargetSize

    • Compute target rendering size for an SVG

      Extracts dimensions from width/height attributes or viewBox, applying pixel ratio. This is a public utility that can be used independently of the overlay operations.

      Parameters

      • svg: string

        SVG markup string

      • pixelRatio: number

        Target pixel ratio

      • fallback: { width: number; height: number }

        Fallback dimensions if none found in SVG

      Returns { width: number; height: number }

      Target width and height in pixels

      const size = computeTargetSize('<svg width="24" height="24">...</svg>', 2, { width: 32, height: 32 });
      // => { width: 48, height: 48 }