边框调节

This commit is contained in:
zqm
2026-01-04 13:50:28 +08:00
parent 0128df1ec0
commit d048d0af8a

View File

@@ -470,6 +470,10 @@ const onResizeStart = (e, direction) => {
height: currentPosition.y - startPosition.y height: currentPosition.y - startPosition.y
}; };
// 定义最小尺寸常量
const minWidth = 200;
const minHeight = 30;
// 根据方向正确计算新尺寸 // 根据方向正确计算新尺寸
let newWidth = areaStartState.width; let newWidth = areaStartState.width;
let newHeight = areaStartState.height; let newHeight = areaStartState.height;
@@ -492,6 +496,12 @@ const onResizeStart = (e, direction) => {
newHeight = areaStartState.height + totalDelta.height; newHeight = areaStartState.height + totalDelta.height;
} }
// 检查尺寸是否小于最小值,如果小于则不发送事件
if (newWidth < minWidth || newHeight < minHeight) {
// 尺寸小于最小值,不发送事件,停止拖拽
return;
}
const newSize = { const newSize = {
width: newWidth, width: newWidth,
height: newHeight height: newHeight