Skip to content

Commit cae6023

Browse files
committed
fix: fix position of html tooltip when confine is false, fix #3632
1 parent d7ee554 commit cae6023

File tree

1 file changed

+4
-3
lines changed
  • packages/vchart/src/plugin/components/tooltip-handler

1 file changed

+4
-3
lines changed

packages/vchart/src/plugin/components/tooltip-handler/base.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,10 @@ export abstract class BaseTooltipHandler extends BasePlugin implements ITooltipH
395395

396396
/* 三、确保tooltip在视区内 */
397397
const containerDimSize = dim === 'x' ? containerSize.width : containerSize.height;
398-
const leftOrTop =
399-
-(tooltipParentElementRect[dim] - (chartElementRect?.[dim] ?? 0) / chartElementScale) /
400-
tooltipParentElementScale;
398+
const leftOrTop = tooltipSpec.confine
399+
? -(tooltipParentElementRect[dim] - (chartElementRect?.[dim] ?? 0) / chartElementScale) /
400+
tooltipParentElementScale
401+
: -tooltipParentElementRect[dim] / tooltipParentElementScale;
401402
const rightOrBottom = containerDimSize / tooltipParentElementScale + leftOrTop - boxSize;
402403

403404
// 处理左右

0 commit comments

Comments
 (0)