From e6e07cf95979236569c4a39f2fee9d51b0420032 Mon Sep 17 00:00:00 2001 From: Jamie V Date: Fri, 8 Jan 2021 11:55:43 -0800 Subject: [PATCH] [Navigation Tree] Whole tree item clickable (#3632) * passing click and context click on tree item down to object label, making the whole tree item interactive * removed unnecessary code --- src/ui/components/ObjectLabel.vue | 8 ++++++++ src/ui/layout/tree-item.vue | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/ui/components/ObjectLabel.vue b/src/ui/components/ObjectLabel.vue index 35eea137e5..4144e0d4f4 100644 --- a/src/ui/components/ObjectLabel.vue +++ b/src/ui/components/ObjectLabel.vue @@ -42,6 +42,10 @@ export default { navigateToPath: { type: String, default: undefined + }, + propagate: { + type: Boolean, + default: true } }, data() { @@ -80,6 +84,10 @@ export default { }, methods: { navigateOrPreview(event) { + if (!this.propagate) { + event.stopPropagation(); + } + if (this.openmct.editor.isEditing()) { event.preventDefault(); this.preview(); diff --git a/src/ui/layout/tree-item.vue b/src/ui/layout/tree-item.vue index b8daea16ea..f83e247b5e 100644 --- a/src/ui/layout/tree-item.vue +++ b/src/ui/layout/tree-item.vue @@ -6,6 +6,8 @@ 'position': virtualScroll ? 'absolute' : 'relative' }" class="c-tree__item-h" + @click="handleClick" + @contextmenu="handleContextMenu" >
@@ -137,6 +142,13 @@ export default { this.openmct.router.off('change:path', this.highlightIfNavigated); }, methods: { + handleClick(event) { + this.$refs.objectLabel.$el.click(); + }, + handleContextMenu(event) { + this.$refs.objectLabel.showContextMenu(event); + event.stopPropagation(); + }, isNavigated() { return this.navigationPath === this.openmct.router.currentLocation.path; },