Skip to content

Commit

Permalink
fix(core): 优化更新gridSize的相关逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
DymoneLewis committed Dec 12, 2024
1 parent dd001c7 commit ecdf666
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions packages/core/src/LogicFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/model/GraphModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ecdf666

Please sign in to comment.