Proper no target found fix, and snackbar error now showing

This commit is contained in:
Omer
2019-12-05 15:38:30 +02:00
parent 9300273811
commit d18954f549
2 changed files with 26 additions and 4 deletions

View File

@@ -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');
}
}
}
}

View File

@@ -8,9 +8,9 @@
<v-divider dark color="white"/>
<CVselect name="Calibration Mode" v-model="value.calibrationMode" :list="['None','Single point','Dual point']"
@input="handleData('calibrationMode')"/>
<component :raw-point="rawPoint" :is="selectedComponent" @update="doUpdate"/>
<component :raw-point="rawPoint" :is="selectedComponent" @update="doUpdate" @snackbar="snackbar=true"/>
<v-snackbar :timeout="3000" v-model="snackbar" top color="error">
<span style="color:#000">Points are too close</span>
<span style="color:#000">{{getErrorMsg()}}</span>
<v-btn color="black" text @click="snackbar = false">Close</v-btn>
</v-snackbar>
</div>
@@ -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"
}
}
},