Skip to content

Commit 06553ed

Browse files
committed
Merge pull request hpneo#24 from npepinpe/master
drawPolygon behaves as drawPolylines
2 parents b2eaae1 + 28197f8 commit 06553ed

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

gmaps.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,13 @@ var GMaps = (function($) {
489489
options = $.extend({
490490
map: this.map
491491
}, options);
492+
493+
if($.isArray(options.paths)) {
494+
if($.isArray(options.paths[0])) {
495+
options.paths = $.map(options.paths, arrayToLatLng);
496+
}
497+
}
498+
492499
var polygon = new google.maps.Polygon(options);
493500

494501
var polygon_events = ['click', 'dblclick', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'rightclick'];
@@ -505,6 +512,10 @@ var GMaps = (function($) {
505512
this.polygons.push(polygon);
506513

507514
return polygon;
515+
516+
function arrayToLatLng(coords) {
517+
return new google.maps.LatLng(coords[0], coords[1]);
518+
}
508519
};
509520

510521
this.getFromFusionTables = function(options) {

0 commit comments

Comments
 (0)