Skip to content

Simple and fast Javascript library for drawing draggable polygons in Google Maps

License

Notifications You must be signed in to change notification settings

mybuilder/bermuda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bermuda

Simple and fast Javascript library for drawing draggable polygons in Google Maps!

Map Dragging

Usage

Include required libraries

<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script src="bermuda.min.js"></script>

Paint fancy polygons!

var map = new Bermuda(document.getElementById("map-canvas"));
map.draw([[25.774, -80.190], [18.466, -66.118], [32.321, -64.757]]);

Available Operations

Once you build your map, you could do some amazing stuff with it, the available operations are listed below

method arguments return description
draw Array none Draw markers and polygon on the map
zoomIn none none Zoom in
zoomOut none none Zoom out
disable none none Freeze the map, disable interaction
enable none none Re-enable interaction
getCoords none Array Get the current marker coordinates
clear none none Remove all markers and polygon from the map

Configuration Options

property type description
map Object Options for google.maps.Map
polygon Object Options for google.maps.Polygon
icon Object Configuration for marker icons
autoCentered Boolean Map automatic centering
onChange Function This function will be called everytime a pin is dragged
disabled Boolean Interaction disabled

Example

var map = new Bermuda(document.getElementById("map-canvas"), {
    polygon: {
      strokeColor: "#008525",
      fillColor: "#008525"
    },
    icon: {
      image: "images/map-pin@2x.png",
      width: 15,
      height: 21
    },
    autoCentered: true,
    onChange: function(coords) {
        console.log(coords);
    }
});

Enjoy!

About

Simple and fast Javascript library for drawing draggable polygons in Google Maps

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published