Skip to content

Commit 57c182e

Browse files
committed
Simplify condition and use const
1 parent 0a498a2 commit 57c182e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/modules/tooltip/Tooltip.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -529,22 +529,19 @@ export default class Tooltip {
529529
syncedCharts = this.ctx.getSyncedCharts()
530530
}
531531

532-
let isStickyTooltip =
532+
const isStickyTooltip =
533533
w.globals.xyCharts ||
534534
(w.config.chart.type === 'bar' &&
535535
!w.globals.isBarHorizontal &&
536536
this.tooltipUtil.hasBars() &&
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')
540+
const isInteractionInProcess = (e.type === 'mousemove' || e.type === 'touchmove' || e.type === 'mouseup')
541+
const isInteractionEnd = (e.type === 'mouseout' || e.type === 'touchend')
542+
const isChartContextTarget = w.globals.dom.baseEl.contains(e.relatedTarget)
542543

543-
if (
544-
e.type === 'mousemove' ||
545-
e.type === 'touchmove' ||
546-
e.type === 'mouseup'
547-
) {
544+
if (isInteractionInProcess) {
548545
// there is no series to hover over
549546
if (
550547
w.globals.collapsedSeries.length +

0 commit comments

Comments
 (0)