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) { function eyeDrop(pixel) {
let hsv = RGBtoHSV(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 return range
} }

View File

@@ -58,21 +58,23 @@
}, },
methods: { methods: {
onClick(event) { onClick(event) {
let hsvArray = this.colorPicker.colorPickerClick(event, this.currentFunction, if (this.currentFunction !== undefined) {
[[this.value.hue[0], this.value.saturation[0], this.value.value[0]], [this.value.hue[1], this.value.saturation[1], this.value.value[1]]]); let hsvArray = this.colorPicker.colorPickerClick(event, this.currentFunction,
this.currentFunction = undefined; [[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.value.hue = [hsvArray[0][0], hsvArray[1][0]]; this.currentFunction = undefined;
this.value.saturation = [hsvArray[0][1], hsvArray[1][1]]; this.value.hue = [hsvArray[0][0], hsvArray[1][0]];
this.value.value = [hsvArray[0][2], hsvArray[1][2]]; this.value.saturation = [hsvArray[0][1], hsvArray[1][1]];
this.value.isBinary = this.currentBinaryState; this.value.value = [hsvArray[0][2], hsvArray[1][2]];
let msg = this.$msgPack.encode({ this.value.isBinary = this.currentBinaryState;
'hue': this.value.hue, let msg = this.$msgPack.encode({
'saturation': this.value.saturation, 'hue': this.value.hue,
'value': this.value.value, 'saturation': this.value.saturation,
'isBinary': this.value.isBinary 'value': this.value.value,
}); 'isBinary': this.value.isBinary
this.$socket.send(msg); });
this.$emit('update'); this.$socket.send(msg);
this.$emit('update');
}
}, },
setFunction(index) { setFunction(index) {
this.currentBinaryState = this.value.isBinary; this.currentBinaryState = this.value.isBinary;
@@ -103,9 +105,9 @@
mounted: function () { mounted: function () {
const self = this; const self = this;
this.colorPicker = require('../../plugins/ColorPicker').default; this.colorPicker = require('../../plugins/ColorPicker').default;
window.addEventListener('load', function () { this.$nextTick(() => {
self.colorPicker.initColorPicker(); self.colorPicker.initColorPicker();
}) });
} }
} }

View File

@@ -11,20 +11,6 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: edu.wpi.first.cscore:cscore-java:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.cscore:cscore-jni:linuxaarch64bionic:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.cscore:cscore-jni:linuxraspbian:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.cscore:cscore-jni:linuxx86-64:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.cscore:cscore-jni:osxx86-64:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.cscore:cscore-jni:windowsx86-64:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.cameraserver:cameraserver-java:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.ntcore:ntcore-java:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.ntcore:ntcore-jni:osxx86-64:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.ntcore:ntcore-jni:linuxraspbian:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.ntcore:ntcore-jni:linuxx86-64:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.ntcore:ntcore-jni:linuxaarch64bionic:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.ntcore:ntcore-jni:windowsx86-64:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: edu.wpi.first.wpiutil:wpiutil-java:2020.1.1-beta-3-12-gb8c1024" level="project" />
<orderEntry type="library" name="Maven: io.javalin:javalin:3.4.1" level="project" /> <orderEntry type="library" name="Maven: io.javalin:javalin:3.4.1" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31" level="project" /> <orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.3.31" level="project" /> <orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.3.31" level="project" />