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

fix(draw-canvas): support label placement and offset #1465

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

weareoutman
Copy link
Member

@weareoutman weareoutman commented Jan 6, 2025

依赖检查

组件之间的依赖声明,是微服务组件架构下的重要信息,请确保其正确性。

请勾选以下两组选项其中之一:

  • 本次 MR 没有使用上游组件(例如框架、后台组件等)的较新版本提供的特性。

或者:

  • 本次 MR 使用了上游组件(例如框架、后台组件等)的较新版本提供的特性。
  • 在对应的文件中更新了该上游组件的依赖版本(或确认了当前声明的依赖版本已包含本次 MR 使用的新特性)。

提交信息检查

Git 提交信息将决定包的版本发布及自动生成的 CHANGELOG,请检查工作内容与提交信息是否相符,并在以下每组选项中都依次确认。

破坏性变更是针对于下游使用者而言,可以通过本次改动对下游使用者的影响来识别变更类型:

  • 下游使用者不做任何改动,仍可以正常工作时,那么它属于普通变更。
  • 反之,下游使用者不做改动就无法正常工作时,那么它属于破坏性变更。

例如,构件修改了一个属性名,小产品 Storyboard 中需要使用新属性名才能工作,那么它就是破坏性变更。
又例如,构件还没有任何下游使用者,那么它的任何变更都是普通变更。

破坏性变更:

  • ⚠️ 本次 MR 包含破坏性变更的提交,请继续确认以下所有选项:
  • 没有更好的兼容方案,必须做破坏性变更。
  • 使用了 feat 作为提交类型。
  • 标注了 BREAKING CHANGE: 你的变更说明
  • 同时更新了本仓库中所有下游使用者的调用。
  • 同时更新了本仓库中所有下游使用者对该子包的依赖为即将发布的 major 版本。
  • 同时为其它仓库的 Migrating 做好了准备,例如文档或批量改动的方法。
  • 手动验证过破坏性变更在 Migrate 后可以正常工作。
  • 破坏性变更所在的提交没有意外携带其它子包的改动。

新特性:

  • 本次 MR 包含新特性的提交,且该提交不带有破坏性变更,并使用了 feat 作为提交类型。
  • 给新特性添加了单元测试。
  • 手动验证过新特性可以正常工作。

问题修复:

  • 本次 MR 包含问题修复的提交,且该提交不带有新特性或破坏性变更,并使用了 fix 作为提交类型。
  • 给问题修复添加了单元测试。
  • 手动验证过问题修复得到解决。

杂项工作:

即所有对下游使用者无任何影响、且没有必要显示在 CHANGELOG 中的改动,例如修改注释、测试用例、开发文档等:

  • 本次 MR 包含杂项工作的提交,且该提交不带有问题修复、新特性或破坏性变更,并使用了 chore, docs, test 等作为提交类型。

Summary by CodeRabbit

  • 新功能

    • 增强了绘图画布中边缘的标签放置和样式控制
    • 支持在边缘上动态设置标签位置和偏移量
  • 改进

    • 优化了标签定位逻辑,提供更精确的标签放置方式
    • 新增标签偏移和方向控制选项
  • 测试

    • 为标签遮罩和偏移计算函数添加了全面的测试用例

这些更改提升了图表绘制组件的灵活性和精确性,使用户能够更细致地控制边缘标签的外观和位置。

Copy link

coderabbitai bot commented Jan 6, 2025

总览

这些更改主要涉及图表绘制画布中边缘和标签的位置和渲染逻辑的增强。通过引入新的接口、类型和处理函数,系统现在支持更灵活的边缘标签放置,包括开始、结束和中心位置,并允许通过偏移量精确控制标签的位置。

变更

文件路径 变更摘要
bricks/diagram/docs/eo-draw-canvas.md 更新 YAML 配置,为边缘添加 placementview 属性,增强边缘标签的放置和样式控制
bricks/diagram/src/diagram/interfaces.ts LineLabelConfTextOptions 接口中添加可选的 offset 属性
bricks/diagram/src/draw-canvas/EdgeComponent.tsx 修改标签位置逻辑,引入 PositionAndAngle 类型和更精确的标签放置计算
bricks/diagram/src/draw-canvas/LineLabelComponent.tsx 更新组件接口和渲染逻辑,支持新的位置和偏移属性
bricks/diagram/src/draw-canvas/interfaces.ts 添加 PositionAndAngle 类型定义
bricks/diagram/src/draw-canvas/processors/getLabelMaskAndOffset.spec.ts getLabelMaskAndOffset 函数添加全面的单元测试
bricks/diagram/src/draw-canvas/processors/getLabelMaskAndOffset.ts 新增函数,用于计算标签遮罩和偏移量

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

