TomTom Maps for JavaScript
    Preparing search index...

    Type Alias MapEffectsLayer

    A 2D canvas layer of your own, such as a paper texture or film grain, placed between the plugin's overlay effects and drawn by MapEffects.capture in the same place.

    type MapEffectsLayer = {
        draw: (
            context: CanvasRenderingContext2D,
            raster: { height: number; pixelRatio: number; width: number },
        ) => void;
        id: string;
        placement: MapEffectsLayerPlacement;
    }
    Index
    draw: (
        context: CanvasRenderingContext2D,
        raster: { height: number; pixelRatio: number; width: number },
    ) => void

    Paints the layer onto a cleared context the size of the map's canvas, in device pixels.

    • pixelRatio is the device pixels per CSS pixel, to scale CSS lengths by.
    • It is called whenever the map renders, and by MapEffects.capture at the capture's own size.
    • A draw that throws leaves the layer empty for that draw, with one warning.
    id: string

    Names the layer for MapEffects.removeLayer. Adding a layer under an id in use replaces it in place.