diff --git a/packages/x6/src/graph/mousewheel.ts b/packages/x6/src/graph/mousewheel.ts index 9f3760815ba..ddfe827a512 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,7 @@ export class MouseWheel extends Base { let targetScale = this.graph.transform.clampScale( 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