Skip to content

refactor: tooltip enterable and showDelay#310

Merged
pearmini merged 5 commits intomasterfrom
refactor-tooltip-enterable
Dec 11, 2023
Merged

refactor: tooltip enterable and showDelay#310
pearmini merged 5 commits intomasterfrom
refactor-tooltip-enterable

Conversation

@hustcc
Copy link
Copy Markdown
Member

@hustcc hustcc commented Oct 9, 2023

const tooltip = group.appendChild(
  new Tooltip({
    style: {
      x: 100,
      y: 100,
      offset: [20, 20],
      position: 'bottom-right',
      container: {
        x: 28,
        y: 80,
      },
      bounding: {
        x: 0,
        y: 0,
        width: len,
        height: len,
      },
      data: [
        { value: 1231230, name: '第三项', index: 0, color: 'red' },
        { value: 1.2312323, name: '第四项', index: 1, color: 'green' },
        { value: 1.2312323, name: '第五项', index: 1, color: 'blue' },
      ],
      enterable: true,
      showDelay: 60,
    },
  })
);

对于 enterable = true 的时候,需要在调用 hide 的时候额外传入鼠标的位置,否则会有一些 bug。

group.addEventListener('mouseleave', (e) => {
  tooltip.hide(e.offsetX, e.offsetY);
});

Oct-09-2023 17-33-24

@hustcc hustcc force-pushed the refactor-tooltip-enterable branch from fd0f01a to 5e16092 Compare October 9, 2023 09:23
@coveralls
Copy link
Copy Markdown

coveralls commented Oct 9, 2023

Pull Request Test Coverage Report for Build 6465615379

  • 9 of 41 (21.95%) changed or added relevant lines in 10 files are covered.
  • 12 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.2%) to 80.852%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tests/integration/components/tooltip/tooltip-1.ts 0 1 0.0%
tests/integration/components/tooltip/tooltip-3.ts 0 1 0.0%
tests/integration/components/tooltip/tooltip-5.tsx 0 1 0.0%
tests/integration/components/tooltip/tooltip-6.tsx 0 1 0.0%
tests/integration/components/tooltip/tooltip-7.tsx 0 1 0.0%
src/util/bbox.ts 0 1 0.0%
tests/integration/components/tooltip/tooltip-10.ts 1 3 33.33%
tests/integration/components/tooltip/tooltip-2.ts 1 3 33.33%
tests/integration/components/tooltip/tooltip-4.ts 1 3 33.33%
src/ui/tooltip/index.ts 6 26 23.08%
Files with Coverage Reduction New Missed Lines %
src/ui/tooltip/index.ts 2 68.36%
src/util/throttle.ts 10 6.25%
Totals Coverage Status
Change from base Build 6453475093: -0.2%
Covered Lines: 7805
Relevant Lines: 8987

💛 - Coveralls

@Aarebecca
Copy link
Copy Markdown
Contributor

对于 enterable = true 的时候,需要在调用 hide 的时候额外传入鼠标的位置,否则会有一些 bug。

这个是 G2 做适配对吧

@hustcc hustcc mentioned this pull request Oct 11, 2023
2 tasks
@hustcc
Copy link
Copy Markdown
Member Author

hustcc commented Dec 11, 2023

对于 enterable = true 的时候,需要在调用 hide 的时候额外传入鼠标的位置,否则会有一些 bug。

这个是 G2 做适配对吧

是的,不然没有办法处理这个 enterable 的逻辑。要么就是 enterable 的逻辑写到 G2,在 component 这一层不处理,还需要测试。

@hustcc hustcc force-pushed the refactor-tooltip-enterable branch from 00de48f to dcb1d7d Compare December 11, 2023 08:55
@hustcc hustcc requested a review from Aarebecca December 11, 2023 09:11
@pearmini pearmini merged commit 60f3f2c into master Dec 11, 2023
@pearmini pearmini deleted the refactor-tooltip-enterable branch December 11, 2023 09:11
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.

4 participants