Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: sky/examples/touch-demo.sky

Issue 868133003: Remove touch events from Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/web/WebViewImpl.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/touch-demo.sky
diff --git a/sky/examples/touch-demo.sky b/sky/examples/touch-demo.sky
index 469fc5eed047c6ed9efdf84c80bc0907db40f4a9..2ac13954188d326271ab417657b77148fd367cfb 100644
--- a/sky/examples/touch-demo.sky
+++ b/sky/examples/touch-demo.sky
@@ -15,22 +15,20 @@ dot {
var dot = document.querySelector("dot");
var log = document.querySelector("log");
-function logTouchEvent(evt) {
+function logPointerEvent(evt) {
var message = "type=" + event.type;
- if (evt.touches && evt.touches.length > 0) {
- var x = evt.touches[0].clientX.toFixed(2);
- var y = evt.touches[0].clientY.toFixed(2);
- message += " x=" + x + " y=" + y;
+ var x = evt.x.toFixed(2);
+ var y = evt.y.toFixed(2);
+ message += " x=" + x + " y=" + y;
- var transform = "translate(" + (x - 50) + "px," + (y - 50) + "px)";
- dot.style.transform = transform;
- }
+ var transform = "translate(" + (x - 50) + "px," + (y - 50) + "px)";
+ dot.style.transform = transform;
log.textContent = message;
}
-document.documentElement.addEventListener("touchstart", logTouchEvent);
-document.documentElement.addEventListener("touchmove", logTouchEvent);
-document.documentElement.addEventListener("touchend", logTouchEvent);
-document.documentElement.addEventListener("touchcancel", logTouchEvent);
+document.documentElement.addEventListener("pointerdown", logPointerEvent);
+document.documentElement.addEventListener("pointermove", logPointerEvent);
+document.documentElement.addEventListener("pointerup", logPointerEvent);
+document.documentElement.addEventListener("pointercancel", logPointerEvent);
</script>
</sky>
« no previous file with comments | « sky/engine/web/WebViewImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698