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

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

Issue 1005393006: Clean up examples directory (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/examples/stocks/pubspec.yaml ('k') | sky/examples/widgets-fn/main.sky » ('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
deleted file mode 100644
index 43f99d2d413fbc224b44ae3723d80b352ec6a2da..0000000000000000000000000000000000000000
--- a/sky/examples/touch-demo.sky
+++ /dev/null
@@ -1,65 +0,0 @@
-#!mojo mojo:sky_viewer
-<sky>
-<import src="/sky/framework/debug/shake-to-reload.sky" />
-<style>
-dot {
- position: absolute;
- height: 10px;
- width: 10px;
- background-color: #00FF00;
- border-radius: 5px;
- opacity: .75;
-}
-</style>
-<log>Ready!</log>
-<script>
-import "dart:sky";
-
-// Material design colors. :p
-List<String> colors = [
- "#009688",
- "#FFC107",
- "#9C27B0",
- "#03A9F4",
- "#673AB7",
- "#CDDC39",
-];
-
-Element whichDot(event) {
- return document.querySelector('dot[id="${event.pointer}"]');
-}
-
-void moreDots(event) {
- Element dot = document.createElement('dot');
- dot.setAttribute('id', "${event.pointer}");
- dot.style['background-color'] = colors[event.pointer.remainder(colors.length)];
- document.querySelector('sky').appendChild(dot);
- runToTheCenter(event);
-}
-
-void goAway(event) {
- whichDot(event).remove();
-}
-
-void stopDots(event) {
- for (Element e in document.querySelectorAll('dot'))
- e.remove();
-}
-
-void runToTheCenter(event) {
- double radius = (5 + (95 * event.pressure));
- Element dot = whichDot(event);
- dot.style["transform"] = "translate(${event.x-radius}px,${event.y-radius}px)";
- dot.style["width"] = "${2 * radius}px";
- dot.style["height"] = "${2 * radius}px";
- dot.style["border-radius"] = "${radius}px";
-}
-
-void main() {
- document.addEventListener("pointerdown", moreDots);
- document.addEventListener("pointermove", runToTheCenter);
- document.addEventListener("pointerup", goAway);
- document.addEventListener("pointercancel", stopDots);
-}
-</script>
-</sky>
« no previous file with comments | « sky/examples/stocks/pubspec.yaml ('k') | sky/examples/widgets-fn/main.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698