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,9 +31,15 @@ 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
// 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) {