Skip to content

Commit

Permalink
fixes #77 Markers group should be created only once
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornd committed Sep 3, 2012
1 parent 6c21cea commit dffc1e6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/world-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand All @@ -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()]);
Expand Down

0 comments on commit dffc1e6

Please sign in to comment.