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