diff --git a/simple-mind-map/src/constants/defaultOptions.js b/simple-mind-map/src/constants/defaultOptions.js index ff057c76..e1d40911 100644 --- a/simple-mind-map/src/constants/defaultOptions.js +++ b/simple-mind-map/src/constants/defaultOptions.js @@ -149,5 +149,7 @@ export const defaultOpt = { } */ // 如果你的处理逻辑存在异步逻辑,也可以返回一个promise - customHandleClipboardText: null + customHandleClipboardText: null, + // 禁止鼠标滚轮缩放,你仍旧可以使用api进行缩放 + disableMouseWheelZoom: false } diff --git a/simple-mind-map/src/core/view/View.js b/simple-mind-map/src/core/view/View.js index 0f16e52c..4d500844 100644 --- a/simple-mind-map/src/core/view/View.js +++ b/simple-mind-map/src/core/view/View.js @@ -65,7 +65,8 @@ class View { mousewheelAction, mouseScaleCenterUseMousePosition, mousewheelMoveStep, - mousewheelZoomActionReverse + mousewheelZoomActionReverse, + disableMouseWheelZoom } = this.mindMap.opt // 是否自定义鼠标滚轮事件 if ( @@ -76,6 +77,7 @@ class View { } // 鼠标滚轮事件控制缩放 if (mousewheelAction === CONSTANTS.MOUSE_WHEEL_ACTION.ZOOM) { + if (disableMouseWheelZoom) return let cx = mouseScaleCenterUseMousePosition ? e.clientX : undefined let cy = mouseScaleCenterUseMousePosition ? e.clientY : undefined switch (dir) {