|
@@ -47,13 +47,10 @@ function Control(el, { value = 0,
|
|
}
|
|
}
|
|
|
|
|
|
img.onclick = e => {
|
|
img.onclick = e => {
|
|
- console.log(e, img.width)
|
|
|
|
-
|
|
|
|
const { layerX } = e
|
|
const { layerX } = e
|
|
const { width } = img
|
|
const { width } = img
|
|
|
|
|
|
layerX > width / 2? this.setValue(value + step) : this.setValue(value - step)
|
|
layerX > width / 2? this.setValue(value + step) : this.setValue(value - step)
|
|
- console.log(value)
|
|
|
|
}
|
|
}
|
|
|
|
|
|
const toDeg = rad => ((rad * 180) / Math.PI + 360 + 90) % 360
|
|
const toDeg = rad => ((rad * 180) / Math.PI + 360 + 90) % 360
|
|
@@ -69,7 +66,6 @@ function Control(el, { value = 0,
|
|
|
|
|
|
img.onmousemove = e => {
|
|
img.onmousemove = e => {
|
|
if (prevMouseAngle === null) return
|
|
if (prevMouseAngle === null) return
|
|
- console.log(value)
|
|
|
|
const y = e.layerY - img.height / 2
|
|
const y = e.layerY - img.height / 2
|
|
const x = e.layerX - img.width / 2
|
|
const x = e.layerX - img.width / 2
|
|
let currentAngle = toDeg(Math.atan2(y, x))
|
|
let currentAngle = toDeg(Math.atan2(y, x))
|