From 14c3d190e9c7c0d324e0ce9c3b6c60ec904cdf3a Mon Sep 17 00:00:00 2001 From: Vishal Date: Mon, 23 Aug 2021 17:57:17 +0530 Subject: [PATCH] Max cap on scale #905 (#1128) --- .../lazy-app/Compress/Output/custom-els/PinchZoom/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/lazy-app/Compress/Output/custom-els/PinchZoom/index.ts b/src/client/lazy-app/Compress/Output/custom-els/PinchZoom/index.ts index a14514d3..9e5acd4f 100644 --- a/src/client/lazy-app/Compress/Output/custom-els/PinchZoom/index.ts +++ b/src/client/lazy-app/Compress/Output/custom-els/PinchZoom/index.ts @@ -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;