@@ -12,7 +12,7 @@ import AsyncStore from "../../internal/utils/async-store";
1212import { SVGRendererPool , SVGRendererSingle } from "../../internal/utils/renderer-utils" ;
1313import { DebouncedCall , isEqualArrays } from "../../internal/utils/utils" ;
1414import { Rect } from "../interfaces" ;
15- import { getGroupRect , getPointRect , getSeriesId , isXThreshold } from "../utils" ;
15+ import { getGroupRect , getPointRect , getSeriesId , isXThreshold , safeRect } from "../utils" ;
1616import { ChartExtraContext } from "./chart-extra-context" ;
1717
1818import testClasses from "../test-classes/styles.css.js" ;
@@ -61,7 +61,9 @@ export class ChartExtraTooltip extends AsyncStore<ReactiveTooltipState> {
6161 // trackRef.current = targetElement.element as it might get invalidated unexpectedly.
6262 // The getTrack function ensures the latest element reference is given on each request.
6363 public getTargetTrack = ( ) => ( this . targetTrack . element ?. element ?? null ) as null | SVGElement ;
64- public getGroupTrack = ( ) => ( this . groupTrack . element ?. element ?? null ) as null | SVGElement ;
64+ public getGroupTrack = ( ) => {
65+ return ( this . groupTrack . element ?. element ?? null ) as null | SVGElement ;
66+ } ;
6567
6668 public onChartDestroy ( ) {
6769 this . cursor . destroy ( ) ;
@@ -222,8 +224,7 @@ function getPieChartTargetPlacement(point: Highcharts.Point): Rect {
222224 // Instead, there is a `tooltipPos` tuple, which is not covered by TS.
223225 // See: https://github.com/highcharts/highcharts/issues/23118.
224226 if ( "tooltipPos" in point && Array . isArray ( point . tooltipPos ) ) {
225- // We use very small but non-zero track size as otherwise it is placed incorrectly in Firefox.
226- return { x : point . tooltipPos [ 0 ] , y : point . tooltipPos [ 1 ] , width : 0.1 , height : 0.1 } ;
227+ return safeRect ( { x : point . tooltipPos [ 0 ] , y : point . tooltipPos [ 1 ] , width : 0 , height : 0 } ) ;
227228 }
228229 // We use the alternative, middle, tooltip placement as a fallback, in case the undocumented "tooltipPos"
229230 // is no longer available in the point.
@@ -244,10 +245,10 @@ function getPieMiddlePlacement(point: Highcharts.Point): Rect {
244245
245246function getSolidGaugeTargetPlacement ( point : Highcharts . Point ) : Rect {
246247 const chart = point . series . chart ;
247- return {
248+ return safeRect ( {
248249 x : chart . plotLeft + chart . plotWidth / 2 ,
249250 y : chart . plotTop + chart . plotHeight / 2 ,
250- width : 0.1 ,
251- height : 0.1 ,
252- } ;
251+ width : 0 ,
252+ height : 0 ,
253+ } ) ;
253254}
0 commit comments