tangram icon indicating copy to clipboard operation
tangram copied to clipboard

tangramLayer and marker class

Open meetar opened this issue 5 years ago • 0 comments

This is a WIP branch, introducing new tangramLayer and marker classes, to offer an alternative to Leaflet. This will allow further development of more features currently not supported by Leaflet (or supported only partially, or only through plugins). The ultimate goal is a more powerful and flexible library, with a smaller footprint and fewer dependencies.

src/tangramLayer.js provides a similar public API to the existing leafletLayer API, with a few differences:

import Tangram from '../dist/tangram.debug.mjs';

(function () {
    var scene_url = 'demos/scene.yaml';

    /*** Map ***/

    // Create Tangram map in the element called 'map'
    const map = Tangram.tangramLayer('map', {
        scene: scene_url
    });

    /*** Map ***/

    window.addEventListener('load', () => {
        const options = {
            maxZoom: 20,
            zoomSnap: 0,
            keyboard: false,
            center: { lat: 40.70531887544228, lng: -74.00976419448853 },
        };

        map.initialize(options);

        window.scene = map.scene; // set by tangramLayer

    });
    window.map = map;
}());

meetar avatar Feb 25 '19 23:02 meetar