diff --git a/debug/vector/vector2.html b/debug/vector/vector2.html index 9840e610..84a9fae3 100644 --- a/debug/vector/vector2.html +++ b/debug/vector/vector2.html @@ -37,13 +37,16 @@ var circle = L.circle([35, 0], 700000, {color: 'green', renderer: canvas}).addTo(map).bindPopup('Hello Circle'); var circleMarker = L.circleMarker([35, 30], {color: 'magenta', radius: 30}).addTo(map).bindPopup('Happy New Year!'); + map.on('mousemove', function (e) { + circle.setLatLng(e.latlng); + }); + map.setView([36, 52], 3); var layersControl = new L.Control.Layers({ }, { 'poly': poly, 'path': path, - // 'rect': rect, 'circle': circle, 'circleMarker': circleMarker, 'canvas': canvas, diff --git a/src/layer/vector/Canvas.js b/src/layer/vector/Canvas.js index 64a46110..3b7655ae 100644 --- a/src/layer/vector/Canvas.js +++ b/src/layer/vector/Canvas.js @@ -60,6 +60,14 @@ L.Canvas = L.Renderer.extend({ this._requestRedraw(layer); }, + _updatePath: function (layer) { + this._redrawBounds = layer._pxBounds; + this._draw(true); + layer._project(); + this._draw(); + this._redrawBounds = null; + }, + _updateStyle: function (layer) { this._requestRedraw(layer); }, diff --git a/src/layer/vector/Path.js b/src/layer/vector/Path.js index b52f778e..16c5defd 100644 --- a/src/layer/vector/Path.js +++ b/src/layer/vector/Path.js @@ -45,8 +45,7 @@ L.Path = L.Layer.extend({ redraw: function () { if (this._map) { - this._project(); - this._update(); + this._renderer._updatePath(this); } return this; }, diff --git a/src/layer/vector/SVG.js b/src/layer/vector/SVG.js index 98fa1504..0c337d3d 100644 --- a/src/layer/vector/SVG.js +++ b/src/layer/vector/SVG.js @@ -69,6 +69,11 @@ L.SVG = L.Renderer.extend({ delete this._paths[L.stamp(path)]; }, + _updatePath: function (layer) { + layer._project(); + layer._update(); + }, + _updateStyle: function (layer) { var path = layer._path, options = layer.options;