Feat:新增禁止鼠标滚轮缩放的配置

This commit is contained in:
wanglin2 2023-08-18 10:16:19 +08:00
parent df1aed7e04
commit 12265be7d4
2 changed files with 6 additions and 2 deletions

View File

@ -149,5 +149,7 @@ export const defaultOpt = {
} }
*/ */
// 如果你的处理逻辑存在异步逻辑也可以返回一个promise // 如果你的处理逻辑存在异步逻辑也可以返回一个promise
customHandleClipboardText: null customHandleClipboardText: null,
// 禁止鼠标滚轮缩放你仍旧可以使用api进行缩放
disableMouseWheelZoom: false
} }

View File

@ -65,7 +65,8 @@ class View {
mousewheelAction, mousewheelAction,
mouseScaleCenterUseMousePosition, mouseScaleCenterUseMousePosition,
mousewheelMoveStep, mousewheelMoveStep,
mousewheelZoomActionReverse mousewheelZoomActionReverse,
disableMouseWheelZoom
} = this.mindMap.opt } = this.mindMap.opt
// 是否自定义鼠标滚轮事件 // 是否自定义鼠标滚轮事件
if ( if (
@ -76,6 +77,7 @@ class View {
} }
// 鼠标滚轮事件控制缩放 // 鼠标滚轮事件控制缩放
if (mousewheelAction === CONSTANTS.MOUSE_WHEEL_ACTION.ZOOM) { if (mousewheelAction === CONSTANTS.MOUSE_WHEEL_ACTION.ZOOM) {
if (disableMouseWheelZoom) return
let cx = mouseScaleCenterUseMousePosition ? e.clientX : undefined let cx = mouseScaleCenterUseMousePosition ? e.clientX : undefined
let cy = mouseScaleCenterUseMousePosition ? e.clientY : undefined let cy = mouseScaleCenterUseMousePosition ? e.clientY : undefined
switch (dir) { switch (dir) {