From e7a8c43a748cea84276284d91612f313df313ca3 Mon Sep 17 00:00:00 2001 From: Justin Georgi Date: Fri, 8 Dec 2023 07:56:41 -0700 Subject: [PATCH] Add small features to detect page (#34) Signed-off-by: Justin Georgi Reviewed-on: https://gitea.azgeorgis.net/Georgi_Lab/ALVINN_f7/pulls/34 --- src/pages/detect.vue | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/pages/detect.vue b/src/pages/detect.vue index fb87aa2..3dcc999 100644 --- a/src/pages/detect.vue +++ b/src/pages/detect.vue @@ -10,7 +10,7 @@
- +
@@ -216,7 +216,7 @@ filter: [] }, serverSettings: {}, - debugOn: true, + debugOn: false, debugText: ['Variables loaded'] } }, @@ -276,6 +276,7 @@ }, setData () { var self = this + this.resetView() if (this.serverSettings && this.serverSettings.use) { var modelURL = `http://${this.serverSettings.address}:${this.serverSettings.port}/detect` var xhr = new XMLHttpRequest() @@ -326,6 +327,11 @@ var imgWidth var imgHeight + if (this.selectedChip == iChip) { + this.resetView() + return + } + this.selectedChip = iChip const box = this.$refs.structure_box const img = this.$refs.image_src @@ -347,9 +353,7 @@ deleteChip ( iChip ) { f7.dialog.confirm(`${this.resultData.detections[iChip].label} is identified with ${this.resultData.detections[iChip].confidence.toFixed(1)}% confidence. Are you sure you want to delete it?`, () => { this.resultData.detections.splice(iChip, 1) - this.selectedChip = -1 - const box = this.$refs.structure_box - box.style.display = 'none' + this.resetView() }); }, getImage () { @@ -363,13 +367,16 @@ loadImage.then(() => { this.imageLoaded = true this.resultData = {} - this.selectedChip = -1 - const box = this.$refs.structure_box - box.style.display = 'none' + this.resetView() }).catch((e) => { console.log(e.message) f7.dialog.alert('Error loading image') }) + }, + resetView() { + this.selectedChip = -1 + const box = this.$refs.structure_box + box.style.display = 'none' } } }