From 8c9b134323c6021f03f2a1aa586205d8ab5efbd9 Mon Sep 17 00:00:00 2001 From: Justin Georgi Date: Thu, 7 Dec 2023 21:06:33 -0700 Subject: [PATCH] Add small features to detect page Signed-off-by: Justin Georgi --- 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' } } } -- 2.49.1