From 7b276926eb9bb0c593b67d814b5d81091fc49368 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Fri, 13 Dec 2024 01:26:32 -0600 Subject: [PATCH] Update zoom limit when dynamically resizing viewport --- src/cropt.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cropt.ts b/src/cropt.ts index 1f4957e..eb24c7e 100644 --- a/src/cropt.ts +++ b/src/cropt.ts @@ -287,14 +287,14 @@ export class Cropt { options.viewport = { ...this.options.viewport, ...options.viewport }; } - this.options = { ...this.options, ...(options as CroptOptions) }; + this.options = structuredClone({ ...this.options, ...(options as CroptOptions) }); this.#setOptionsCss(); if ( this.options.viewport.width !== curWidth || this.options.viewport.height !== curHeight ) { - this.refresh(); + this.#updateZoomLimits(); } }