diff options
| author | Michele Bini <michele.bini@gmail.com> | 2014-12-15 06:46:31 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2014-12-15 06:49:02 (GMT) |
| commit | 580c8218dc01c3322d6148c95151b61cfbc42bff (patch) | |
| tree | 39db5ccf0dfb2669c5703d05baccc284c063bb44 /SunkenMoon.html.coffee | |
| parent | 0780cdc1a720381f9c5a843c979271a88d8f42c1 (diff) | |
touch input improvement
Diffstat (limited to 'SunkenMoon.html.coffee')
| -rw-r--r-- | SunkenMoon.html.coffee | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/SunkenMoon.html.coffee b/SunkenMoon.html.coffee index f456348..bfd5578 100644 --- a/SunkenMoon.html.coffee +++ b/SunkenMoon.html.coffee @@ -4,7 +4,7 @@ # This program is available under the terms of the MIT License -version = "0.2.209" +version = "0.2.211" { htmlcup } = require 'htmlcup' @@ -529,13 +529,18 @@ genPage = -> py: pageY move: (ev,el)@> { ongoing } = @ + { tx, ty } = @ for t in ev.changedTouches { identifier, pageX, pageY } = t o = ongoing[identifier] - @tx += pageX - o.px - @ty += pageY - o.py + dx = pageX - o.px + dy = pageY - o.py + tx * dx > 0 then tx += dx else tx = dx + ty * dy > 0 then ty += dy else ty = dy o.px = pageX o.py = pageY + @tx = tx + @ty = ty end: (ev,el)@> { ongoing } = @ for t in ev.changedTouches |
