bug fix for color picker

This commit is contained in:
ori agranat
2019-12-03 19:52:31 +02:00
parent 9adde234b8
commit 8efd0a2b49
3 changed files with 20 additions and 32 deletions

View File

@@ -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
}

View File

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