fixed maxZoom
This commit is contained in:
parent
a772362599
commit
b82a0749b1
@ -108,42 +108,32 @@ export const cappedElementCanvasSize = (
|
|||||||
if (isLinearElement(element) || isFreeDrawElement(element)) {
|
if (isLinearElement(element) || isFreeDrawElement(element)) {
|
||||||
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
|
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
|
||||||
|
|
||||||
let width =
|
let width = distance(x1, x2) * window.devicePixelRatio + padding * 2;
|
||||||
distance(x1, x2) * window.devicePixelRatio * zoomValue +
|
let height = distance(y1, y2) * window.devicePixelRatio + padding * 2;
|
||||||
padding * zoomValue * 2;
|
|
||||||
let height =
|
|
||||||
distance(y1, y2) * window.devicePixelRatio * zoomValue +
|
|
||||||
padding * zoomValue * 2;
|
|
||||||
|
|
||||||
const size = width * height;
|
const size = width * height * zoomValue * zoomValue;
|
||||||
if (size > sizelimit) {
|
if (size > sizelimit) {
|
||||||
zoomValue = Math.sqrt(sizelimit / size) as NormalizedZoomValue;
|
zoomValue = Math.sqrt(
|
||||||
width =
|
sizelimit / (width * height),
|
||||||
distance(x1, x2) * window.devicePixelRatio * zoomValue +
|
) as NormalizedZoomValue;
|
||||||
padding * zoomValue * 2;
|
width = distance(x1, x2) * window.devicePixelRatio + padding * 2;
|
||||||
height =
|
height = distance(y1, y2) * window.devicePixelRatio + padding * 2;
|
||||||
distance(y1, y2) * window.devicePixelRatio * zoomValue +
|
|
||||||
padding * zoomValue * 2;
|
|
||||||
}
|
}
|
||||||
|
width *= zoomValue;
|
||||||
|
height *= zoomValue;
|
||||||
return { width, height, zoomValue };
|
return { width, height, zoomValue };
|
||||||
}
|
}
|
||||||
let width =
|
let width = element.width * window.devicePixelRatio + padding * 2;
|
||||||
element.width * window.devicePixelRatio * zoomValue +
|
let height = element.height * window.devicePixelRatio + padding * 2;
|
||||||
padding * zoomValue * 2;
|
|
||||||
let height =
|
|
||||||
element.height * window.devicePixelRatio * zoomValue +
|
|
||||||
padding * zoomValue * 2;
|
|
||||||
|
|
||||||
const size = width * height;
|
const size = width * height * zoomValue * zoomValue;
|
||||||
if (size > sizelimit) {
|
if (size > sizelimit) {
|
||||||
zoomValue = Math.sqrt(sizelimit / size) as NormalizedZoomValue;
|
zoomValue = Math.sqrt(sizelimit / (width * height)) as NormalizedZoomValue;
|
||||||
width =
|
width = element.width * window.devicePixelRatio + padding * 2;
|
||||||
element.width * window.devicePixelRatio * zoomValue +
|
height = element.height * window.devicePixelRatio + padding * 2;
|
||||||
padding * zoomValue * 2;
|
|
||||||
height =
|
|
||||||
element.height * window.devicePixelRatio * zoomValue +
|
|
||||||
padding * zoomValue * 2;
|
|
||||||
}
|
}
|
||||||
|
width *= zoomValue;
|
||||||
|
height *= zoomValue;
|
||||||
return { width, height, zoomValue };
|
return { width, height, zoomValue };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user