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

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

Issue 970493003: Add support for pressure on pointer events (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
Index: sky/examples/touch-demo.sky
diff --git a/sky/examples/touch-demo.sky b/sky/examples/touch-demo.sky
index bd40642a165a4f2e6b89f22ec1daefab92466991..7644d0c403b4c6b9acae67d86b90ac0ab9ca056d 100644
--- a/sky/examples/touch-demo.sky
+++ b/sky/examples/touch-demo.sky
@@ -4,10 +4,11 @@
<style>
dot {
position: absolute;
- height: 100px;
- width: 100px;
+ height: 10px;
+ width: 10px;
background-color: #00FF00;
- border-radius: 50px;
+ border-radius: 5px;
+ opacity: .75;
}
</style>
<log>Ready!</log>
@@ -46,8 +47,12 @@ void stopDots(event) {
}
void runToTheCenter(event) {
- whichDot(event).style["transform"] =
- "translate(${event.x-50}px,${event.y-50}px)";
+ float 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() {
« no previous file with comments | « no previous file | sky/shell/org/domokit/sky/shell/PlatformView.java » ('j') | sky/shell/org/domokit/sky/shell/PlatformView.java » ('J')

Powered by Google App Engine
This is Rietveld 408576698