Skip to content

Commit 0a498a2

Browse files
committed
Simplify long condition for better readability
1 parent a9723f4 commit 0a498a2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/modules/tooltip/Tooltip.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,9 @@ export default class Tooltip {
537537
this.tConfig.shared) ||
538538
(w.globals.comboCharts && this.tooltipUtil.hasBars())
539539

540+
let isChartContextTarget = w.globals.dom.baseEl.contains(e.relatedTarget)
541+
let isInteractionEnd = (e.type === 'mouseout' || e.type === 'touchend')
542+
540543
if (
541544
e.type === 'mousemove' ||
542545
e.type === 'touchmove' ||
@@ -612,7 +615,7 @@ export default class Tooltip {
612615

613616
w.globals.dom.baseEl.classList.add('apexcharts-tooltip-active')
614617
opt.tooltipEl.classList.add('apexcharts-active')
615-
} else if (!w.globals.dom.baseEl.contains(e.relatedTarget) && (e.type === 'mouseout' || e.type === 'touchend')) {
618+
} else if (!isChartContextTarget && isInteractionEnd) {
616619
this.handleMouseOut(opt)
617620
}
618621
}

0 commit comments

Comments
 (0)