From 8efd0a2b497c2ebc7dc4ccbbe88dfa51b334995c Mon Sep 17 00:00:00 2001 From: ori agranat Date: Tue, 3 Dec 2019 19:52:31 +0200 Subject: [PATCH] bug fix for color picker --- chameleon-client/src/plugins/ColorPicker.js | 2 +- .../src/views/CameraViewes/ThresholdTab.vue | 36 ++++++++++--------- ...meleon-server.iml => chameleon-vision.iml} | 14 -------- 3 files changed, 20 insertions(+), 32 deletions(-) rename chameleon-server/{chameleon-server.iml => chameleon-vision.iml} (79%) diff --git a/chameleon-client/src/plugins/ColorPicker.js b/chameleon-client/src/plugins/ColorPicker.js index bba09292a..a5d22254e 100644 --- a/chameleon-client/src/plugins/ColorPicker.js +++ b/chameleon-client/src/plugins/ColorPicker.js @@ -28,7 +28,7 @@ function colorPickerClick(event, currentFunction, currentRange) { function eyeDrop(pixel) { let hsv = RGBtoHSV(pixel); - range = widenRange([hsv,hsv.slice(0)]);//sends hsv and a copy of hsv + let range = widenRange([hsv,hsv.slice(0)]);//sends hsv and a copy of hsv return range } diff --git a/chameleon-client/src/views/CameraViewes/ThresholdTab.vue b/chameleon-client/src/views/CameraViewes/ThresholdTab.vue index 9ecc534c8..f112da5e4 100644 --- a/chameleon-client/src/views/CameraViewes/ThresholdTab.vue +++ b/chameleon-client/src/views/CameraViewes/ThresholdTab.vue @@ -58,21 +58,23 @@ }, methods: { onClick(event) { - let hsvArray = this.colorPicker.colorPickerClick(event, this.currentFunction, - [[this.value.hue[0], this.value.saturation[0], this.value.value[0]], [this.value.hue[1], this.value.saturation[1], this.value.value[1]]]); - this.currentFunction = undefined; - this.value.hue = [hsvArray[0][0], hsvArray[1][0]]; - this.value.saturation = [hsvArray[0][1], hsvArray[1][1]]; - this.value.value = [hsvArray[0][2], hsvArray[1][2]]; - this.value.isBinary = this.currentBinaryState; - let msg = this.$msgPack.encode({ - 'hue': this.value.hue, - 'saturation': this.value.saturation, - 'value': this.value.value, - 'isBinary': this.value.isBinary - }); - this.$socket.send(msg); - this.$emit('update'); + if (this.currentFunction !== undefined) { + let hsvArray = this.colorPicker.colorPickerClick(event, this.currentFunction, + [[this.value.hue[0], this.value.saturation[0], this.value.value[0]], [this.value.hue[1], this.value.saturation[1], this.value.value[1]]]); + this.currentFunction = undefined; + this.value.hue = [hsvArray[0][0], hsvArray[1][0]]; + this.value.saturation = [hsvArray[0][1], hsvArray[1][1]]; + this.value.value = [hsvArray[0][2], hsvArray[1][2]]; + this.value.isBinary = this.currentBinaryState; + let msg = this.$msgPack.encode({ + 'hue': this.value.hue, + 'saturation': this.value.saturation, + 'value': this.value.value, + 'isBinary': this.value.isBinary + }); + this.$socket.send(msg); + this.$emit('update'); + } }, setFunction(index) { this.currentBinaryState = this.value.isBinary; @@ -103,9 +105,9 @@ mounted: function () { const self = this; this.colorPicker = require('../../plugins/ColorPicker').default; - window.addEventListener('load', function () { + this.$nextTick(() => { self.colorPicker.initColorPicker(); - }) + }); } } diff --git a/chameleon-server/chameleon-server.iml b/chameleon-server/chameleon-vision.iml similarity index 79% rename from chameleon-server/chameleon-server.iml rename to chameleon-server/chameleon-vision.iml index f0b619951..a3c362a46 100644 --- a/chameleon-server/chameleon-server.iml +++ b/chameleon-server/chameleon-vision.iml @@ -11,20 +11,6 @@ - - - - - - - - - - - - - -