Merge pull request #6413 from dataease/pr@dev-v2@fix_wheelscroll

refactor: 鼠标滚轮放大效果优化
This commit is contained in:
王嘉豪 2023-10-30 11:31:08 +08:00 committed by GitHub
commit fd88f001e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,15 +48,15 @@ const handleMouseWheel = e => {
let areaRight = dvMain.clientWidth + areaLeftWidth let areaRight = dvMain.clientWidth + areaLeftWidth
if (areaLeftWidth < e.clientX && e.clientX < areaRight) { if (areaLeftWidth < e.clientX && e.clientX < areaRight) {
const delta = e.wheelDelta ? e.wheelDelta : -e.detail const delta = e.wheelDelta ? e.wheelDelta : -e.detail
if (lastWheelNum === 240 && delta === 240) { if ((lastWheelNum === 240 && delta === 240) || delta > 240) {
// //
scaleIncrease(3) scaleIncrease(3)
} else if (lastWheelNum === -240 && delta === -240) { } else if ((lastWheelNum === -240 && delta === -240) || delta < -240) {
// //
scaleDecrease(3) scaleDecrease(3)
} }
if (delta === 240 || delta === -240) { if (delta >= 240 || delta <= -240) {
e.stopPropagation() e.stopPropagation()
e.preventDefault() e.preventDefault()
} }