Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Mobblestouch — W3C Touch Events and gestures
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Kornel Lesiński
October 25, 2011
Technology
2
740
Mobblestouch — W3C Touch Events and gestures
Presentation at Mr Mobbles Magical Emporium 10/2011
http://pornel.net/mobbles
Kornel Lesiński
October 25, 2011
Tweet
Share
More Decks by Kornel Lesiński
See All by Kornel Lesiński
SudWeb
kornel
0
220
Lossy PNG for true-color images (Velocity Conf EU 2014)
kornel
2
900
Modern PNG compressors
kornel
13
1.2k
Handling binary data in JS
kornel
1
410
Server-Sent Events
kornel
5
990
"HTML5" Transport Protocol
kornel
3
410
Front-end Performance
kornel
5
510
Other Decks in Technology
See All in Technology
Snowflake Night #2 LT
taromatsui_cccmkhd
0
320
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
4
22k
トップマネジメントとコンピテンシーから考えるエンジニアリングマネジメント
zigorou
3
420
マルチロールEMが実践する「組織のレジリエンス」を高めるための組織構造と人材配置戦略
coconala_engineer
2
310
OCI技術資料 : 外部接続 VPN接続 詳細
ocise
1
10k
脱・コピペ!自分で調べて書くK8sマニフェスト
devops_vtj
0
110
マネージャー版 "提案のレベル" を上げる
konifar
14
11k
OSSで構築するIT基盤管理実践事例: NetBox・Snipe-IT・FreeRADIUS+PrivacyIDEA / Practical Case Studies of IT Infrastructure Management Using OSS
nttcom
0
190
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
5
1.1k
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.1k
Serverless Agent Architecture on Azure / serverless-agent-on-azure
miyake
1
130
LY Tableauでの Tableau x AIの実践 (at Tableau Now! - 2026-02-26)
yoshitakaarakawa
0
1.2k
Featured
See All Featured
Bash Introduction
62gerente
615
210k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
A Soul's Torment
seathinner
5
2.4k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
Everyday Curiosity
cassininazir
0
150
It's Worth the Effort
3n
188
29k
We Have a Design System, Now What?
morganepeng
55
8k
The Curse of the Amulet
leimatthew05
1
9.5k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Practical Orchestrator
shlominoach
191
11k
Marketing to machines
jonoalderson
1
5k
Transcript
Mobblestouch
www.w3.org/TR/touch-events
Microsoft http://blogs.msdn.com/b/ie/archive/2011/10/19/ handling-multi-touch-and-mouse-input-in-all-browsers.aspx
mousedown = mousemove = mouseup = touchstart touchmove touchend
mouseover mouseout :hover
click
element.ontouchstart = function(event){…} element.addEventListener (‘touchstart’,…,…)
TouchEvent interface event.touches = […] event.chagedTouches = […]
TouchEvent interface event.pageX → event.touches[i].pageX event.target → event.touches[i].target event.targetTouches
Touch interface touch.pageY/touch.pageX touch.target touch.identifier
Div 1 Div 2 Div 3 mousedown mousemove mouseup
Div 1 Div 2 Div 3 touchstart touchmove touchend
Tap and… ontouchstart = function() { timer = setTimeout(hold, 1000)
} ontouchend = function() { clearTimeout(timer) if (!held) tap() } var timer; …hold!
Hold on! ontouchstart = function(e) { if (e.touches.length > 1)
return; clearTimeout(timer) timer = setTimeout(hold, 1000) e.preventDefault() }
call event.preventDefault()
body.ontouchmove = function(e) {e.preventDefault()}
:active trick body.ontouchmove = function(){}
gesturestart gestureend
1 2 Math.sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) )
Zoom moves!
Math.atan2( (x-x),(y-y) )
Math.TAU = 2*Math.PI Math.atan2(…)/Math.TAU*360+180
Beware of CSS transforms order!
Swipe Slow = peek Fast = switch
Swipe event.timestamp
Device ✌ ✌ 2.x ” 3.x ✌ ? Emulator ✌
” ” None
Alt Alt + Shift
Phantom limb vodori.com/blog/phantom-limb.html
@media all and (-moz-touch-enabled:1) {…} if (ontouchstart in window) {…}
document.body.ontouchstart = function() { touch_enabled = true; } Detection
Trackpad ≠ Multitouch MozSwipeGesture XUL only MozMousePixelScroll onscroll event.wheelDeltaX/Y
@pornelski Image credits: Flickr—Vectorportal http://www.flickr.com/photos/ vectorportal, Flickr—Peter Kaminski http://flickr.com/people/peterkaminski, Denis-Carl
http://www.deniscarl.com, Failblog.com and Dailysquee.com. Presented at: Mr Mobbles Magical Emporium 10/2011