From d18954f5491fee67317b0dca49161734618f291d Mon Sep 17 00:00:00 2001 From: Omer Date: Thu, 5 Dec 2019 15:38:30 +0200 Subject: [PATCH] Proper no target found fix, and snackbar error now showing --- .../components/OutputTab/SingleCalibration.vue | 17 +++++++++++++++-- .../src/views/CameraViewes/OutputTab.vue | 13 +++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/chameleon-client/src/components/OutputTab/SingleCalibration.vue b/chameleon-client/src/components/OutputTab/SingleCalibration.vue index c77dc8b53..eaed4c846 100644 --- a/chameleon-client/src/components/OutputTab/SingleCalibration.vue +++ b/chameleon-client/src/components/OutputTab/SingleCalibration.vue @@ -21,8 +21,21 @@ this.$emit('update'); }, takePoint() { - this.handleInput('point', this.rawPoint); - this.$emit('update'); + let hasNaN = false; + console.log(this.rawPoint); + for (let i = 0; i < this.rawPoint.length&&!hasNaN; i++) { + hasNaN = !(this.rawPoint[i]||this.rawPoint[i]===0); + } + if(!hasNaN){//if array doesnt have undefined values + console.log("sending points"); + this.handleInput('point', this.rawPoint); + this.$emit('update'); + } + else + { + console.log("sending error"); + this.$emit('snackbar'); + } } } } diff --git a/chameleon-client/src/views/CameraViewes/OutputTab.vue b/chameleon-client/src/views/CameraViewes/OutputTab.vue index f9c7f3910..28f5121d5 100644 --- a/chameleon-client/src/views/CameraViewes/OutputTab.vue +++ b/chameleon-client/src/views/CameraViewes/OutputTab.vue @@ -8,9 +8,9 @@ - + - Points are too close + {{getErrorMsg()}} Close @@ -40,6 +40,15 @@ }, doUpdate() { this.$emit('update') + }, + getErrorMsg() + { + switch (this.value.calibrationMode) { + case 1: + return "No target found"; + case 2: + return "Points are too close" + } } },