Maintain aspect ratio when overdragging

This commit is contained in:
Josh Hawkins 2024-06-05 11:10:17 -05:00
parent 8c96dfe1d1
commit 68a9c6e657

View File

@ -321,7 +321,7 @@ export default function DraggableGridLayout({
const heightDiff = layoutItem.h - oldLayoutItem.h;
const widthDiff = layoutItem.w - oldLayoutItem.w;
const changeCoef = oldLayoutItem.w / oldLayoutItem.h;
if (Math.abs(heightDiff) < Math.abs(widthDiff) || layoutItem.w == 12) {
if (Math.abs(heightDiff) != Math.abs(widthDiff) || layoutItem.w == 12) {
layoutItem.h = layoutItem.w / changeCoef;
placeholder.h = layoutItem.w / changeCoef;
} else {