Skip to content

Commit e7add0c

Browse files
committed
Allow resizing in both dimensions at once
Increased the minimum size to ensure the resized viewport can always be dragged.
1 parent a4ee219 commit e7add0c

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/cropt.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ export class Cropt {
685685
const origY = ev.pageY;
686686
const origW = this.#vpWidth;
687687
const origH = this.#vpHeight;
688-
const minSize = 20;
688+
const minSize = 60;
689689

690690
handle.setPointerCapture(ev.pointerId);
691691

@@ -707,9 +707,11 @@ export class Cropt {
707707
Math.max(minSize, Math.min(maxSize, origSize + 2 * sign * pointerDelta)),
708708
);
709709

710-
[this.#vpWidth, this.#vpHeight] = isHoriz
711-
? [newSize, this.options.viewport.height]
712-
: [this.options.viewport.width, newSize];
710+
if (isHoriz) {
711+
this.#vpWidth = newSize;
712+
} else {
713+
this.#vpHeight = newSize;
714+
}
713715

714716
this.#setOptionsCss();
715717
this.#cacheViewportRect();

0 commit comments

Comments
 (0)