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