Fix: when clicking a plot on a touch device we won't display the annotation menu (#21479)

* Fixed so when clicking a plot on a touch device we won't display the annotation context menue.

* Refactorings after feedback.

* changed to standard-ish comment.
This commit is contained in:
Marcus Andersson
2020-01-14 14:16:44 +01:00
committed by GitHub
parent a0d43de761
commit 45dc4a834e
2 changed files with 52 additions and 0 deletions

View File

@@ -172,6 +172,18 @@ export default function GraphTooltip(this: any, elem: any, dashboard: any, scope
appEvents.emit(CoreEvents.graphClicked, { pos: pos, panel: panel, item: item });
});
elem.bind('plotleave', () => {
if (!panel.tooltip.shared) {
return;
}
const plot = elem.data().plot;
if (plot) {
$tooltip.detach();
plot.unhighlight();
}
});
this.clear = (plot: { clearCrosshair: () => void; unhighlight: () => void }) => {
$tooltip.detach();
plot.clearCrosshair();