bricks/diagram/src/draw-canvas/EdgeComponent.tsx:68

  • Ensure that the new behavior for calculating the path point based on the placement and offset is covered by tests.
const updateLabelPosition = useCallback(() => {
Copy link

codecov bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.47%. Comparing base (d722d20) to head (35b684e).
Report is 3 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1465      +/-   ##
==========================================
+ Coverage   85.45%   85.47%   +0.02%     
==========================================
  Files         525      526       +1     
  Lines       15677    15702      +25     
  Branches     2352     2354       +2     
==========================================
+ Hits        13396    13421      +25     
  Misses       1829     1829              
  Partials      452      452              
Files with missing lines Coverage Δ
bricks/diagram/src/draw-canvas/EdgeComponent.tsx 100.00% <100.00%> (ø)
...cks/diagram/src/draw-canvas/LineLabelComponent.tsx 100.00% <100.00%> (ø)
...rc/draw-canvas/processors/getLabelMaskAndOffset.ts 100.00% <100.00%> (ø)

Copy link

github-actions bot commented Jan 6, 2025

@github-actions github-actions bot temporarily deployed to pull request January 6, 2025 02:00 Inactive
@weareoutman weareoutman force-pushed the steve/line-points-snap branch from 123992b to f22b2e5 Compare January 6, 2025 02:00
@weareoutman weareoutman requested a review from panzekun January 6, 2025 02:00
Copy link

github-actions bot commented Jan 6, 2025

📐🤏 Size check result (d722d20...447ffbf):

See full diff

Load all bricks together

Name Prev Now Diff
All bricks 4,530.34 KB 4,530.84 KB 🔼 +0.5 KB

Critical changes: None.

See full changes
Name Prev Now Diff
<core> 310.81 KB 310.93 KB 🔼 +0.12 KB
<react> 53.61 KB 53.61 KB 🟰
advanced 518.16 KB 518.16 KB 🟰
ai 288.07 KB 288.05 KB
api-market 10.61 KB 10.61 KB 🟰
basic 183.63 KB 183.63 KB 🟰
containers 96.6 KB 96.6 KB 🟰
data-view 640 KB 640 KB 🟰
diagram 176.37 KB 176.69 KB 🔼 +0.32 KB
form 329.87 KB 329.87 KB 🟰
form-platform 12.92 KB 12.92 KB 🟰
icons 15.25 KB 15.25 KB 🟰
illustrations 17.55 KB 17.55 KB 🟰
inject 56.49 KB 56.49 KB 🟰
markdown 248.68 KB 248.71 KB
mini-chart 10.68 KB 10.68 KB 🟰
nav 120.86 KB 120.86 KB 🟰
presentational 134.88 KB 134.88 KB 🟰
recent-history 32.71 KB 32.71 KB 🟰
shoelace 325.88 KB 325.88 KB 🟰
visual-builder 418.64 KB 418.66 KB
vs 838.89 KB 839.04 KB 🔼 +0.15 KB

Load bricks by each package

Critical changes: None.

See full changes
Name Prev Now Diff
advanced 751.63 KB 751.59 KB
ai 501.69 KB 501.7 KB
api-market 208.31 KB 208.31 KB 🟰
basic 339.76 KB 339.76 KB 🟰
containers 235.58 KB 235.58 KB 🟰
data-view 736.61 KB 736.67 KB
diagram 247.38 KB 247.74 KB 🔼 +0.36 KB
form 501.03 KB 501.03 KB 🟰
form-platform 178.19 KB 178.19 KB 🟰
icons 72.95 KB 72.95 KB 🟰
illustrations 91.84 KB 91.83 KB
inject 56.49 KB 56.49 KB 🟰
markdown 338.17 KB 338.17 KB 🟰
mini-chart 76.36 KB 76.36 KB 🟰
nav 397.62 KB 397.62 KB 🟰
presentational 346.98 KB 346.98 KB 🟰
recent-history 170.24 KB 170.24 KB 🟰
shoelace 325.88 KB 325.88 KB 🟰
visual-builder 1,511.99 KB 1,512 KB
vs 1,015.13 KB 1,015.15 KB
widget-editors 0 KB 0 KB 🟰

Load by each brick

Critical changes: None.

See full changes
Name Prev Now Diff
advanced.capture-snapshot 52.73 KB 52.73 KB 🟰
advanced.general-cascader 217.07 KB 217.07 KB 🟰
advanced.general-table 332.25 KB 332.25 KB 🟰
advanced.pdf-viewer 199.51 KB 199.51 KB 🟰
ai.chat-agent 68.12 KB 68.12 KB 🟰
ai.chat-view 496.92 KB 496.89 KB
api-market.apis-directory-tree 208.31 KB 208.31 KB 🟰
basic.active-element-blur 9.07 KB 9.07 KB 🟰
basic.change-language 9.06 KB 9.06 KB 🟰
basic.copy-to-clipboard 9.22 KB 9.22 KB 🟰
basic.dropdown-button 155.34 KB 155.34 KB 🟰
basic.general-button 129.02 KB 129.02 KB 🟰
basic.general-image 89.16 KB 89.16 KB 🟰
basic.general-link 123.7 KB 123.7 KB 🟰
basic.general-menu 69.35 KB 69.35 KB 🟰
basic.general-menu-item 84.03 KB 84.03 KB 🟰
basic.general-popover 103.2 KB 103.2 KB 🟰
basic.general-tag 86.1 KB 86.1 KB 🟰
basic.general-tag-list 90.48 KB 90.48 KB 🟰
basic.general-text 162.39 KB 162.39 KB 🟰
basic.get-language 9.05 KB 9.05 KB 🟰
basic.home-redirect 14.56 KB 14.56 KB 🟰
basic.http-proxy-request 9.13 KB 9.13 KB 🟰
basic.http-request 9.05 KB 9.05 KB 🟰
basic.lock-body-scroll 10.8 KB 10.8 KB 🟰
basic.set-theme-by-apps 9.07 KB 9.07 KB 🟰
basic.set-timeout 9.06 KB 9.06 KB 🟰
basic.show-dialog 181.71 KB 181.71 KB 🟰
basic.show-notification 149.65 KB 149.65 KB 🟰
basic.show-watermark 10.81 KB 10.81 KB 🟰
basic.v3-widget-mate 9.04 KB 9.04 KB 🟰
containers.easy-view 67.4 KB 67.4 KB 🟰
containers.flex-layout 67.13 KB 67.13 KB 🟰
containers.general-card 140.93 KB 140.93 KB 🟰
containers.general-category 67.76 KB 67.76 KB 🟰
containers.general-drawer 94.17 KB 94.17 KB 🟰
containers.general-modal 142.94 KB 142.94 KB 🟰
containers.grid-layout 68.22 KB 68.22 KB 🟰
containers.micro-view 79.15 KB 79.15 KB 🟰
containers.search-bar 67.25 KB 67.25 KB 🟰
containers.tab-group 72.28 KB 72.28 KB 🟰
containers.tab-item 99.22 KB 99.22 KB 🟰
containers.tab-list 99.22 KB 99.22 KB 🟰
data-view.app-wall-card-item 70.37 KB 70.37 KB 🟰
data-view.app-wall-relation-line 70.06 KB 70.06 KB 🟰
data-view.app-wall-system-card 84.57 KB 84.57 KB 🟰
data-view.basic-index-group 69.65 KB 69.65 KB 🟰
data-view.battery-chart 70.38 KB 70.38 KB 🟰
data-view.brick-notification 83.79 KB 83.79 KB 🟰
data-view.bubbles-indicator 108.89 KB 108.89 KB 🟰
data-view.cabinet-app-layer 70.05 KB 70.05 KB 🟰
data-view.cabinet-button 69.66 KB 69.66 KB 🟰
data-view.cabinet-container 79.93 KB 79.93 KB 🟰
data-view.cabinet-graph 94.09 KB 94.09 KB 🟰
data-view.cabinet-node 70.46 KB 70.46 KB 🟰
data-view.cabinet-thumbnail 83.74 KB 83.74 KB 🟰
data-view.china-map 96 KB 96 KB 🟰
data-view.china-map-chart 376.65 KB 376.66 KB
data-view.complex-search 96.32 KB 96.28 KB
data-view.crystal-ball-indicator 103.28 KB 103.28 KB 🟰
data-view.data-display-flipper 69.6 KB 69.6 KB 🟰
data-view.data-display-flipper-fifth 69.47 KB 69.47 KB 🟰
data-view.data-display-flipper-sixth 69.33 KB 69.33 KB 🟰
data-view.dropdown-menu 85.85 KB 85.89 KB
data-view.gauge-chart 70.52 KB 70.52 KB 🟰
data-view.gear-background 115.63 KB 115.63 KB 🟰
data-view.globe-with-gear-indicator 154.14 KB 154.14 KB 🟰
data-view.globe-with-halo-indicator 104.27 KB 104.27 KB 🟰
data-view.globe-with-orbit-indicator 104.1 KB 104.1 KB 🟰
data-view.graph-layout-grid 86.83 KB 86.83 KB 🟰
data-view.graph-node 69.52 KB 69.52 KB 🟰
data-view.graph-text 77.98 KB 77.98 KB 🟰
data-view.grid-background 104.86 KB 104.86 KB 🟰
data-view.hi-tech-button 70.29 KB 70.29 KB 🟰
data-view.indicator-card 69.76 KB 69.76 KB 🟰
data-view.lights-component-title 69.19 KB 69.19 KB 🟰
data-view.loading-panel 73.57 KB 73.57 KB 🟰
data-view.modern-style-component-title 70.26 KB 70.26 KB 🟰
data-view.modern-style-page-title 70.3 KB 70.3 KB 🟰
data-view.modern-style-treemap 80.85 KB 80.85 KB 🟰
data-view.particle-animation 70.19 KB 70.19 KB 🟰
data-view.progress-bar-list 72.36 KB 72.36 KB 🟰
data-view.radar-chart 71.23 KB 71.23 KB 🟰
data-view.simple-card-item 69.87 KB 69.87 KB 🟰
data-view.tabs-drawer 85.75 KB 85.71 KB
data-view.tabs-page-title 72.42 KB 72.42 KB 🟰
data-view.tech-mesh-base-view 68.77 KB 68.77 KB 🟰
data-view.title-text 69.95 KB 69.95 KB 🟰
data-view.top-title-bar 81.13 KB 81.13 KB 🟰
diagram.editable-label 67.99 KB 67.99 KB 🟰
diagram.experimental-node 67.45 KB 67.45 KB 🟰
eo-actions 142.64 KB 142.64 KB 🟰
eo-alert 88.15 KB 88.15 KB 🟰
eo-antd-icon 71.78 KB 71.78 KB 🟰
eo-app-bar-wrapper 68.6 KB 68.6 KB 🟰
eo-auto-complete 102.62 KB 102.62 KB 🟰
eo-avatar 106.68 KB 106.68 KB 🟰
eo-avatar-group 105.25 KB 105.25 KB 🟰
eo-banner 87.22 KB 87.22 KB 🟰
eo-breadcrumb 127.96 KB 127.96 KB 🟰
eo-breadcrumb-item 127.52 KB 127.52 KB 🟰
eo-broadcast-channel 69.75 KB 69.75 KB 🟰
eo-button 129.02 KB 129.02 KB 🟰
eo-card 140.93 KB 140.93 KB 🟰
eo-card-item 168.38 KB 168.38 KB 🟰
eo-carousel-text 75.83 KB 75.83 KB 🟰
eo-cascader 217.07 KB 217.11 KB
eo-category 67.76 KB 67.76 KB 🟰
eo-checkbox 106.87 KB 106.87 KB 🟰
eo-code-display 233.8 KB 233.8 KB 🟰
eo-color-picker 241.26 KB 241.25 KB
eo-content-layout 66.7 KB 66.7 KB 🟰
eo-context-menu 149.16 KB 149.16 KB 🟰
eo-counter-badge 84.65 KB 84.65 KB 🟰
eo-current-time 86.83 KB 86.83 KB 🟰
eo-date-picker 234.55 KB 234.54 KB
eo-descriptions 165.05 KB 165.05 KB 🟰
eo-diagram 121.68 KB 121.68 KB 🟰
eo-directory 133.01 KB 133.01 KB 🟰
eo-directory-tree 122.06 KB 122.06 KB 🟰
eo-directory-tree-internal-node 83.46 KB 83.46 KB 🟰
eo-directory-tree-leaf 82.77 KB 82.76 KB
eo-display-canvas 214.91 KB 215.22 KB 🔼 +0.31 KB
eo-divider 73.63 KB 73.63 KB 🟰
eo-draw-canvas 222.6 KB 222.88 KB 🔼 +0.28 KB
eo-drawer 94.17 KB 94.17 KB 🟰
eo-dropdown-actions 146.35 KB 146.35 KB 🟰
eo-dropdown-button 155.34 KB 155.34 KB 🟰
eo-dropdown-select 140.49 KB 140.49 KB 🟰
eo-dynamic-form-item 166.61 KB 166.61 KB 🟰
eo-easy-view 67.4 KB 67.4 KB 🟰
eo-easyops-avatar 110.8 KB 110.8 KB 🟰
eo-easyops-icon 71.78 KB 71.78 KB 🟰
eo-event-agent 14.1 KB 14.1 KB 🟰
eo-fa-icon 71.78 KB 71.78 KB 🟰
eo-flex-layout 67.13 KB 67.13 KB 🟰
eo-form 69.62 KB 69.62 KB 🟰
eo-form-item 75.39 KB 75.39 KB 🟰
eo-formatter-number 69.8 KB 69.8 KB 🟰
eo-frame-breadcrumb 144.92 KB 144.92 KB 🟰
eo-grid-layout 68.22 KB 68.22 KB 🟰
eo-humanize-time 140.38 KB 140.38 KB 🟰
eo-icon 71.78 KB 71.78 KB 🟰
eo-icon-select 197.11 KB 197.11 KB 🟰
eo-iframe 69.79 KB 69.79 KB 🟰
eo-illustration-message 87.64 KB 87.64 KB 🟰
eo-image 89.16 KB 89.16 KB 🟰
eo-img-icon 71.78 KB 71.78 KB 🟰
eo-info-card-item 138.1 KB 138.1 KB 🟰
eo-input 96.61 KB 96.62 KB
eo-launchpad-button 162.24 KB 162.24 KB 🟰
eo-launchpad-button-v2 217.12 KB 217.12 KB 🟰
eo-launchpad-quick-access 203.73 KB 203.73 KB 🟰
eo-launchpad-recent-visits 202.55 KB 202.55 KB 🟰
eo-link 123.7 KB 123.7 KB 🟰
eo-loading-container 83.86 KB 83.86 KB 🟰
eo-loading-step 101.57 KB 101.57 KB 🟰
eo-main-view 87.22 KB 87.22 KB 🟰
eo-markdown-display 140.78 KB 140.78 KB 🟰
eo-markdown-editor 300.21 KB 300.22 KB
eo-menu 69.35 KB 69.35 KB 🟰
eo-menu-group 69.13 KB 69.13 KB 🟰
eo-menu-item 84.03 KB 84.03 KB 🟰
eo-menu-item-sub-menu 84.49 KB 84.49 KB 🟰
eo-message-listener 69.53 KB 69.53 KB 🟰
eo-micro-view 79.15 KB 79.15 KB 🟰
eo-mini-actions 147.24 KB 147.24 KB 🟰
eo-mini-line-chart 76.36 KB 76.36 KB 🟰
eo-modal 142.94 KB 142.94 KB 🟰
eo-narrow-view 75.45 KB 75.45 KB 🟰
eo-nav-menu 193.82 KB 193.82 KB 🟰
eo-next-table 383.4 KB 383.4 KB 🟰
eo-page-title 69.47 KB 69.47 KB 🟰
eo-page-view 75.45 KB 75.45 KB 🟰
eo-pagination 173.29 KB 173.29 KB 🟰
eo-popover 103.2 KB 103.2 KB 🟰
eo-popup 97.32 KB 97.32 KB 🟰
eo-radio 98.62 KB 98.61 KB
eo-resizable-box 69.12 KB 69.12 KB 🟰
eo-search 100.66 KB 100.65 KB
eo-search-bar 67.25 KB 67.25 KB 🟰
eo-search-launchpad 206.4 KB 206.4 KB 🟰
eo-select 146.63 KB 146.63 KB 🟰
eo-sidebar 168.89 KB 168.89 KB 🟰
eo-sidebar-menu 149.91 KB 149.91 KB 🟰
eo-sidebar-menu-group 149.91 KB 149.91 KB 🟰
eo-sidebar-menu-item 134.76 KB 134.76 KB 🟰
eo-sidebar-menu-submenu 149.91 KB 149.91 KB 🟰
eo-sidebar-sub-menu 149.93 KB 149.93 KB 🟰
eo-spin 67.59 KB 67.59 KB 🟰
eo-statistics-card 88.02 KB 88.02 KB 🟰
eo-submit-buttons 151.12 KB 151.12 KB 🟰
eo-svg-icon 71.78 KB 71.78 KB 🟰
eo-switch 94.82 KB 94.82 KB 🟰
eo-tab-group 72.28 KB 72.28 KB 🟰
eo-tab-item 99.22 KB 99.22 KB 🟰
eo-tab-list 99.22 KB 99.22 KB 🟰
eo-table 332.29 KB 332.25 KB
eo-tag 86.1 KB 86.1 KB 🟰
eo-tag-list 90.48 KB 90.48 KB 🟰
eo-text 162.39 KB 162.39 KB 🟰
eo-text-tooltip 142.01 KB 142.01 KB 🟰
eo-textarea 84.47 KB 84.47 KB 🟰
eo-time-picker 216.66 KB 216.66 KB 🟰
eo-time-range-picker 233.78 KB 233.78 KB 🟰
eo-tooltip 118.71 KB 118.71 KB 🟰
eo-tree 141.54 KB 141.54 KB 🟰
eo-tree-select 229.75 KB 229.79 KB
eo-upload-file 163.13 KB 163.13 KB 🟰
eo-upload-image 171.75 KB 171.75 KB 🟰
eo-user-or-user-group-select 178.19 KB 178.19 KB 🟰
eo-workbench-layout 261.21 KB 261.21 KB 🟰
eo-workbench-layout-v2 262.69 KB 262.69 KB 🟰
form.dynamic-form-item 166.61 KB 166.61 KB 🟰
form.general-checkbox 106.87 KB 106.87 KB 🟰
form.general-form 69.62 KB 69.62 KB 🟰
form.general-form-item 75.39 KB 75.39 KB 🟰
form.general-input 96.61 KB 96.61 KB 🟰
form.general-radio 98.61 KB 98.62 KB
form.general-search 100.66 KB 100.66 KB 🟰
form.general-select 146.63 KB 146.63 KB 🟰
form.general-switch 94.82 KB 94.82 KB 🟰
form.general-textarea 84.47 KB 84.47 KB 🟰
form.icon-select 197.11 KB 197.11 KB 🟰
form.submit-buttons 151.12 KB 151.12 KB 🟰
form.upload-image 171.75 KB 171.75 KB 🟰
icons.antd-icon 71.78 KB 71.78 KB 🟰
icons.easyops-icon 71.78 KB 71.78 KB 🟰
icons.fa-icon 71.78 KB 71.78 KB 🟰
icons.general-icon 71.78 KB 71.78 KB 🟰
icons.get-antd-icons 6.82 KB 6.82 KB 🟰
icons.get-easyops-icons 6.82 KB 6.82 KB 🟰
icons.get-fa-icons 6.82 KB 6.82 KB 🟰
icons.get-libs 6.82 KB 6.82 KB 🟰
icons.search-icons 6.82 KB 6.82 KB 🟰
illustrations.error-message 87.64 KB 87.64 KB 🟰
illustrations.get-illustration 9.35 KB 9.35 KB 🟰
illustrations.get-illustrations-by-category 6.25 KB 6.25 KB 🟰
illustrations.loading-transition 66.87 KB 66.87 KB 🟰
illustrations.translate-illustration-config 9.35 KB 9.35 KB 🟰
inject.visual-builder-preview-agent 56.49 KB 56.49 KB 🟰
markdown.markdown-editor 300.24 KB 300.24 KB 🟰
nav.app-bar-wrapper 68.6 KB 68.6 KB 🟰
nav.easyops-navbar-alerts 137.22 KB 137.22 KB 🟰
nav.get-menu-config-options 8.35 KB 8.35 KB 🟰
nav.get-menu-config-tree 8.86 KB 8.86 KB 🟰
nav.launchpad-config 217.15 KB 217.15 KB 🟰
nav.nav-logo 133.79 KB 133.79 KB 🟰
nav.poll-announce 170.28 KB 170.28 KB 🟰
presentational.code-display 233.8 KB 233.8 KB 🟰
presentational.general-alert 88.15 KB 88.15 KB 🟰
presentational.general-descriptions 165.05 KB 165.05 KB 🟰
presentational.humanize-time 140.38 KB 140.38 KB 🟰
recent-history.clear-history 28.44 KB 28.44 KB 🟰
recent-history.get-all-history 28.44 KB 28.44 KB 🟰
recent-history.push-history 28.44 KB 28.44 KB 🟰
recent-history.recent-visit 169.04 KB 169.04 KB 🟰
sl-alert 31.13 KB 31.13 KB 🟰
sl-animated-image 25.39 KB 25.39 KB 🟰
sl-animation 25.56 KB 25.56 KB 🟰
sl-avatar 25.87 KB 25.87 KB 🟰
sl-badge 22.43 KB 22.43 KB 🟰
sl-breadcrumb 27.92 KB 27.92 KB 🟰
sl-breadcrumb-item 27.92 KB 27.92 KB 🟰
sl-button 33.12 KB 33.12 KB 🟰
sl-button-group 21.68 KB 21.68 KB 🟰
sl-card 22.69 KB 22.69 KB 🟰
sl-carousel 31.94 KB 31.94 KB 🟰
sl-carousel-item 31.94 KB 31.94 KB 🟰
sl-checkbox 30.31 KB 30.31 KB 🟰
sl-color-picker 64.49 KB 64.49 KB 🟰
sl-details 28.11 KB 28.11 KB 🟰
sl-dialog 33.05 KB 33.05 KB 🟰
sl-divider 21.52 KB 21.52 KB 🟰
sl-drawer 34.13 KB 34.13 KB 🟰
sl-dropdown 36.17 KB 36.17 KB 🟰
sl-format-bytes 22.34 KB 22.34 KB 🟰
sl-format-date 22.39 KB 22.39 KB 🟰
sl-format-number 22.4 KB 22.4 KB 🟰
sl-icon 24.52 KB 24.52 KB 🟰
sl-icon-button 27.16 KB 27.16 KB 🟰
sl-image-comparer 27.81 KB 27.81 KB 🟰
sl-input 33.82 KB 33.82 KB 🟰
sl-menu 41.77 KB 41.77 KB 🟰
sl-menu-item 41.77 KB 41.77 KB 🟰
sl-menu-label 21.25 KB 21.25 KB 🟰
sl-mutation-observer 21.74 KB 21.74 KB 🟰
sl-option 27.39 KB 27.39 KB 🟰
sl-popup 31.9 KB 31.9 KB 🟰
sl-progress-bar 24 KB 24 KB 🟰
sl-progress-ring 23.08 KB 23.08 KB 🟰
sl-qr-code 26.99 KB 26.99 KB 🟰
sl-radio 26.28 KB 26.28 KB 🟰
sl-radio-button 26.03 KB 26.03 KB 🟰
sl-radio-group 26.38 KB 26.38 KB 🟰
sl-range 29.1 KB 29.1 KB 🟰
sl-rating 28.45 KB 28.45 KB 🟰
sl-relative-time 22.6 KB 22.6 KB 🟰
sl-resize-observer 21.63 KB 21.63 KB 🟰
sl-select 48.55 KB 48.55 KB 🟰
sl-skeleton 22.23 KB 22.23 KB 🟰
sl-spinner 22.69 KB 22.69 KB 🟰
sl-split-panel 24.33 KB 24.33 KB 🟰
sl-switch 27.21 KB 27.21 KB 🟰
sl-tab 34.2 KB 34.2 KB 🟰
sl-tab-group 34.2 KB 34.2 KB 🟰
sl-tab-panel 34.2 KB 34.2 KB 🟰
sl-tag 29.3 KB 29.3 KB 🟰
sl-textarea 27.9 KB 27.9 KB 🟰
sl-tooltip 34.27 KB 34.27 KB 🟰
sl-tree 37.27 KB 37.27 KB 🟰
sl-tree-item 37.27 KB 37.27 KB 🟰
sl-visually-hidden 21.22 KB 21.22 KB 🟰
visual-builder.batch-update-raw-data-generated-view 7.84 KB 7.84 KB 🟰
visual-builder.chat-conversation 184.82 KB 184.86 KB
visual-builder.chat-preview 69.89 KB 69.89 KB 🟰
visual-builder.check-editor-by-name 7.45 KB 7.45 KB 🟰
visual-builder.contract-select 123.4 KB 123.37 KB
visual-builder.generate-snippets-context-menu 147.45 KB 147.45 KB 🟰
visual-builder.get-data-deps 7.46 KB 7.46 KB 🟰
visual-builder.get-dependency-tree 7.84 KB 7.84 KB 🟰
visual-builder.get-raw-data-system-prompts 11.82 KB 11.82 KB 🟰
visual-builder.inject-chat-preview-agent 8.42 KB 8.42 KB 🟰
visual-builder.page-arch-node 131.8 KB 131.8 KB 🟰
visual-builder.parse-path 9.08 KB 9.08 KB 🟰
visual-builder.pre-generated-container 70.26 KB 70.26 KB 🟰
visual-builder.pre-generated-preview 69.87 KB 69.87 KB 🟰
visual-builder.pre-generated-table-view 67.48 KB 67.48 KB 🟰
visual-builder.property-editor 1,318.88 KB 1,318.87 KB
visual-builder.raw-data-preview 72.79 KB 72.79 KB 🟰
visual-builder.workbench-action 135.56 KB 135.56 KB 🟰
visual-builder.workbench-action-list 140.99 KB 140.99 KB 🟰
visual-builder.workbench-history-action 169.16 KB 169.16 KB 🟰
visual-builder.workbench-pane 83.61 KB 83.59 KB
visual-builder.workbench-sidebar 68.37 KB 68.37 KB 🟰
visual-builder.workbench-tree 141.03 KB 141.03 KB 🟰
vs.code-editor 1,015.12 KB 1,015.14 KB

@github-actions github-actions bot temporarily deployed to pull request January 6, 2025 02:05 Inactive
@weareoutman weareoutman marked this pull request as draft January 6, 2025 02:14
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
bricks/diagram/src/draw-canvas/EdgeComponent.tsx (1)

70-88: 在组件内部根据 placementoffset 动态计算标签位置的思路很直观。
请注意在大路径长度与极端偏移值场景下,点位获取是否正确,以及是否需要额外的边界检查。整体实现满足需求。

bricks/diagram/docs/eo-draw-canvas.md (1)

578-579: 在默认连线配置中将 placementoffset 暴露为可配置项有利于统一管理。
可在后续文档中补充更多关于负值或大值偏移的示例。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d722d20 and f22b2e5.

📒 Files selected for processing (4)
  • bricks/diagram/docs/eo-draw-canvas.md (2 hunks)
  • bricks/diagram/src/diagram/interfaces.ts (1 hunks)
  • bricks/diagram/src/diagram/processors/getRenderedLineLabels.ts (1 hunks)
  • bricks/diagram/src/draw-canvas/EdgeComponent.tsx (1 hunks)
🔇 Additional comments (4)
bricks/diagram/src/diagram/processors/getRenderedLineLabels.ts (1)

49-49: 在偏移量计算中使用 item.offset 的回退值是非常实用的改进。
此更改允许在标签定位时灵活处理偏移量,对于支持自定义效果非常有帮助。

bricks/diagram/src/diagram/interfaces.ts (2)

165-169: 文档注释对 offset 的作用做了详细说明,便于后续维护。
在 start 或 end 的情况下,使用此偏移量可以更好地控制标签位置。


176-176: TextOptions 新增可选的 offset 属性进一步增强了文本定位的灵活性。
此设计与 LineLabelConf 配合时有一致的使用体验。

bricks/diagram/docs/eo-draw-canvas.md (1)

489-491: 在示例中为连线标签添加 placementoffset 能直观展示其作用。
这能帮助使用者快速上手配置个性化的标签位置。

@github-actions github-actions bot temporarily deployed to pull request January 6, 2025 04:45 Inactive
@weareoutman weareoutman marked this pull request as ready for review January 6, 2025 06:17
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
bricks/diagram/src/draw-canvas/processors/getLabelMaskAndOffset.ts (2)

8-11: 函数定义逻辑看起来不错,但建议在注释中说明返回结果含义
返回值是 [labelMask, labelOffset],在大型团队协作中,维护者需要了解这两个值分别代表什么及其用途,以免后续产生误解。


25-42: switch 分支中重复片段可进行提炼
四个分支在计算偏移量的时候大体结构一致,可考虑使用辅助函数统一处理,减少重复代码并提高可维护性。

bricks/diagram/src/draw-canvas/LineLabelComponent.tsx (2)

14-15: offset 属性建议在文档中说明何时为 null
如果外部未传入 offset,渲染逻辑默认使用 [0, 0],但在此处声明为可空,需要在文档或类型注释里明确 offset 为空的场景与使用方式。


34-34: 无需过度依赖布尔类型判定
const ready = !!(position && offset) 的做法简洁,但当后续类型出现更多状态时,可能需要更加清晰的判定逻辑。此写法虽目前可行,但随着需求变化,需要评估可读性与可扩展性。

bricks/diagram/src/draw-canvas/processors/getLabelMaskAndOffset.spec.ts (1)

92-112: “right” 方向测试思路清晰
同样,进一步考虑补充极端情况(例如:angle = 0angle = Math.PI/2)的测试。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f22b2e5 and 35b684e.

📒 Files selected for processing (6)
  • bricks/diagram/docs/eo-draw-canvas.md (3 hunks)
  • bricks/diagram/src/draw-canvas/EdgeComponent.tsx (6 hunks)
  • bricks/diagram/src/draw-canvas/LineLabelComponent.tsx (3 hunks)
  • bricks/diagram/src/draw-canvas/interfaces.ts (1 hunks)
  • bricks/diagram/src/draw-canvas/processors/getLabelMaskAndOffset.spec.ts (1 hunks)
  • bricks/diagram/src/draw-canvas/processors/getLabelMaskAndOffset.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • bricks/diagram/docs/eo-draw-canvas.md
  • bricks/diagram/src/draw-canvas/EdgeComponent.tsx
🔇 Additional comments (6)
bricks/diagram/src/draw-canvas/processors/getLabelMaskAndOffset.ts (1)

15-18: 建议在计算中添加对负值或极端值的安全检查
当前仅使用 padding=3 并简单地从 labelSize 取值进行计算。当 widthheight 异常时(如 0、负值或极大值),可能会影响布局并导致不可预料的问题。

bricks/diagram/src/draw-canvas/LineLabelComponent.tsx (1)

37-39: 偏移量加算写法灵活,但需注意大角度或负数情况
x={ready ? position[0] + offset[0] : 0}y={...} 的加法逻辑对于简单offset是可行的,但如果出现较大或反向偏移,可能需要更复杂的对齐策略。建议在后续迭代中纳入测试用例。

bricks/diagram/src/draw-canvas/processors/getLabelMaskAndOffset.spec.ts (3)

10-13: 空输入场景测试用例充分
labelPositionlabelSize 为 null 的处理已测试,确保了基础的健壮性。


20-40: 建议在边界值下增加更多断言
在 “top” 测试场景中,测试角度为 Math.PI / 4 时覆盖了 45°情形,但在极小或极大角度时也应测试,以降低潜在的计算异常风险。


70-90: “left” 方向计算测试覆盖性较好
测试期望值与实际值匹配度较高,看起来计算逻辑正确。

bricks/diagram/src/draw-canvas/interfaces.ts (1)

396-402: 新增的 PositionAndAngle 类型定义简明
将方向、角度与额外偏移统一放置在同一元组中,能更好地表达标签定位;但应在团队内部明确约定使用顺序与语义,以避免混淆。

@panzekun panzekun merged commit e4922fa into master Jan 6, 2025
9 checks passed
@panzekun panzekun deleted the steve/line-points-snap branch January 6, 2025 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants