From bbae9c6048920784ce1413af25fef9f735eac547 Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Fri, 7 Mar 2025 11:17:52 +0100 Subject: [PATCH] use this.el instead of hardcoded layout ref --- src/plugins/events/components/EventTimelineView.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/events/components/EventTimelineView.vue b/src/plugins/events/components/EventTimelineView.vue index 06652e934b..e5ba075a48 100644 --- a/src/plugins/events/components/EventTimelineView.vue +++ b/src/plugins/events/components/EventTimelineView.vue @@ -196,16 +196,15 @@ export default { } }, getClientWidth() { - let clientWidth = this.$refs.events.clientWidth; - + // Try to use the component’s own element first + let clientWidth = this.$refs.events?.clientWidth; if (!clientWidth) { - //this is a hack - need a better way to find the parent of this component - const parent = this.openmct.layout.$refs.browseObject.$el; + // Fallback: use the actual container element (the immediate parent) + const parent = this.$el.parentElement; if (parent) { clientWidth = parent.getBoundingClientRect().width; } } - return clientWidth; }, updateViewBounds(bounds, isTick) {