Skip to content

Commit d2fd4e5

Browse files
committed
Modification - VueUiXy - Remove mousemove event listener onBeforeUnmount
1 parent 2d50571 commit d2fd4e5

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/components/vue-ui-xy.vue

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,23 +2540,27 @@ function prepareChart() {
25402540
}
25412541
}
25422542
2543+
function setClientPosition(e) {
2544+
clientPosition.value = {
2545+
x: e.clientX,
2546+
y: e.clientY
2547+
}
2548+
}
2549+
25432550
onMounted(() => {
25442551
prepareChart();
25452552
setupSlicer();
2546-
document.addEventListener("mousemove", (e) => {
2547-
clientPosition.value = {
2548-
x: e.clientX,
2549-
y: e.clientY
2550-
}
2551-
});
2553+
document.addEventListener("mousemove", setClientPosition);
25522554
document.addEventListener('scroll', hideTags);
25532555
});
25542556
25552557
onBeforeUnmount(() => {
25562558
document.removeEventListener('scroll', hideTags);
2559+
document.removeEventListener("mousemove", setClientPosition);
25572560
if (resizeObserver.value) {
25582561
resizeObserver.value.unobserve(observedEl.value);
25592562
resizeObserver.value.disconnect();
2563+
resizeObserver.value = null;
25602564
}
25612565
});
25622566
@@ -2744,18 +2748,18 @@ onMounted(() => {
27442748
const ro = new ResizeObserver(() => {
27452749
recomputeVisibility()
27462750
if (isActuallyVisible.value) {
2747-
// re-measure and re-init once we have size
2748-
prepareChart()
2749-
normalizeSlicerWindow()
2750-
setupSlicer()
2751+
// re-measure and re-init once we have size
2752+
prepareChart()
2753+
normalizeSlicerWindow()
2754+
setupSlicer()
27512755
}
27522756
})
27532757
if (chart.value?.parentNode) ro.observe(chart.value.parentNode)
27542758
})
27552759
27562760
// v3 - Essential to make shifting between loading config and final config work
27572761
watch(FINAL_CONFIG, () => {
2758-
seedMutableFromConfig()
2762+
seedMutableFromConfig();
27592763
}, { immediate: true });
27602764
27612765
defineExpose({
@@ -3049,7 +3053,8 @@ defineExpose({
30493053
:fill="FINAL_CONFIG.bar.useGradient ? plot.value >= 0 ? `url(#rectGradient_pos_${i}_${uniqueId})` : `url(#rectGradient_neg_${i}_${uniqueId})` : serie.color"
30503054
:stroke="FINAL_CONFIG.bar.border.useSerieColor ? serie.color : FINAL_CONFIG.bar.border.stroke"
30513055
:stroke-width="FINAL_CONFIG.bar.border.strokeWidth"
3052-
:style="{ transition: loading || !FINAL_CONFIG.bar.showTransition ? undefined: `all ${FINAL_CONFIG.bar.transitionDurationMs}ms ease-in-out`}"
3056+
:style="{
3057+
transition: loading || !FINAL_CONFIG.bar.showTransition ? undefined: `all ${FINAL_CONFIG.bar.transitionDurationMs}ms ease-in-out`}"
30533058
/>
30543059
<rect
30553060
data-cy="datapoint-bar"

0 commit comments

Comments
 (0)