From 7d6212b6638a8c1a9f072da82d3d1d85e51a05d9 Mon Sep 17 00:00:00 2001 From: Ryan Stafford Date: Fri, 22 Dec 2023 13:20:09 -0500 Subject: [PATCH] min resize --- public/utils.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/utils.js b/public/utils.js index d087cca..be07e21 100644 --- a/public/utils.js +++ b/public/utils.js @@ -49,11 +49,13 @@ var startSize = [0,0] document.onmousemove = function(e) { if (resizeTarget) { resizeTarget.style.maxWidth = 'unset'; - let y = startSize[0] + (e.clientY - startCoordinates[1]) * 1.5 - let x = startSize[1] + (e.clientX - startCoordinates[0]) * 1.5 + let y = startSize[0] + (e.clientY - startCoordinates[1]) *3 + let x = startSize[1] + (e.clientX - startCoordinates[0]) *3 let ratio = Math.min(y/startSize[0], x/startSize[1]) - resizeTarget.height = startSize[0]*ratio - resizeTarget.width = startSize[1]*ratio + let newY = startSize[0]*ratio + let newX = startSize[1]*ratio + resizeTarget.height = newY > 30 ? newY : 30 + resizeTarget.width = newX > 30 ? newX : 30 } } document.onmouseup = function(e){