2.1.0 • Published 10 years ago

gmap-helpers v2.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

gmap-helpers

gmap-helpers is a tiny wrapper around the google maps API. It is made for users like me who usually only have to embed a map on a contact page. The existing API from Google itself is awesome, but I always forget the little details like: Why doesn't a click on a marker with a URL open the URL?

This library does all this automatically for you, which is great for simlpe maps.

Usage

npm install gmap-helpers
import GMap from "gmap-helpers";

const canvas = document.getElementById("map");
const pos = new google.maps.LatLng("50.937531", "6.960278600000038");
const options = {
  zoom: 4,
  maxZoom: 18,
  center: pos,
  disableDefaultUI: true
};

const map = new GMap(canvas, options);
const marker = map.placeMarker({
  position: pos,
  url: "https://example.com/"
});

GMap class methods

placeMarker

Adds a marker to the current map and assign a click event if an url is set.

fitMarkers

Fit all given markers into the current map viewport.

clearMarkers

setActiveIcon

Set a different icon for the given markers.

Remove all markers from the current map.|

2.1.0

10 years ago

2.0.0

10 years ago

1.4.3

10 years ago

1.3.3

10 years ago

1.3.2

10 years ago

1.3.1

10 years ago

1.3.0

10 years ago

1.2.0

10 years ago

1.0.0

10 years ago