Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): 节点内置 resize 能力,并支持初始化时 properties 中传入 width、height 等尺寸信息定义节点形状大小 #1647

Merged
merged 10 commits into from
Jun 24, 2024

Conversation

boyongjiong
Copy link
Collaborator

节点 resize 功能

  • 增加 allowResize 开关,用于控制图形节点是否可以调整大小
  • 增加 ResizeControl 和 ResizeControlGroup 定义,并在 BaseNodeModel 中增加 getResizeStyle、getResizeOutline 等方法
  • 通过 normalizePolygon 方法解决通过 points 定义多边形时,节点偏移的问题,并实现 points 根据 width/height 重新计算节点坐标

按照项目命名规范,重命名文件

  • DefaultAnimation.ts -> defaultAnimation.ts、DefaultTheme.ts -> defaultTheme.ts、DnD.ts -> dnd.ts、history/History.ts -> history/index.ts
  • 移除 defaultAnimation.ts 和 defaultTheme.ts 文件,项目中未使用

解决 docs 启动时「The same observable object cannot appear twice in the same tree」错误

  • 节点定义写法有问题,observer 属性赋值给另一个 observer 属性,导致触发上面错误
  • history 增加代码,避免用户写类似代码是出现问题
  • 更新包版本号,准备发 beta 版本
  • DEFAULT_GRID_SIZE 将默认的 gridSize 值提成常量值,放在 constant 中,方便修改

 - 新增 Control 组件,用于控制节点放大缩小,并在 BaseNodeModel 中增加 resize 方法
 - 更新 GitHub Actions 任务名
 - 重命名 allowRotation -> allowRotate;后续增加 allowResize 选项,保持命名一致性
 - add ResizeControl and ResizeControlGroup into project, and use them in NodeView
 - add defaultTheme and other options, such as allowResize (default to be false)
 - add allowResize options
 - test resize function in BaseNodeModel and Control
 - DefaultAnimation.ts -> defaultAnimation.ts
 - DefatultTheme.ts -> defaultTheme.ts
 - history/History.ts -> history/index.ts
 - 并更新项目中各个文件的引用地址
 - 移除目前系统中无用的 defaultTheme 和 defaultAnimation 文件
 - 通过 points 置原点并基于设定的 width 和 height 缩放的方法,解决多边形形状与边框定位异常的问题
 - Control.tsx 中 new StepDrag 参数中 step 传入 graphModel.gridSize,保证调整时拖拽以 gridSize 为步长移动
… in the same tree」错误

 - 节点定义写法有问题,observer 属性赋值给另一个 observer 属性,导致触发上面错误
 - 更新包版本
 - DEFAULT_GRID_SIZE 将默认的 gridSize 值提成常量值,放在 constant 中,方便修改
 - history 功能需要测试一下 cloneDeep(model) 的部分
@boyongjiong boyongjiong requested a review from ChangeSuger June 24, 2024 11:16
@boyongjiong boyongjiong merged commit 4262b93 into next Jun 24, 2024
1 check passed
@boyongjiong boyongjiong deleted the feature/built-in-resize branch June 24, 2024 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants