Smaller canvas when rotating vector layers
This commit is contained in:
@@ -123,12 +123,8 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
||||
}
|
||||
|
||||
// resize and clear
|
||||
let width = Math.round(frameState.size[0] * pixelRatio);
|
||||
let height = Math.round(frameState.size[1] * pixelRatio);
|
||||
if (rotation) {
|
||||
const size = Math.round(Math.sqrt(width * width + height * height));
|
||||
width = height = size;
|
||||
}
|
||||
const width = Math.round(frameState.size[0] * pixelRatio);
|
||||
const height = Math.round(frameState.size[1] * pixelRatio);
|
||||
if (canvas.width != width || canvas.height != height) {
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
@@ -193,12 +189,6 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
||||
canvas.style.opacity = opacity;
|
||||
}
|
||||
|
||||
const rotation = frameState.viewState.rotation;
|
||||
const transform = 'rotate(' + rotation + 'rad)';
|
||||
if (transform !== canvas.style.transform) {
|
||||
canvas.style.transform = transform;
|
||||
}
|
||||
|
||||
return canvas;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user