gmaps-lib v0.0.4
Library for gmaps
Install via npm:
npm i gmaps-lib --save
js
import gmaps from 'gmaps-lib';
Usage
const config = {
key:'AIzaSyAd1xMYT1bt99qtFWQEzXiRBvORDWHgPtk',
icons:{
main: {
url: '/path/to/image',
},
main_active: {
url: '/path/to/image',
}
},
infoBubble:{
shadowStyle: 0,
padding: 0,
backgroundColor: '#fff',
borderRadius: 0,
arrowSize: 10,
borderWidth: 0,
disableAutoPan: true,
hideCloseButton: true,
arrowPosition: 50,
backgroundClassName: 'b-map-info-window__shadow',
arrowStyle: 0,
maxWidth:300,
minWidth:300
}
}
gmaps.apiLoader(config.key,config.libs)
.then(resp=>{
const map = new gmaps.Map(node,{
center:{
lat:40.714,
lng:-74.005
},
zoom: 8
},config.infoBubble);
map.markerAdd([
{lat:41.714,lng:-73.005},
{lat:40.714,lng:-72.005},
{lat:40.714,lng:-74.005}
],{
icon:config.icons.main
});
map.vpOnMarkers();
map.onChangeActiveMarker = (newIdx,oldIdx)=>{
const marker = map.markerList[newIdx];
map.ibOpenOne(marker,'className');
};
});