@@ -29,6 +29,7 @@ import 'highcharts/es-modules/masters/modules/bullet.src.js';
2929import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js' ;
3030import { beforeNextRender } from '@polymer/polymer/lib/utils/render-status.js' ;
3131import { html , PolymerElement } from '@polymer/polymer/polymer-element.js' ;
32+ import Pointer from 'highcharts/es-modules/Core/Pointer.js' ;
3233import Highcharts from 'highcharts/es-modules/masters/highstock.src.js' ;
3334import { defineCustomElement } from '@vaadin/component-base/src/define.js' ;
3435import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js' ;
@@ -69,6 +70,28 @@ export function deepMerge(target, source) {
6970 /* eslint-enable no-invalid-this */
7071} ) ;
7172
73+ // Monkeypatch the onDocumentMouseMove method to fix the check for the source of the event
74+ // Due to the fact that the event is attached to the document, the target of the event is
75+ // the <vaadin-chart> element, so we need to use the composedPath to get the actual target (#7107)
76+ Pointer . prototype . onDocumentMouseMove = function ( e ) {
77+ const chart = this . chart ;
78+ const chartPosition = this . chartPosition ;
79+ const pEvt = this . normalize ( e , chartPosition ) ;
80+ const tooltip = chart . tooltip ;
81+ // If we're outside, hide the tooltip
82+ if (
83+ chartPosition &&
84+ ( ! tooltip || ! tooltip . isStickyOnContact ( ) ) &&
85+ ! chart . isInsidePlot ( pEvt . chartX - chart . plotLeft , pEvt . chartY - chart . plotTop , {
86+ visiblePlotOnly : true ,
87+ } ) &&
88+ // Use the first element from the composed path instead of the actual target
89+ ! this . inClass ( pEvt . composedPath ( ) [ 0 ] , 'highcharts-tracker' )
90+ ) {
91+ this . reset ( ) ;
92+ }
93+ } ;
94+
7295// Init Highcharts global language defaults
7396// No data message should be empty by default
7497Highcharts . setOptions ( { lang : { noData : '' } } ) ;
0 commit comments