From d048af108e78b0fd1a7fe55f7afcb76dbbe2b638 Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Mon, 16 Dec 2024 12:39:23 +0100 Subject: [PATCH] add tooltip --- .../events/components/EventTimelineView.vue | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/plugins/events/components/EventTimelineView.vue b/src/plugins/events/components/EventTimelineView.vue index 52c6757262..772d96490b 100644 --- a/src/plugins/events/components/EventTimelineView.vue +++ b/src/plugins/events/components/EventTimelineView.vue @@ -64,7 +64,8 @@ export default { eventHistory: [], timeSystem: timeSystem, extendLines: false, - titleKey: null + titleKey: null, + tooltip: null }; }, watch: { @@ -420,7 +421,13 @@ export default { eventTickElement.style.width = '2px'; eventTickElement.style.height = `${String(ROW_HEIGHT - 10)}px`; if (this.titleKey) { - eventTickElement.title = event[this.titleKey]; + const textToShow = event[this.titleKey]; + eventWrapper.addEventListener('mouseover', () => { + this.showToolTip(textToShow, eventTickElement); + }); + eventWrapper.addEventListener('mouseleave', () => { + this.tooltip?.destroy(); + }); } eventWrapper.appendChild(eventTickElement); const limitEvaluation = this.limitEvaluator.evaluate(event, this.valueMetadata); @@ -452,6 +459,13 @@ export default { keyString: this.keyString }); } + }, + showToolTip(textToShow, referenceElement) { + this.tooltip = this.openmct.tooltips.tooltip({ + toolTipText: textToShow, + toolTipLocation: this.openmct.tooltips.TOOLTIP_LOCATIONS.RIGHT, + parentElement: referenceElement + }); } } };