Feat:优化mac触控板双指拖动画布的体验
This commit is contained in:
parent
cc9d3a6707
commit
d2562f35bd
@ -111,24 +111,32 @@ class View {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 2.鼠标滚轮事件控制画布移动
|
// 2.鼠标滚轮事件控制画布移动
|
||||||
const step = isTouchPad ? 10 : mousewheelMoveStep
|
let stepX = 0
|
||||||
|
let stepY = 0
|
||||||
|
if (isTouchPad) {
|
||||||
|
// 如果是触控板,那么直接使用触控板滑动距离
|
||||||
|
stepX = Math.abs(e.wheelDeltaX)
|
||||||
|
stepY = Math.abs(e.wheelDeltaY)
|
||||||
|
} else {
|
||||||
|
stepX = stepY = mousewheelMoveStep
|
||||||
|
}
|
||||||
let mx = 0
|
let mx = 0
|
||||||
let my = 0
|
let my = 0
|
||||||
// 上移
|
// 上移
|
||||||
if (dirs.includes(CONSTANTS.DIR.DOWN)) {
|
if (dirs.includes(CONSTANTS.DIR.DOWN)) {
|
||||||
my = -step
|
my = -stepY
|
||||||
}
|
}
|
||||||
// 下移
|
// 下移
|
||||||
if (dirs.includes(CONSTANTS.DIR.UP)) {
|
if (dirs.includes(CONSTANTS.DIR.UP)) {
|
||||||
my = step
|
my = stepY
|
||||||
}
|
}
|
||||||
// 右移
|
// 右移
|
||||||
if (dirs.includes(CONSTANTS.DIR.LEFT)) {
|
if (dirs.includes(CONSTANTS.DIR.LEFT)) {
|
||||||
mx = step
|
mx = stepX
|
||||||
}
|
}
|
||||||
// 左移
|
// 左移
|
||||||
if (dirs.includes(CONSTANTS.DIR.RIGHT)) {
|
if (dirs.includes(CONSTANTS.DIR.RIGHT)) {
|
||||||
mx = -step
|
mx = -stepX
|
||||||
}
|
}
|
||||||
this.translateXY(mx, my)
|
this.translateXY(mx, my)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user