fix: DisplayLayout shapes can be selected and manipulated again (#6289)

fix: handle case where parentObject is undefined

- Fixes manipulation of parentless display layout objects such as shapes and lines
This commit is contained in:
Jesse Mazzella
2023-02-06 12:49:50 -08:00
committed by GitHub
parent b57974b462
commit 5384022a59

View File

@ -109,6 +109,8 @@ import StylesInspectorView from "@/ui/inspector/styles/StylesInspectorView.vue";
import SavedStylesInspectorView from "@/ui/inspector/styles/SavedStylesInspectorView.vue"; import SavedStylesInspectorView from "@/ui/inspector/styles/SavedStylesInspectorView.vue";
import AnnotationsInspectorView from "./annotations/AnnotationsInspectorView.vue"; import AnnotationsInspectorView from "./annotations/AnnotationsInspectorView.vue";
const OVERLAY_PLOT_TYPE = "telemetry.plot.overlay";
export default { export default {
components: { components: {
StylesInspectorView, StylesInspectorView,
@ -189,12 +191,12 @@ export default {
}, },
refreshComposition(selection) { refreshComposition(selection) {
if (selection.length > 0 && selection[0].length > 0) { if (selection.length > 0 && selection[0].length > 0) {
let parentObject = selection[0][0].context.item; const parentObject = selection[0][0].context.item;
this.hasComposition = Boolean( this.hasComposition = Boolean(
parentObject && this.openmct.composition.get(parentObject) parentObject && this.openmct.composition.get(parentObject)
); );
this.isOverlayPlot = selection[0][0].context.item.type === 'telemetry.plot.overlay'; this.isOverlayPlot = parentObject?.type === OVERLAY_PLOT_TYPE;
} }
}, },
refreshTabs(selection) { refreshTabs(selection) {