mirror of
https://github.com/nasa/openmct.git
synced 2025-03-10 14:34:08 +00:00
rudimentary annotation
This commit is contained in:
parent
424a2b30ac
commit
2d868cdb58
@ -80,6 +80,7 @@
|
|||||||
openmct.install(openmct.plugins.example.Generator());
|
openmct.install(openmct.plugins.example.Generator());
|
||||||
openmct.install(openmct.plugins.example.EventGeneratorPlugin());
|
openmct.install(openmct.plugins.example.EventGeneratorPlugin());
|
||||||
openmct.install(openmct.plugins.example.ExampleImagery());
|
openmct.install(openmct.plugins.example.ExampleImagery());
|
||||||
|
openmct.install(openmct.plugins.example.ExampleTags());
|
||||||
|
|
||||||
openmct.install(openmct.plugins.Espresso());
|
openmct.install(openmct.plugins.Espresso());
|
||||||
openmct.install(openmct.plugins.MyItems());
|
openmct.install(openmct.plugins.MyItems());
|
||||||
|
@ -26,15 +26,15 @@
|
|||||||
class="c-image-canvas"
|
class="c-image-canvas"
|
||||||
style="width: 100%; height: 100%;"
|
style="width: 100%; height: 100%;"
|
||||||
@mousedown="mouseDown"
|
@mousedown="mouseDown"
|
||||||
@mouseup="mouseUp"
|
|
||||||
@mousemove="mouseMove"
|
@mousemove="mouseMove"
|
||||||
|
@click="mouseClick"
|
||||||
></canvas>
|
></canvas>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
inject: ['openmct', 'domainObject'],
|
inject: ['openmct', 'domainObject', 'objectPath'],
|
||||||
props: {
|
props: {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -80,9 +80,67 @@ export default {
|
|||||||
this.drawRectInCanvas();
|
this.drawRectInCanvas();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mouseUp(event) {
|
mouseClick(event) {
|
||||||
|
event.stopPropagation();
|
||||||
console.debug(`🐭 mouseUp, dragging disabled`);
|
console.debug(`🐭 mouseUp, dragging disabled`);
|
||||||
this.dragging = false;
|
this.dragging = false;
|
||||||
|
const keyString = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
||||||
|
const targetDetails = {};
|
||||||
|
targetDetails[keyString] = {
|
||||||
|
x: this.rectangle.x,
|
||||||
|
y: this.rectangle.y,
|
||||||
|
width: this.rectangle.width,
|
||||||
|
height: this.rectangle.height
|
||||||
|
};
|
||||||
|
const targetDomainObjects = {};
|
||||||
|
targetDomainObjects[keyString] = this.domainObject;
|
||||||
|
const annotationContext = {
|
||||||
|
type: 'clicked-on-image-selection',
|
||||||
|
targetDetails,
|
||||||
|
targetDomainObjects,
|
||||||
|
annotations: [],
|
||||||
|
annotationType: this.openmct.annotation.ANNOTATION_TYPES.PIXEL_SPATIAL,
|
||||||
|
onAnnotationChange: null
|
||||||
|
};
|
||||||
|
|
||||||
|
const selection = this.createPathSelection();
|
||||||
|
if (selection.length && this.openmct.objects.areIdsEqual(selection[0].context.item.identifier, this.domainObject.identifier)) {
|
||||||
|
selection[0].context = {
|
||||||
|
...selection[0].context,
|
||||||
|
...annotationContext
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
selection.unshift({
|
||||||
|
element: this.$el,
|
||||||
|
context: {
|
||||||
|
item: this.domainObject,
|
||||||
|
...annotationContext
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
console.debug(`🍊 firing selection event`, selection);
|
||||||
|
this.openmct.selection.select(selection, true);
|
||||||
|
// would add cancel selection here
|
||||||
|
},
|
||||||
|
createPathSelection() {
|
||||||
|
let selection = [];
|
||||||
|
selection.unshift({
|
||||||
|
element: this.$el,
|
||||||
|
context: {
|
||||||
|
item: this.domainObject
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.objectPath.forEach((pathObject, index) => {
|
||||||
|
selection.push({
|
||||||
|
element: this.openmct.layout.$refs.browseObject.$el,
|
||||||
|
context: {
|
||||||
|
item: pathObject
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return selection;
|
||||||
},
|
},
|
||||||
mouseDown(event) {
|
mouseDown(event) {
|
||||||
console.debug(`🐭 mouseDown`);
|
console.debug(`🐭 mouseDown`);
|
||||||
|
@ -175,6 +175,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateSelection(selection) {
|
updateSelection(selection) {
|
||||||
|
console.debug(`🥾 selection changed`, selection);
|
||||||
const unobserveEntryFunctions = Object.values(this.unobserveEntries);
|
const unobserveEntryFunctions = Object.values(this.unobserveEntries);
|
||||||
unobserveEntryFunctions.forEach(unobserveEntry => {
|
unobserveEntryFunctions.forEach(unobserveEntry => {
|
||||||
unobserveEntry();
|
unobserveEntry();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user