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

Side by Side Diff: sky/examples/touch-demo.sky

Issue 813133010: Fix fips-counter in touch-demo.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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <sky> 1 <sky>
2 <import src="fps-counter.sky" /> 2 <import src="fps-counter.sky" />
3 <style> 3 <style>
4 dot { 4 dot {
5 position: absolute; 5 position: absolute;
6 height: 100px; 6 height: 100px;
7 width: 100px; 7 width: 100px;
8 background-color: #00FF00; 8 background-color: #00FF00;
9 } 9 }
10 </style> 10 </style>
11 <dot /> 11 <dot />
12 <log>Ready</log> 12 <log>Ready</log>
13 <x-fps-counter /> 13 <fps-counter />
14 <script> 14 <script>
15 var dot = document.querySelector("dot"); 15 var dot = document.querySelector("dot");
16 var log = document.querySelector("log"); 16 var log = document.querySelector("log");
17 17
18 function logTouchEvent(evt) { 18 function logTouchEvent(evt) {
19 var message = "type=" + event.type; 19 var message = "type=" + event.type;
20 if (evt.touches && evt.touches.length > 0) { 20 if (evt.touches && evt.touches.length > 0) {
21 var x = evt.touches[0].clientX.toFixed(2); 21 var x = evt.touches[0].clientX.toFixed(2);
22 var y = evt.touches[0].clientY.toFixed(2); 22 var y = evt.touches[0].clientY.toFixed(2);
23 message += " x=" + x + " y=" + y; 23 message += " x=" + x + " y=" + y;
24 24
25 var transform = "translate(" + (x - 50) + "px," + (y - 50) + "px)"; 25 var transform = "translate(" + (x - 50) + "px," + (y - 50) + "px)";
26 dot.style.transform = transform; 26 dot.style.transform = transform;
27 } 27 }
28 log.textContent = message; 28 log.textContent = message;
29 } 29 }
30 30
31 document.documentElement.addEventListener("touchstart", logTouchEvent); 31 document.documentElement.addEventListener("touchstart", logTouchEvent);
32 document.documentElement.addEventListener("touchmove", logTouchEvent); 32 document.documentElement.addEventListener("touchmove", logTouchEvent);
33 document.documentElement.addEventListener("touchend", logTouchEvent); 33 document.documentElement.addEventListener("touchend", logTouchEvent);
34 document.documentElement.addEventListener("touchcancel", logTouchEvent); 34 document.documentElement.addEventListener("touchcancel", logTouchEvent);
35 </script> 35 </script>
36 </sky> 36 </sky>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698