1.0.3 • Published 1 year ago

@nora-soderlund/markerbundle v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Get Started

npm install @nora-soderlund/MarkerBundle

Example

import MarkerBundle from "@nora-soderlund/MarkerBundle";

const center = {
    lat: 58.3797077874133,
    lng: 12.324640529544448
};

const map = new google.maps.Map(document.getElementById("map"), {
    center,

    zoom: 12
});

MarkerBundle.getMarkerImage().then((image) => {
    const bundle = new MarkerBundle(map, center, image);

    const infowindow = new google.maps.InfoWindow({});
    
    for(let index = 1; index < 5; index++) {
        const marker = new google.maps.Marker({
            map: this.map,
            position: this.center
        });
    
        marker.addListener("click", (event) => {
            infowindow.setContent("Marker " + index);
    
            infowindow.open({
                map: this.map,
                anchor: bundle.marker
            });
        });
    
        bundle.addMarker(marker);
    }
});
1.0.3

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago