app/: a click elsewhere on the label bar closes the selected event
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c39b1b89ed
commit
892838d27e
1 file changed
+8
-1
@@ -184,7 +184,14 @@ function Courbes({ selection: { station, du, au }, d }) {
|
||||
if (r) setChoix(r.map(v => String(v).slice(0, 16).replace(" ", "T") + "Z"));
|
||||
});
|
||||
barre.current.on("plotly_deselect", () => setChoix(null));
|
||||
barre.current.on("plotly_click", ev => courant.current.ouvrir(tries.current[ev.points[0].pointIndex]));
|
||||
// Un clic sur une étiquette l'ouvre ; un clic ailleurs sur la barre (pas un glisser) la referme
|
||||
let surEtiquette = false, x0 = 0;
|
||||
barre.current.on("plotly_click", ev => { surEtiquette = true; courant.current.ouvrir(tries.current[ev.points[0].pointIndex]); });
|
||||
barre.current.addEventListener("mousedown", e => { x0 = e.clientX; }, true);
|
||||
barre.current.addEventListener("click", e => {
|
||||
if (!surEtiquette && Math.abs(e.clientX - x0) < 4) courant.current.ouvrir(null);
|
||||
surEtiquette = false;
|
||||
});
|
||||
setPret(true);
|
||||
});
|
||||
return () => [...Object.values(figs.current), barre.current].forEach(g => g && Plotly.purge(g));
|
||||
|
||||
Reference in new issue
Block a user