From ecdf666ae677eb4182bbc7d6bce47ff56af11768 Mon Sep 17 00:00:00 2001 From: Dymonelewis <120695700@qq.com> Date: Thu, 12 Dec 2024 14:27:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(core):=20=E4=BC=98=E5=8C=96=E6=9B=B4?= =?UTF-8?q?=E6=96=B0gridSize=E7=9A=84=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/LogicFlow.tsx | 6 +----- packages/core/src/model/GraphModel.ts | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/core/src/LogicFlow.tsx b/packages/core/src/LogicFlow.tsx index 6336a7c14..d37e5213b 100644 --- a/packages/core/src/LogicFlow.tsx +++ b/packages/core/src/LogicFlow.tsx @@ -900,12 +900,8 @@ export class LogicFlow { const { grid: { size = 1 }, editConfigModel: { snapGrid }, - gridSize, } = this.graphModel - // 开启网格对齐且当前画布网格尺寸与网格对齐尺寸不一致时,或者关闭网格对齐且当前画布网格尺寸不为1时,更新画布网格尺寸 - if ((snapGrid && gridSize !== size) || (!snapGrid && gridSize !== 1)) { - this.graphModel.updateGridSize(snapGrid ? size : 1) - } + this.graphModel.updateGridSize(snapGrid ? size : 1) } } diff --git a/packages/core/src/model/GraphModel.ts b/packages/core/src/model/GraphModel.ts index 03feffe26..d16f8cb81 100644 --- a/packages/core/src/model/GraphModel.ts +++ b/packages/core/src/model/GraphModel.ts @@ -162,6 +162,7 @@ export class GraphModel { this.background = background if (typeof grid === 'object' && options.snapGrid) { // 开启网格对齐时才根据网格尺寸设置步长 + // TODO:需要让用户设置成 0 吗?后面可以讨论一下 this.gridSize = grid.size || 1 // 默认 gridSize 设置为 1 } this.theme = setupTheme(options.style)