Skip to content
Snippets Groups Projects
Commit 8aa0a832 authored by Valentin Perrelle's avatar Valentin Perrelle Committed by David Bühler
Browse files

[Ivette] dive: fix tips update

parent cdc9862c
No related branches found
No related tags found
No related merge requests found
...@@ -286,19 +286,25 @@ class Dive { ...@@ -286,19 +286,25 @@ class Dive {
addTips(node: Cytoscape.NodeSingular): void { addTips(node: Cytoscape.NodeSingular): void {
let timeout: NodeJS.Timeout; let timeout: NodeJS.Timeout;
let tips: Tippy.Instance[]; let tips: Tippy.Instance[] | null = null;
// Create tips lazily
node.on('mouseover', () => { node.on('mouseover', () => {
if (tips === undefined) if (tips === null) {
tips = this.createTips(node); tips = this.createTips(node);
tips.forEach((tip) => tip.props.onHidden = (() => tip.destroy()));
}
clearTimeout(timeout); clearTimeout(timeout);
timeout = setTimeout(() => tips?.forEach((tip) => { tip.show(); }), 200); timeout = setTimeout(() => tips?.forEach((tip) => {
tip.show();
}), 200);
}); });
node.on('mouseout', () => { node.on('mouseout', () => {
clearTimeout(timeout); clearTimeout(timeout);
timeout = setTimeout(() => tips?.forEach((tip) => { tip.hide(); }), 1000); timeout = setTimeout(() => {
tips?.forEach((tip) => tip.hide());
tips = null; // Force rebuilding tips in case they changed
}, 1000);
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment