hex-world
    Preparing search index...

    Function getMapImageTransform

    • Builds the world ↔ pixel mapping for a map image without drawing anything.

      Use it to size a canvas ahead of time, or to convert coordinates for an overlay drawn beside an image produced earlier with the same options.

      Parameters

      Returns MapImageTransform

      const t = getMapImageTransform(map, layout, { scale: 2 });
      canvas.width = t.width; canvas.height = t.height;
      const { x, y } = t.worldToImage(camera.position.x, camera.position.z);