Fix:修复鼠标或触控板水平滚动时画布移动方向相反的问题
This commit is contained in:
parent
4a2816fc75
commit
63b04e5acc
@ -56,7 +56,7 @@ class View {
|
|||||||
})
|
})
|
||||||
// 放大缩小视图
|
// 放大缩小视图
|
||||||
this.mindMap.event.on('mousewheel', (e, dir, event, isTouchPad) => {
|
this.mindMap.event.on('mousewheel', (e, dir, event, isTouchPad) => {
|
||||||
let {
|
const {
|
||||||
customHandleMousewheel,
|
customHandleMousewheel,
|
||||||
mousewheelAction,
|
mousewheelAction,
|
||||||
mouseScaleCenterUseMousePosition,
|
mouseScaleCenterUseMousePosition,
|
||||||
@ -78,8 +78,8 @@ class View {
|
|||||||
e.clientX,
|
e.clientX,
|
||||||
e.clientY
|
e.clientY
|
||||||
)
|
)
|
||||||
let cx = mouseScaleCenterUseMousePosition ? clientX : undefined
|
const cx = mouseScaleCenterUseMousePosition ? clientX : undefined
|
||||||
let cy = mouseScaleCenterUseMousePosition ? clientY : undefined
|
const cy = mouseScaleCenterUseMousePosition ? clientY : undefined
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
// 鼠标滚轮,向上和向左,都是缩小
|
// 鼠标滚轮,向上和向左,都是缩小
|
||||||
case CONSTANTS.DIR.UP:
|
case CONSTANTS.DIR.UP:
|
||||||
@ -113,11 +113,11 @@ class View {
|
|||||||
break
|
break
|
||||||
// 右移
|
// 右移
|
||||||
case CONSTANTS.DIR.LEFT:
|
case CONSTANTS.DIR.LEFT:
|
||||||
this.translateX(-step)
|
this.translateX(step)
|
||||||
break
|
break
|
||||||
// 左移
|
// 左移
|
||||||
case CONSTANTS.DIR.RIGHT:
|
case CONSTANTS.DIR.RIGHT:
|
||||||
this.translateX(step)
|
this.translateX(-step)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,8 +261,7 @@ class View {
|
|||||||
let drawWidth = rect.width / origTransform.scaleX
|
let drawWidth = rect.width / origTransform.scaleX
|
||||||
let drawHeight = rect.height / origTransform.scaleY
|
let drawHeight = rect.height / origTransform.scaleY
|
||||||
let drawRatio = drawWidth / drawHeight
|
let drawRatio = drawWidth / drawHeight
|
||||||
let { width: elWidth, height: elHeight } =
|
let { width: elWidth, height: elHeight } = this.mindMap.elRect
|
||||||
this.mindMap.elRect
|
|
||||||
elWidth = elWidth - fitPadding * 2
|
elWidth = elWidth - fitPadding * 2
|
||||||
elHeight = elHeight - fitPadding * 2
|
elHeight = elHeight - fitPadding * 2
|
||||||
let elRatio = elWidth / elHeight
|
let elRatio = elWidth / elHeight
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user