From b8a3be7a626791234f2ac89f1d13d8f737aa0292 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Mon, 3 Jul 2023 22:26:11 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A7=A6=E6=8E=A7?= =?UTF-8?q?=E6=9D=BF=E7=BC=A9=E6=94=BE=E7=94=BB=E5=B8=83=E6=97=B6=E5=B9=85?= =?UTF-8?q?=E5=BA=A6=E8=BF=87=E5=A4=A7=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/core/view/View.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/simple-mind-map/src/core/view/View.js b/simple-mind-map/src/core/view/View.js index bafe7645..2f89bf66 100644 --- a/simple-mind-map/src/core/view/View.js +++ b/simple-mind-map/src/core/view/View.js @@ -82,12 +82,12 @@ class View { // 鼠标滚轮,向上和向左,都是缩小 case CONSTANTS.DIR.UP: case CONSTANTS.DIR.LEFT: - mousewheelZoomActionReverse ? this.enlarge(cx, cy) : this.narrow(cx, cy) + mousewheelZoomActionReverse ? this.enlarge(cx, cy, isTouchPad) : this.narrow(cx, cy, isTouchPad) break // 鼠标滚轮,向下和向右,都是放大 case CONSTANTS.DIR.DOWN: case CONSTANTS.DIR.RIGHT: - mousewheelZoomActionReverse ? this.narrow(cx, cy) : this.enlarge(cx, cy) + mousewheelZoomActionReverse ? this.narrow(cx, cy, isTouchPad) : this.enlarge(cx, cy, isTouchPad) break } } else {// 鼠标滚轮事件控制画布移动 @@ -199,16 +199,18 @@ class View { } // 缩小 - narrow(cx, cy) { - const scale = Math.max(this.scale - this.mindMap.opt.scaleRatio, 0.1) + narrow(cx, cy, isTouchPad) { + const scaleRatio = this.mindMap.opt.scaleRatio / (isTouchPad ? 5 : 1) + const scale = Math.max(this.scale - scaleRatio, 0.1) this.scaleInCenter(scale, cx, cy) this.transform() this.mindMap.emit('scale', this.scale) } // 放大 - enlarge(cx, cy) { - const scale = this.scale + this.mindMap.opt.scaleRatio + enlarge(cx, cy, isTouchPad) { + const scaleRatio = this.mindMap.opt.scaleRatio / (isTouchPad ? 5 : 1) + const scale = this.scale + scaleRatio this.scaleInCenter(scale, cx, cy) this.transform() this.mindMap.emit('scale', this.scale) From 28a4be06319faca6f8a5dbac555f4a311496f4b4 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Mon, 3 Jul 2023 22:39:47 +0800 Subject: [PATCH 02/14] =?UTF-8?q?Fix:TouchEvent=E6=8F=92=E4=BB=B6=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E6=B4=BE=E5=8F=91click=E4=BA=8B=E4=BB=B6,=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E7=A7=BB=E5=8A=A8=E7=AB=AF=E7=82=B9=E5=87=BB=E8=B6=85?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E4=BC=9A=E6=89=93=E5=BC=80=E4=B8=A4=E4=B8=AA?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/TouchEvent.js | 3 ++- web/public/index.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/simple-mind-map/src/plugins/TouchEvent.js b/simple-mind-map/src/plugins/TouchEvent.js index 1cb7ec70..5afc1f04 100644 --- a/simple-mind-map/src/plugins/TouchEvent.js +++ b/simple-mind-map/src/plugins/TouchEvent.js @@ -86,7 +86,8 @@ class TouchEvent { this.clickNum = 0 this.dispatchMouseEvent('dblclick', ev.target, ev) } else { - this.dispatchMouseEvent('click', ev.target, ev) + // 点击事件应该不用模拟 + // this.dispatchMouseEvent('click', ev.target, ev) } } this.touchesNum = 0 diff --git a/web/public/index.html b/web/public/index.html index 294e768a..a5e6d6ba 100644 --- a/web/public/index.html +++ b/web/public/index.html @@ -5,7 +5,7 @@ - 一个简单的web思维导图实现 + 思绪思维导图