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

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

Issue 847873003: Add support for touch events to sky_viewer (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 | « no previous file | sky/viewer/converters/input_event_types.cc » ('j') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..26c659bc2a5ddd9401ac116d76efbbb2c440668c
--- /dev/null
+++ b/sky/examples/touch-demo.sky
@@ -0,0 +1,16 @@
+<sky>
+<div id="log">Ready</div>
+<script>
+function logTouchEvent(evt) {
+ var message = "type=" + event.type;
+ if (evt.touches && evt.touches.length > 0)
+ message += " x=" + evt.touches[0].clientX + " y=" + evt.touches[0].clientY;
+ document.getElementById("log").textContent = message;
+}
+
+document.documentElement.addEventListener("touchstart", logTouchEvent);
+document.documentElement.addEventListener("touchmove", logTouchEvent);
+document.documentElement.addEventListener("touchend", logTouchEvent);
+document.documentElement.addEventListener("touchcancel", logTouchEvent);
+</script>
+</sky>
« no previous file with comments | « no previous file | sky/viewer/converters/input_event_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698