修复右分隔条拖拽异常
This commit is contained in:
@@ -82,11 +82,17 @@ const getTargetElement = () => {
|
||||
// 计算新的尺寸
|
||||
const calculateNewSize = (startSize, delta, minSize, maxSize, position) => {
|
||||
let newSize = startSize
|
||||
if (position === 'left' || position === 'top' || position === 'right' || position === 'bottom') {
|
||||
// 统一逻辑:向左/上拖减小尺寸,向右/下拖增大尺寸
|
||||
if (position === 'left' || position === 'top') {
|
||||
// 左侧或顶部分隔条:向左/上拖减小尺寸,向右/下拖增大尺寸
|
||||
// 当向左拖动时,delta 为负数,startSize + delta 会减小
|
||||
// 当向右拖动时,delta 为正数,startSize + delta 会增大
|
||||
newSize = startSize + delta
|
||||
} else if (position === 'right' || position === 'bottom') {
|
||||
// 右侧或底部分隔条:向左/上拖减小尺寸,向右/下拖增大尺寸
|
||||
// 当向左拖动时,delta 为负数,startSize - delta 会增大
|
||||
// 当向右拖动时,delta 为正数,startSize - delta 会减小
|
||||
// 注意:这里的逻辑与左侧相反,因为右侧分隔条控制的是右侧面板
|
||||
newSize = startSize - delta
|
||||
}
|
||||
return Math.max(minSize, Math.min(maxSize, newSize))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user