Skip to content

Commit

Permalink
Add clearLayers() method, resolves #12
Browse files Browse the repository at this point in the history
  • Loading branch information
eJuke committed Jun 20, 2018
1 parent 8cfc039 commit 1cfcf17
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
30 changes: 22 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion src/plugin/leaflet.canvas-markers.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ function layerFactory(L) {
return this;
},

clearLayers: function() {

this._latlngMarkers = null;
this._markers = null;
this._redraw(true);
},

_addMarker: function(marker,latlng,isDisplaying) {

var self = this;
Expand Down Expand Up @@ -277,8 +284,8 @@ function layerFactory(L) {

var self = this;

if (!this._map || !this._latlngMarkers) return;
if (clear) this._context.clearRect(0, 0, this._canvas.width, this._canvas.height);
if (!this._map || !this._latlngMarkers) return;

var tmp = [];

Expand Down

0 comments on commit 1cfcf17

Please sign in to comment.