From f20de8a89eaa7da02c50dfdb1e1a37db3ffc8a64 Mon Sep 17 00:00:00 2001 From: ch1ny <1056317718@qq.com> Date: Sun, 7 Jul 2024 19:12:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E6=B5=AE=E7=82=B9=E6=95=B0=E7=B2=BE?= =?UTF-8?q?=E5=BA=A6=E4=B8=A2=E5=A4=B1=E5=AF=BC=E8=87=B4=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E5=8D=A1=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/x6/src/graph/mousewheel.ts | 14 ++++++++------ pnpm-lock.yaml | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/x6/src/graph/mousewheel.ts b/packages/x6/src/graph/mousewheel.ts index 9f3760815ba..408adcc774c 100644 --- a/packages/x6/src/graph/mousewheel.ts +++ b/packages/x6/src/graph/mousewheel.ts @@ -81,9 +81,9 @@ export class MouseWheel extends Base { // webkit and to avoid rounding errors for zoom steps this.cumulatedFactor = Math.round(this.currentScale * factor * 20) / 20 / this.currentScale - if (this.cumulatedFactor === 1) { - this.cumulatedFactor = 1.05 - } + } + if (this.cumulatedFactor <= 1) { + this.cumulatedFactor = 1.05 } } else { // zoomout @@ -98,9 +98,9 @@ export class MouseWheel extends Base { Math.round(this.currentScale * (1 / factor) * 20) / 20 / this.currentScale - if (this.cumulatedFactor === 1) { - this.cumulatedFactor = 0.95 - } + } + if (this.cumulatedFactor >= 1) { + this.cumulatedFactor = 0.95 } } @@ -114,6 +114,8 @@ export class MouseWheel extends Base { let targetScale = this.graph.transform.clampScale( currentScale * this.cumulatedFactor, ) + // console.log(targetScale, currentScale, this.cumulatedFactor) + const minScale = this.widgetOptions.minScale || Number.MIN_SAFE_INTEGER const maxScale = this.widgetOptions.maxScale || Number.MAX_SAFE_INTEGER targetScale = NumberExt.clamp(targetScale, minScale, maxScale) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7d490311a42..4a38bc3c5f1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -597,7 +597,7 @@ importers: version: 1.0.0-rc.1(vue@3.2.47) vue-demi: specifier: latest - version: 0.14.6(@vue/composition-api@1.0.0-rc.1)(vue@3.2.47) + version: 0.14.8(@vue/composition-api@1.0.0-rc.1)(vue@3.2.47) devDependencies: '@antv/x6': specifier: ^2.x @@ -46436,10 +46436,10 @@ packages: engines: { node: '>=0.10.0' } dev: false - /vue-demi@0.14.6(@vue/composition-api@1.0.0-rc.1)(vue@3.2.47): + /vue-demi@0.14.8(@vue/composition-api@1.0.0-rc.1)(vue@3.2.47): resolution: { - integrity: sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==, + integrity: sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==, } engines: { node: '>=12' } hasBin: true From 5d118d69e38d3b9b47d86c9f9cc04a624313a324 Mon Sep 17 00:00:00 2001 From: ch1ny <1056317718@qq.com> Date: Sun, 7 Jul 2024 19:20:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/x6/src/graph/mousewheel.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/x6/src/graph/mousewheel.ts b/packages/x6/src/graph/mousewheel.ts index 408adcc774c..ddfe827a512 100644 --- a/packages/x6/src/graph/mousewheel.ts +++ b/packages/x6/src/graph/mousewheel.ts @@ -114,7 +114,6 @@ export class MouseWheel extends Base { let targetScale = this.graph.transform.clampScale( currentScale * this.cumulatedFactor, ) - // console.log(targetScale, currentScale, this.cumulatedFactor) const minScale = this.widgetOptions.minScale || Number.MIN_SAFE_INTEGER const maxScale = this.widgetOptions.maxScale || Number.MAX_SAFE_INTEGER