Merge pull request #2742 from fab1an/perf-svgheight

Performance: don’t set width/height on SVG if unchanged. Saves a costly ...
This commit is contained in:
Vladimir Agafonkin 2014-06-17 17:47:35 +03:00
commit ecbb681b91

View File

@ -31,11 +31,17 @@ L.SVG = L.Renderer.extend({
L.DomUtil.setPosition(container, b.min); L.DomUtil.setPosition(container, b.min);
// update container viewBox so that we don't have to change coordinates of individual layers // set size of svg-container if changed
container.setAttribute('width', size.x); if (!this._svgSize || !this._svgSize.equals(size)) {
container.setAttribute('height', size.y); this._svgSize = size;
container.setAttribute('viewBox', [b.min.x, b.min.y, size.x, size.y].join(' ')); container.setAttribute('width', size.x);
container.setAttribute('height', size.y);
}
// 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(' '));
if (L.Browser.mobileWebkit) { if (L.Browser.mobileWebkit) {
pane.appendChild(container); pane.appendChild(container);
} }