Max cap on scale #905 (#1128)

This commit is contained in:
Vishal
2021-08-23 17:57:17 +05:30
committed by GitHub
parent eeaa19589e
commit 14c3d190e9

View File

@@ -81,6 +81,7 @@ function createPoint(): SVGPoint {
}
const MIN_SCALE = 0.01;
const MAX_SCALE = 100000;
export default class PinchZoom extends HTMLElement {
// The element that we'll transform.
@@ -244,6 +245,9 @@ export default class PinchZoom extends HTMLElement {
// Avoid scaling to zero
if (scale < MIN_SCALE) return;
// Avoid scaling to very large values
if (scale > MAX_SCALE) return;
// Return if there's no change
if (scale === this.scale && x === this.x && y === this.y) return;