Mobile Click for Rotating Wheel?
Hello,
I have been trying to get a rotating wheel to work as a decoder wheel on both a PC browser and mobile device. It simply involves the user clicking the on a wheel and rotating it to show a decoded letter from a provided code.
It works within desktop, but whenever we try to get it in mobile, it doesn't work.
Currently I have:
var shape = this.top;
var mouseMove = function () {
var rads = Math.atan2(stage.mouseY - shape.y, stage.mouseX - shape.x);
var angle = rads * (180 / Math.PI) - offset;
shape.rotation = angle;
console.log("angle: " + angle);
};
var offset = 0;
stage.addEventListener("stagemousedown", function () {
stage.addEventListener("stagemousemove", mouseMove);
// Determine initial offset, and take off shape rotation
var rads = Math.atan2(stage.mouseY - shape.y, stage.mouseX - shape.x);
offset = rads * (180 / Math.PI) - shape.rotation;
mouseMove();
});
stage.addEventListener("stagemouseup", function () {
stage.removeEventListener("stagemousemove", mouseMove);
});
