Skip to content

Commit

Permalink
fix(lineplot): destroy highlight and cease autoplay if active on line…
Browse files Browse the repository at this point in the history
…plot (#530)
  • Loading branch information
krishnanand5 authored Aug 24, 2024
1 parent 1baed6c commit c65ef3c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,22 @@ function DestroyChartComponents() {
}

const scatterSvg = document.querySelector('svg#scatter');
const lineSvg = document.querySelector('svg#line');
// Incase autoplay was running when the highlighted plot points were being handled,
// kill autoplay first before removing highlight_point elements
if (scatterSvg) {
// Incase autoplay was running when the highlighted plot points were being handled,
// kill autoplay first before removing highlight_point elements
constants.KillAutoplay();
document.querySelectorAll('.highlight_point').forEach((element) => {
scatterSvg.querySelectorAll('.highlight_point').forEach((element) => {
element.remove();
});
} else if (lineSvg) {
const highlightPoint = lineSvg.querySelector('#highlight_point');
if (highlightPoint) {
constants.KillAutoplay();
highlightPoint.remove();
}
}

constants.chart = null;
constants.chart_container = null;
constants.brailleContainer = null;
Expand Down

0 comments on commit c65ef3c

Please sign in to comment.