Reorganize components, create ObjectFrame
This commit is contained in:
36
src/ui/mixins/context-menu-gesture.js
Normal file
36
src/ui/mixins/context-menu-gesture.js
Normal file
@@ -0,0 +1,36 @@
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
props: {
|
||||
'objectPath': {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
//TODO: touch support
|
||||
this.$el.addEventListener('contextmenu', this.showContextMenu);
|
||||
|
||||
function updateObject(oldObject, newObject) {
|
||||
Object.assign(oldObject, newObject);
|
||||
}
|
||||
|
||||
this.objectPath.forEach(object => {
|
||||
if (object) {
|
||||
this.$once('hook:destroy',
|
||||
this.openmct.objects.observe(object, '*', updateObject.bind(this, object)))
|
||||
}
|
||||
});
|
||||
},
|
||||
destroyed() {
|
||||
this.$el.removeEventListener('contextMenu', this.showContextMenu);
|
||||
},
|
||||
methods: {
|
||||
showContextMenu(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this.openmct.contextMenu._showContextMenuForObjectPath(this.objectPath, event.clientX, event.clientY);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user