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(label): add label transform feature exceedAdjust #6209

Merged
merged 11 commits into from
May 7, 2024

Conversation

Runtus
Copy link
Contributor

@Runtus Runtus commented Apr 27, 2024

Checklist
  • npm test passes
  • benchmarks are included
  • commit message follows commit guidelines
  • documents are updated
Description of change
  • 增加Label下的transform-exceedAdjust新属性,当label超出 canvas 画布的时候,自动反方向移动位置,防止被剪裁。

示例图

close: #6173

site/docs/spec/label/exceedAdjust.en.md Outdated Show resolved Hide resolved
src/label-transform/exceedAdjust.ts Outdated Show resolved Hide resolved
src/label-transform/exceedAdjust.ts Outdated Show resolved Hide resolved
@hustcc
Copy link
Member

hustcc commented May 7, 2024

单测报错了!

@Runtus
Copy link
Contributor Author

Runtus commented May 7, 2024

单测报错了!

怪了,我本地跑test是通过的,不知道为啥CI的test没过

@coveralls
Copy link

coveralls commented May 7, 2024

Pull Request Test Coverage Report for Build 8986952550

Details

  • 25 of 28 (89.29%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.009%) to 86.367%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/label-transform/exceedAdjust.ts 24 27 88.89%
Totals Coverage Status
Change from base Build 8984849652: -0.009%
Covered Lines: 10322
Relevant Lines: 11576

💛 - Coveralls

@hustcc
Copy link
Member

hustcc commented May 7, 2024

等这个 PR #6222 合并之后,合并进来,然后把那个碰撞的位置还是改成画布大小吧,刚想起来,coordinate 有可能是圆形的,如果用 coordinate 可能出 bug。

export const OverlapHide: LLC<OverlapHideOptions> = (options) => {
  const { priority } = options;
  return (labels: DisplayObject[], { canvas }) => {
    const x = 0;
    const y = 0;
    const { width, height } = canvas.getConfig();  // 这里
   // ...

  }
}

@Runtus
Copy link
Contributor Author

Runtus commented May 7, 2024

等这个 PR #6222 合并之后,合并进来,然后把那个碰撞的位置还是改成画布大小吧,刚想起来,coordinate 有可能是圆形的,如果用 coordinate 可能出 bug。

export const OverlapHide: LLC<OverlapHideOptions> = (options) => {
  const { priority } = options;
  return (labels: DisplayObject[], { canvas }) => {
    const x = 0;
    const y = 0;
    const { width, height } = canvas.getConfig();  // 这里
   // ...

  }
}

明白

src/label-transform/exceedAdjust.ts Outdated Show resolved Hide resolved
src/label-transform/exceedAdjust.ts Outdated Show resolved Hide resolved
@hustcc hustcc merged commit fefd4ea into antvis:v5 May 7, 2024
2 checks passed
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.

增加 label position 策略:exceedAdjust
3 participants