File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,11 +203,9 @@ export function ChartistPluginTooltip<T extends BaseChart<any>>(
203203 if ( anchor ) {
204204 const box = chartElem . getBoundingClientRect ( ) ;
205205 const left =
206- ( event . target as any ) . x2 . baseVal . value +
207- box . left +
208- window . pageXOffset ;
206+ ( event . target as any ) . x2 . baseVal . value + box . left + window . scrollX ;
209207 const top =
210- ( event . target as any ) . y2 . baseVal . value + box . top + window . pageYOffset ;
208+ ( event . target as any ) . y2 . baseVal . value + box . top + window . scrollY ;
211209
212210 toolTip . style . left = left + offsetX + 'px' ;
213211 toolTip . style . top = top + offsetY + 'px' ;
@@ -217,17 +215,15 @@ export function ChartistPluginTooltip<T extends BaseChart<any>>(
217215 }
218216 } else {
219217 const offsetBox = tooltipOffsetParent . getBoundingClientRect ( ) ;
220- const allOffsetLeft = - offsetBox . left - window . pageXOffset + offsetX ;
221- const allOffsetTop = - offsetBox . top - window . pageYOffset + offsetY ;
218+ const allOffsetLeft = - offsetBox . left - window . scrollX + offsetX ;
219+ const allOffsetTop = - offsetBox . top - window . scrollY + offsetY ;
222220
223221 if ( anchor ) {
224222 const box = chartElem . getBoundingClientRect ( ) ;
225223 const left =
226- ( event . target as any ) . x2 . baseVal . value +
227- box . left +
228- window . pageXOffset ;
224+ ( event . target as any ) . x2 . baseVal . value + box . left + window . scrollX ;
229225 const top =
230- ( event . target as any ) . y2 . baseVal . value + box . top + window . pageYOffset ;
226+ ( event . target as any ) . y2 . baseVal . value + box . top + window . scrollY ;
231227
232228 toolTip . style . left = left + allOffsetLeft + 'px' ;
233229 toolTip . style . top = top + allOffsetTop + 'px' ;
You can’t perform that action at this time.
0 commit comments