Commit 106c5322 authored by Adam Barth's avatar Adam Barth

Remove touch events from Sky

We use pointer events instead.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/868133003
parent 0b73de95
...@@ -15,22 +15,20 @@ dot { ...@@ -15,22 +15,20 @@ dot {
var dot = document.querySelector("dot"); var dot = document.querySelector("dot");
var log = document.querySelector("log"); var log = document.querySelector("log");
function logTouchEvent(evt) { function logPointerEvent(evt) {
var message = "type=" + event.type; var message = "type=" + event.type;
if (evt.touches && evt.touches.length > 0) { var x = evt.x.toFixed(2);
var x = evt.touches[0].clientX.toFixed(2); var y = evt.y.toFixed(2);
var y = evt.touches[0].clientY.toFixed(2); message += " x=" + x + " y=" + y;
message += " x=" + x + " y=" + y;
var transform = "translate(" + (x - 50) + "px," + (y - 50) + "px)"; var transform = "translate(" + (x - 50) + "px," + (y - 50) + "px)";
dot.style.transform = transform; dot.style.transform = transform;
}
log.textContent = message; log.textContent = message;
} }
document.documentElement.addEventListener("touchstart", logTouchEvent); document.documentElement.addEventListener("pointerdown", logPointerEvent);
document.documentElement.addEventListener("touchmove", logTouchEvent); document.documentElement.addEventListener("pointermove", logPointerEvent);
document.documentElement.addEventListener("touchend", logTouchEvent); document.documentElement.addEventListener("pointerup", logPointerEvent);
document.documentElement.addEventListener("touchcancel", logTouchEvent); document.documentElement.addEventListener("pointercancel", logPointerEvent);
</script> </script>
</sky> </sky>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment