mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-14 17:49:52 +00:00
@@ -81,6 +81,7 @@ function createPoint(): SVGPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const MIN_SCALE = 0.01;
|
const MIN_SCALE = 0.01;
|
||||||
|
const MAX_SCALE = 100000;
|
||||||
|
|
||||||
export default class PinchZoom extends HTMLElement {
|
export default class PinchZoom extends HTMLElement {
|
||||||
// The element that we'll transform.
|
// The element that we'll transform.
|
||||||
@@ -244,6 +245,9 @@ export default class PinchZoom extends HTMLElement {
|
|||||||
// Avoid scaling to zero
|
// Avoid scaling to zero
|
||||||
if (scale < MIN_SCALE) return;
|
if (scale < MIN_SCALE) return;
|
||||||
|
|
||||||
|
// Avoid scaling to very large values
|
||||||
|
if (scale > MAX_SCALE) return;
|
||||||
|
|
||||||
// Return if there's no change
|
// Return if there's no change
|
||||||
if (scale === this.scale && x === this.x && y === this.y) return;
|
if (scale === this.scale && x === this.x && y === this.y) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user