fix[el-drag-dialog]: drag bug when screen size less than dom size #3178

This commit is contained in:
eeezgame 2021-04-10 17:53:25 +08:00
parent 33a93a12b4
commit 120735fb39
1 changed files with 10 additions and 0 deletions

View File

@ -61,6 +61,16 @@ export default {
top = maxDragDomTop top = maxDragDomTop
} }
// 当前元素宽度大于浏览器窗口宽度时,则将其向左偏移左侧可拖拽长度
if (maxDragDomLeft < 0) {
left = -minDragDomLeft
}
// 当前元素高度大于浏览器窗口高度时,则将其向上偏移顶侧可拖拽长度
if (maxDragDomTop < 0) {
top = -minDragDomTop
}
// 移动当前元素 // 移动当前元素
dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;` dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`