Skip to content

Commit

Permalink
fix(components): [table] fix cell tooltip display error (#16449)
Browse files Browse the repository at this point in the history
* fix(table-body-hover-trigger): fix the tooltip count way  when trigger the table

* perf:replace let with const

* Update packages/components/table/src/table-body/events-helper.ts

---------

Co-authored-by: btea <2356281422@qq.com>
  • Loading branch information
electroluxcode and btea authored Apr 19, 2024
1 parent f926b03 commit 42b3a83
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/components/table/src/table-body/events-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ function useEvents<T>(props: Partial<TableBodyProps<T>>) {
let rangeWidth = range.getBoundingClientRect().width
let rangeHeight = range.getBoundingClientRect().height
const offsetWidth = rangeWidth - Math.floor(rangeWidth)
const { width: cellChildWidth, height: cellChildHeight } =
cellChild.getBoundingClientRect()
if (offsetWidth < 0.001) {
rangeWidth = Math.floor(rangeWidth)
}
Expand All @@ -146,9 +148,9 @@ function useEvents<T>(props: Partial<TableBodyProps<T>>) {
const horizontalPadding = left + right
const verticalPadding = top + bottom
if (
rangeWidth + horizontalPadding > cellChild.offsetWidth ||
rangeHeight + verticalPadding > cellChild.offsetHeight ||
cellChild.scrollWidth > cellChild.offsetWidth
rangeWidth + horizontalPadding > cellChildWidth ||
rangeHeight + verticalPadding > cellChildHeight ||
cellChild.scrollWidth > cellChildWidth
) {
createTablePopper(
tooltipOptions,
Expand Down

0 comments on commit 42b3a83

Please sign in to comment.