chore(resizer): cleanup

This commit is contained in:
moklick
2022-12-06 20:00:18 +01:00
parent 2f477f384f
commit 5e916ba2db
4 changed files with 8 additions and 5 deletions
+1 -2
View File
@@ -87,12 +87,10 @@ function ResizeControl({
} = startValues.current;
const { x: prevX, y: prevY, width: prevWidth, height: prevHeight } = prevValues.current;
const distX = Math.floor(enableX ? xSnapped - startX : 0);
const distY = Math.floor(enableY ? ySnapped - startY : 0);
const width = Math.max(startWidth + (invertX ? -distX : distX), minWidth);
const height = Math.max(startHeight + (invertY ? -distY : distY), minHeight);
const isWidthChange = width !== prevWidth;
const isHeightChange = height !== prevHeight;
@@ -131,6 +129,7 @@ function ResizeControl({
height: height,
},
};
changes.push(dimensionChange);
prevValues.current.width = width;
prevValues.current.height = height;