[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
This commit is contained in:
Jamie V 2021-01-08 11:55:43 -08:00 committed by GitHub
parent 2f8431905f
commit e6e07cf959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -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();

View File

@ -6,6 +6,8 @@
'position': virtualScroll ? 'absolute' : 'relative'
}"
class="c-tree__item-h"
@click="handleClick"
@contextmenu="handleContextMenu"
>
<div
class="c-tree__item"
@ -20,9 +22,11 @@
class="c-tree__item__view-control"
:control-class="'c-nav__up'"
:enabled="showUp"
:propagate="false"
@input="resetTreeHere"
/>
<object-label
ref="objectLabel"
:domain-object="node.object"
:object-path="node.objectPath"
:navigate-to-path="navigationPath"
@ -34,6 +38,7 @@
class="c-tree__item__view-control"
:control-class="'c-nav__down'"
:enabled="hasComposition && showDown"
:propagate="false"
/>
</div>
</div>
@ -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;
},