Skip to content

Commit

Permalink
only re-init markers when limitMarkerCount option is active
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofsumit committed Mar 17, 2020
1 parent c9c692a commit 18a31bb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/js/Mixins/MarkerLimits.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ const MarkerLimits = {
// refresh cache when layer was edited (e.g. when a vertex was added or removed)
this._layer.on('pm:edit', this.createCache, this)

// re-init markers when a vertex is removed.
// The reason is that syncing this cache with a removed marker was impossible to do
this._layer.on('pm:vertexremoved', this._initMarkers, this)


// apply filter for the first time
this.applyLimitFilters({});
Expand All @@ -22,6 +20,10 @@ const MarkerLimits = {

// add markers closest to the mouse
if (this.options.limitMarkersToCount > -1) {
// re-init markers when a vertex is removed.
// The reason is that syncing this cache with a removed marker was impossible to do
this._layer.on('pm:vertexremoved', this._initMarkers, this)

this._map.on('mousemove', this.applyLimitFilters, this);
}
},
Expand Down

0 comments on commit 18a31bb

Please sign in to comment.