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

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

Issue 968293003: Use double rather than float (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 #!mojo mojo:sky_viewer 1 #!mojo mojo:sky_viewer
2 <sky> 2 <sky>
3 <import src="/sky/framework/debug/shake-to-reload.sky" /> 3 <import src="/sky/framework/debug/shake-to-reload.sky" />
4 <style> 4 <style>
5 dot { 5 dot {
6 position: absolute; 6 position: absolute;
7 height: 10px; 7 height: 10px;
8 width: 10px; 8 width: 10px;
9 background-color: #00FF00; 9 background-color: #00FF00;
10 border-radius: 5px; 10 border-radius: 5px;
(...skipping 29 matching lines...) Expand all
40 void goAway(event) { 40 void goAway(event) {
41 whichDot(event).remove(); 41 whichDot(event).remove();
42 } 42 }
43 43
44 void stopDots(event) { 44 void stopDots(event) {
45 for (Element e in document.querySelectorAll('dot')) 45 for (Element e in document.querySelectorAll('dot'))
46 e.remove(); 46 e.remove();
47 } 47 }
48 48
49 void runToTheCenter(event) { 49 void runToTheCenter(event) {
50 float radius = (5 + (95 * event.pressure)); 50 double radius = (5 + (95 * event.pressure));
51 Element dot = whichDot(event); 51 Element dot = whichDot(event);
52 dot.style["transform"] = "translate(${event.x-radius}px,${event.y-radius}px)"; 52 dot.style["transform"] = "translate(${event.x-radius}px,${event.y-radius}px)";
53 dot.style["width"] = "${2 * radius}px"; 53 dot.style["width"] = "${2 * radius}px";
54 dot.style["height"] = "${2 * radius}px"; 54 dot.style["height"] = "${2 * radius}px";
55 dot.style["border-radius"] = "${radius}px"; 55 dot.style["border-radius"] = "${radius}px";
56 } 56 }
57 57
58 void main() { 58 void main() {
59 document.addEventListener("pointerdown", moreDots); 59 document.addEventListener("pointerdown", moreDots);
60 document.addEventListener("pointermove", runToTheCenter); 60 document.addEventListener("pointermove", runToTheCenter);
61 document.addEventListener("pointerup", goAway); 61 document.addEventListener("pointerup", goAway);
62 document.addEventListener("pointercancel", stopDots); 62 document.addEventListener("pointercancel", stopDots);
63 } 63 }
64 </script> 64 </script>
65 </sky> 65 </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