From 966decb6853bcc255e5e13b1eac12c5c97ceba38 Mon Sep 17 00:00:00 2001 From: shidongli Date: Mon, 22 Jul 2024 14:57:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=9D=E6=9C=AF=E9=A2=84=E8=A7=88=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/Scriptpreview/index.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/views/system/Scriptpreview/index.vue b/src/views/system/Scriptpreview/index.vue index a18171f..41158f0 100644 --- a/src/views/system/Scriptpreview/index.vue +++ b/src/views/system/Scriptpreview/index.vue @@ -417,6 +417,17 @@ export default { const toolbar = new G6Editor.Toolbar({ container: "toolbar" }); + const container = document.getElementById('page'); + // 为 graph 容器添加鼠标滚轮事件监听 + container.addEventListener('mousewheel', (e) => { + e.preventDefault(); + const ratio = 1.1; // 设置放大缩小的比例 + const oldScale = this.editor.getCurrentPage().getZoom(); // 获取当前的缩放比例 + // console.log(oldScale, 'oldScale') + const newScale = e.wheelDelta > 0 ? oldScale * ratio : oldScale / ratio; // 根据滚轮方向计算新的缩放比例 + // console.log(newScale, 'oldScale') + this.editor.getCurrentPage().zoom(newScale); // 执行缩放操作 + }) // 属性栏 // const detailpannel = new G6Editor.Detailpannel({ // container: "detailpannel"