diff --git a/resources/assets/js/annotations/annotatorContainer.vue b/resources/assets/js/annotations/annotatorContainer.vue index 880baa939..65d8d76cd 100644 --- a/resources/assets/js/annotations/annotatorContainer.vue +++ b/resources/assets/js/annotations/annotatorContainer.vue @@ -89,6 +89,25 @@ export default { crossOriginError: false, }; }, + provide() { + const appData = {} + + let imageInfo = {}; + imageInfo['currentId'] = biigle.$require('annotations.imageId'); + imageInfo['ids'] = biigle.$require('annotations.imagesIds'); + imageInfo['filenames'] = biigle.$require('annotations.imagesFilenames'); + imageInfo['type'] = 'image'; + imageInfo['fileChangedEvent'] = 'images.change'; + imageInfo['mapChangedEvent'] = 'annotations.map.init'; + + // Need defineProperty to maintain reactivity. + // See https://stackoverflow.com/questions/65718651/how-do-i-make-vue-2-provide-inject-api-reactive + Object.defineProperty(appData, "info", { + get: () => imageInfo, + }) + + return { 'files': appData }; + }, computed: { canAdd() { return this.isEditor && (this.image !== null); diff --git a/resources/assets/js/annotations/components/screenshotButton.vue b/resources/assets/js/annotations/components/screenshotButton.vue index 94c58babc..27dfe34d1 100644 --- a/resources/assets/js/annotations/components/screenshotButton.vue +++ b/resources/assets/js/annotations/components/screenshotButton.vue @@ -15,6 +15,7 @@ export default { currentId: null, }; }, + inject: ['files'], computed: { filename() { if (this.currentId) { @@ -150,15 +151,16 @@ export default { }, }, created() { - let ids = biigle.$require('annotations.imagesIds'); let filenames = {}; - biigle.$require('annotations.imagesFilenames').forEach((filename, index) => { + let ids = this.files.info.ids; + this.files.info.filenames.forEach((filename, index) => { filenames[ids[index]] = filename; }); this.filenames = filenames; - this.currentId = biigle.$require('annotations.imageId'); - Events.$on('images.change', this.updateCurrentId); - Events.$on('annotations.map.init', this.setMap); + this.currentId = this.files.info.currentId + Events.$on(this.files.info.fileChangedEvent, this.updateCurrentId); + Events.$on(this.files.info.mapChangedEvent, this.setMap); + Keyboard.on('p', this.capture); }, }; diff --git a/resources/assets/js/videos/components/settingsTab.vue b/resources/assets/js/videos/components/settingsTab.vue index 7e322614e..72a752130 100644 --- a/resources/assets/js/videos/components/settingsTab.vue +++ b/resources/assets/js/videos/components/settingsTab.vue @@ -1,16 +1,22 @@ diff --git a/resources/views/videos/show/sidebar-settings.blade.php b/resources/views/videos/show/sidebar-settings.blade.php index 887451551..6186de5ed 100644 --- a/resources/views/videos/show/sidebar-settings.blade.php +++ b/resources/views/videos/show/sidebar-settings.blade.php @@ -2,8 +2,15 @@
+