From ef6ca1e3e6fb06e59bc358511528196133a04d58 Mon Sep 17 00:00:00 2001 From: Justin Georgi Date: Thu, 14 Dec 2023 21:17:53 -0700 Subject: [PATCH] Add image mode chooser (#51) Closes: #46 Signed-off-by: Justin Georgi Reviewed-on: https://gitea.azgeorgis.net/Georgi_Lab/ALVINN_f7/pulls/51 --- src/components/svg-icon.vue | 5 ++++- src/pages/detect.vue | 24 ++++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/components/svg-icon.vue b/src/components/svg-icon.vue index 362377c..b4d2c16 100644 --- a/src/components/svg-icon.vue +++ b/src/components/svg-icon.vue @@ -3,6 +3,9 @@ + + + @@ -13,7 +16,7 @@ icon: { type: String, validator(value) { - return ['image','videocam','visibility'].includes(value) + return ['image','videocam','visibility','photo_library','no_photography','photo_camera'].includes(value) } }, fillColor: { diff --git a/src/pages/detect.vue b/src/pages/detect.vue index 8200cdd..adf0eb8 100644 --- a/src/pages/detect.vue +++ b/src/pages/detect.vue @@ -30,7 +30,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -82,6 +82,17 @@ + + + + + + + + + + + @@ -345,8 +356,13 @@ this.detectorLabels.forEach( s => s.detect = false ) } }, - selectImage () { - if (this.isCordova) { + selectImage (mode) { + if (mode == "camera") { + this.$refs.image_chooser.setAttribute("capture","environment") + } else { + this.$refs.image_chooser.removeAttribute("capture") + } + if (this.isCordova && mode == "camera") { navigator.camera.getPicture(this.getImage, this.onFail, { quality: 50, destinationType: Camera.DestinationType.DATA_URL, correctOrientation: true }); } else { var loadResult = this.$refs.image_chooser.click()