use this.el instead of hardcoded layout ref

This commit is contained in:
Scott Bell 2025-03-07 11:17:52 +01:00
parent af6f3274cb
commit bbae9c6048

View File

@ -196,16 +196,15 @@ export default {
} }
}, },
getClientWidth() { getClientWidth() {
let clientWidth = this.$refs.events.clientWidth; // Try to use the components own element first
let clientWidth = this.$refs.events?.clientWidth;
if (!clientWidth) { if (!clientWidth) {
//this is a hack - need a better way to find the parent of this component // Fallback: use the actual container element (the immediate parent)
const parent = this.openmct.layout.$refs.browseObject.$el; const parent = this.$el.parentElement;
if (parent) { if (parent) {
clientWidth = parent.getBoundingClientRect().width; clientWidth = parent.getBoundingClientRect().width;
} }
} }
return clientWidth; return clientWidth;
}, },
updateViewBounds(bounds, isTick) { updateViewBounds(bounds, isTick) {