mirror of
https://github.com/nasa/openmct.git
synced 2025-03-17 17:45:47 +00:00
added notes on how search selection will work
This commit is contained in:
parent
87d695a454
commit
051a0adbb7
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -185,7 +185,7 @@ export default {
|
||||
targetDetails,
|
||||
targetDomainObjects,
|
||||
annotations: [this.result],
|
||||
annotationType: this.openmct.annotation.ANNOTATION_TYPES.PLOT_SPATIAL,
|
||||
annotationType: this.result.annotationType,
|
||||
onAnnotationChange: () => {}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user