Merge pull request #11559 from MoonE/multi-world-only-draw-visible

Only draw visible worlds
This commit is contained in:
Andreas Hocevar
2020-09-15 10:06:01 +02:00
committed by GitHub
+29 -76
View File
@@ -219,84 +219,37 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
viewHints[ViewHint.ANIMATING] || viewHints[ViewHint.INTERACTING] viewHints[ViewHint.ANIMATING] || viewHints[ViewHint.INTERACTING]
); );
const transform = this.getRenderTransform(
center,
resolution,
rotation,
pixelRatio,
width,
height,
0
);
const declutterReplays = this.getLayer().getDeclutter() ? {} : null; const declutterReplays = this.getLayer().getDeclutter() ? {} : null;
replayGroup.execute(
context,
1,
transform,
rotation,
snapToPixel,
undefined,
declutterReplays
);
if ( const multiWorld = vectorSource.getWrapX() && projection.canWrapX();
vectorSource.getWrapX() && const worldWidth = multiWorld ? getWidth(projectionExtent) : null;
projection.canWrapX() && const endWorld = multiWorld
!containsExtent(projectionExtent, extent) ? Math.ceil((extent[2] + projectionExtent[2]) / worldWidth)
) { : 1;
let startX = extent[0]; let world = multiWorld
const worldWidth = getWidth(projectionExtent); ? Math.floor((extent[0] - projectionExtent[0]) / worldWidth)
let world = 0; : 0;
let offsetX; do {
while (startX < projectionExtent[0]) { const transform = this.getRenderTransform(
--world; center,
offsetX = worldWidth * world; resolution,
const transform = this.getRenderTransform( rotation,
center, pixelRatio,
resolution, width,
rotation, height,
pixelRatio, world * worldWidth
width, );
height, replayGroup.execute(
offsetX context,
); 1,
replayGroup.execute( transform,
context, rotation,
1, snapToPixel,
transform, undefined,
rotation, declutterReplays
snapToPixel, );
undefined, } while (++world < endWorld);
declutterReplays
);
startX += worldWidth;
}
world = 0;
startX = extent[2];
while (startX > projectionExtent[2]) {
++world;
offsetX = worldWidth * world;
const transform = this.getRenderTransform(
center,
resolution,
rotation,
pixelRatio,
width,
height,
offsetX
);
replayGroup.execute(
context,
1,
transform,
rotation,
snapToPixel,
undefined,
declutterReplays
);
startX -= worldWidth;
}
}
if (declutterReplays) { if (declutterReplays) {
const viewHints = frameState.viewHints; const viewHints = frameState.viewHints;
const hifi = !( const hifi = !(