From b9c8e710960b2f77c920e1d9c3ee863f1c465f5d Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Mon, 2 Mar 2015 12:38:29 -0800 Subject: [PATCH] Add support for pressure on pointer events The touch demo needs some basic smoothing, right now it looks rather jittery after this change. But the pressure code is definitely working! R=abarth@chromium.org BUG= Review URL: https://codereview.chromium.org/970493003 --- examples/touch-demo.sky | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/examples/touch-demo.sky b/examples/touch-demo.sky index bd40642a16..7644d0c403 100644 --- a/examples/touch-demo.sky +++ b/examples/touch-demo.sky @@ -4,10 +4,11 @@ Ready! @@ -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() {