Skip to content

Commit

Permalink
Fix: Vector disappears when panning.
Browse files Browse the repository at this point in the history
  • Loading branch information
king_arthur23 authored and king_arthur23 committed Aug 4, 2017
1 parent da75a62 commit d8ee503
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/layer/vector/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ L.Canvas = L.Renderer.extend({

// translate so we use the same path coordinates after canvas element moves
this._ctx.translate(-b.min.x, -b.min.y);

// Tell paths to redraw themselves
this.fire('update');
},

_initPath: function (layer) {
Expand Down
8 changes: 2 additions & 6 deletions src/layer/vector/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,10 @@ L.Renderer = L.Layer.extend({

this.getPane().appendChild(this._container);
this._update();

this._map.on('rotate', this._update, this);
},

onRemove: function () {
L.DomUtil.remove(this._container);
this._map.off('rotate', this._update, this);
},

getEvents: function () {
Expand Down Expand Up @@ -90,7 +87,8 @@ L.Renderer = L.Layer.extend({
},

_update: function () {
// update pixel bounds of renderer container (for positioning/sizing/clipping later)
// Update pixel bounds of renderer container (for positioning/sizing/clipping later)
// Subclasses are responsible of firing the 'update' event.
var p = this.options.padding,
map = this._map,
size = this._map.getSize(),
Expand All @@ -111,8 +109,6 @@ L.Renderer = L.Layer.extend({

this._center = this._map.getCenter();
this._zoom = this._map.getZoom();

this.fire('update');
}
});

Expand Down
2 changes: 2 additions & 0 deletions src/layer/vector/SVG.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ L.SVG = L.Renderer.extend({
// movement: update container viewBox so that we don't have to change coordinates of individual layers
L.DomUtil.setPosition(container, b.min);
container.setAttribute('viewBox', [b.min.x, b.min.y, size.x, size.y].join(' '));

this.fire('update');
},

// methods below are called by vector layers implementations
Expand Down

0 comments on commit d8ee503

Please sign in to comment.