Skip to content
Browse files

fixes #77 Markers group should be created only once

  • Loading branch information...
1 parent 6c21cea commit dffc1e6aa69a71fa1476d6d3a7ebc22de03c9265 @bjornd committed
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/world-map.js
View
7 lib/world-map.js
@@ -589,14 +589,15 @@ jvm.WorldMap.prototype = {
},
createMarkers: function(markers) {
- var group = this.canvas.addGroup(),
- i,
+ var i,
marker,
point,
markerConfig,
markersArray,
map = this;
+ this.markersGroup = this.markersGroup || this.canvas.addGroup();
+
if ($.isArray(markers)) {
markersArray = markers.slice();
markers = {};
@@ -613,7 +614,7 @@ jvm.WorldMap.prototype = {
"data-index": i,
cx: point.x,
cy: point.y
- }, $.extend(true, {}, this.params.markerStyle, {initial: markerConfig.style || {}}), group);
+ }, $.extend(true, {}, this.params.markerStyle, {initial: markerConfig.style || {}}), this.markersGroup);
marker.addClass('jvectormap-marker');
$(marker.node).bind('selected', function(e, isSelected){
map.container.trigger('markerSelected.jvectormap', [$(this).attr('data-index'), isSelected, map.getSelectedMarkers()]);

0 comments on commit dffc1e6

Please sign in to comment.
Something went wrong with that request. Please try again.