代码调整

This commit is contained in:
dong 2023-01-31 11:10:59 +08:00
parent 6da9d76334
commit 0f83df0dfc

View File

@ -6,6 +6,7 @@ export default {
const dragDom = el; const dragDom = el;
dialogHeaderEl.style.cursor = 'move'; dialogHeaderEl.style.cursor = 'move';
dialogFooterEl.style.cursor = 'move'; dialogFooterEl.style.cursor = 'move';
const vD = 5;
/** 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);*/ /** 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);*/
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null); const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
@ -31,11 +32,11 @@ export default {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
let cY = e.clientY; let cY = e.clientY;
if (cY < oY) { if (cY < oY + vD) {
cY = oY; cY = oY + vD;
} }
if (cY > document.body.clientHeight - bY) { if (cY > document.body.clientHeight - bY - vD) {
cY = document.body.clientHeight - bY; cY = document.body.clientHeight - bY - vD;
} }
/** 通过事件委托,计算移动的距离*/ /** 通过事件委托,计算移动的距离*/
const t = cY - disY; const t = cY - disY;
@ -74,11 +75,11 @@ export default {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
let cY = e.clientY; let cY = e.clientY;
if (cY < bY) { if (cY < bY + vD) {
cY = bY; cY = bY + vD;
} }
if (cY > document.body.clientHeight - oY) { if (cY > document.body.clientHeight - oY - vD) {
cY = document.body.clientHeight - oY; cY = document.body.clientHeight - oY - vD;
} }
/** 通过事件委托,计算移动的距离*/ /** 通过事件委托,计算移动的距离*/
const t = cY - disY; const t = cY - disY;