From 051a0adbb7e49f8549480a203c2ceebd3b6aa1d9 Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Tue, 25 Apr 2023 13:34:08 +0200 Subject: [PATCH] added notes on how search selection will work --- .../imagery/components/AnnotationsCanvas.vue | 12 +---------- .../imagery/components/ImageryView.vue | 21 +++++++++++++++++++ .../layout/search/AnnotationSearchResult.vue | 2 +- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/plugins/imagery/components/AnnotationsCanvas.vue b/src/plugins/imagery/components/AnnotationsCanvas.vue index 797ebce908..0f8200e8d8 100644 --- a/src/plugins/imagery/components/AnnotationsCanvas.vue +++ b/src/plugins/imagery/components/AnnotationsCanvas.vue @@ -109,11 +109,8 @@ export default { }, updateSelection(selection) { const selectionContext = selection?.[0]?.[0]?.context?.item; - // on clicking on a search result we highlight the annotation and zoom - we know it's an annotation result when isAnnotationSearchResult === true - // We shouldn't zoom when we're selecting existing annotations to view them or creating new annotations. const selectionType = selection?.[0]?.[0]?.context?.type; - const validSelectionTypes = ['clicked-on-image-selection', 'image-annotation-search-result']; - const isAnnotationSearchResult = selectionType === 'image-annotation-search-result'; + const validSelectionTypes = ['clicked-on-image-selection']; if (!validSelectionTypes.includes(selectionType)) { // wrong type of selection @@ -121,21 +118,14 @@ export default { } if (selectionContext - && (!isAnnotationSearchResult) && this.openmct.objects.areIdsEqual(selectionContext.identifier, this.domainObject.identifier)) { return; } const incomingSelectedAnnotations = selection?.[0]?.[0]?.context?.annotations; - //This section is only for the annotations search results entry to displaying annotations - if (isAnnotationSearchResult) { - // this.showAnnotationsFromSearchResults(incomingSelectedAnnotations); - } - //This section is common to all entry points for annotation display this.prepareExistingAnnotationSelection(incomingSelectedAnnotations); }, - prepareExistingAnnotationSelection(annotations) { const targetDomainObjects = {}; targetDomainObjects[this.keyString] = this.domainObject; diff --git a/src/plugins/imagery/components/ImageryView.vue b/src/plugins/imagery/components/ImageryView.vue index 4a014732ea..db86aea39f 100644 --- a/src/plugins/imagery/components/ImageryView.vue +++ b/src/plugins/imagery/components/ImageryView.vue @@ -685,6 +685,8 @@ export default { this.loadVisibleLayers(); this.loadAnnotations(); this.unobserveAnnotationLastCreated = this.openmct.objects.observe(this.domainObject, 'annotationLastCreated', this.checkForNewAnnotations); + + this.openmct.selection.on('change', this.updateSelection); }, beforeDestroy() { this.persistVisibleLayers(); @@ -723,6 +725,8 @@ export default { if (this.unobserveAnnotationLastCreated) { this.unobserveAnnotationLastCreated(); } + + this.openmct.selection.off('change', this.updateSelection); }, methods: { calculateViewHeight() { @@ -748,6 +752,23 @@ export default { this.timeContext.off("clock", this.trackDuration); } }, + updateSelection(selection) { + const selectionType = selection?.[0]?.[0]?.context?.type; + const validSelectionTypes = ['annotation-search-result']; + + if (!validSelectionTypes.includes(selectionType)) { + // wrong type of selection + return; + } + + const incomingSelectedAnnotation = selection?.[0]?.[0]?.context?.annotations?.[0]; + console.debug(`📲 incoming search selections`, incomingSelectedAnnotation); + // for incoming search results, we should: + // 1. set the the time bounds to match the search result + // 2. search the imageHistory for the image that matches the time of the search result + // 3. using the index from the above, "click" on the image to select it + // 4. pass to the annotation canvas layer the selected annotation + }, expand() { // check for modifier keys so it doesnt interfere with the layout if (this.cursorStates.modifierKeyPressed) { diff --git a/src/ui/layout/search/AnnotationSearchResult.vue b/src/ui/layout/search/AnnotationSearchResult.vue index be9faac6b7..b60b6c9fe1 100644 --- a/src/ui/layout/search/AnnotationSearchResult.vue +++ b/src/ui/layout/search/AnnotationSearchResult.vue @@ -185,7 +185,7 @@ export default { targetDetails, targetDomainObjects, annotations: [this.result], - annotationType: this.openmct.annotation.ANNOTATION_TYPES.PLOT_SPATIAL, + annotationType: this.result.annotationType, onAnnotationChange: () => {} } }