Fixed knob issue
parent
fbb0131b7e
commit
4523417309
|
@ -48,7 +48,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateValue(offsetX, offsetY) {
|
updateValueByOffset(offsetX, offsetY) {
|
||||||
let dx = offsetX - this.size / 2;
|
let dx = offsetX - this.size / 2;
|
||||||
let dy = this.size / 2 - offsetY;
|
let dy = this.size / 2 - offsetY;
|
||||||
let angle = Math.atan2(dy, dx);
|
let angle = Math.atan2(dy, dx);
|
||||||
|
@ -78,7 +78,7 @@ export default {
|
||||||
},
|
},
|
||||||
onClick(event) {
|
onClick(event) {
|
||||||
if (!this.disabled && !this.readonly) {
|
if (!this.disabled && !this.readonly) {
|
||||||
this.updateValue(event.offsetX, event.offsetY);
|
this.updateValueByOffset(event.offsetX, event.offsetY);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onBlur(event) {
|
onBlur(event) {
|
||||||
|
@ -114,7 +114,7 @@ export default {
|
||||||
},
|
},
|
||||||
onMouseMove(event) {
|
onMouseMove(event) {
|
||||||
if (!this.disabled && !this.readonly) {
|
if (!this.disabled && !this.readonly) {
|
||||||
this.updateValue(event.offsetX, event.offsetY);
|
this.updateValueByOffset(event.offsetX, event.offsetY);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -125,7 +125,7 @@ export default {
|
||||||
const offsetX = touch.clientX - rect.left;
|
const offsetX = touch.clientX - rect.left;
|
||||||
const offsetY = touch.clientY - rect.top;
|
const offsetY = touch.clientY - rect.top;
|
||||||
|
|
||||||
this.updateValue(offsetX, offsetY);
|
this.updateValueByOffset(offsetX, offsetY);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onKeyDown(event) {
|
onKeyDown(event) {
|
||||||
|
|
Loading…
Reference in New Issue