Performance: don’t set width/height on SVG if unchanged. Saves a costly layout/repaint in some situations.
This commit is contained in:
parent
e522582da3
commit
132e5b6f7c
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user