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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kornel Lesiński
October 25, 2011
Technology
740
2
Share
Mobblestouch — W3C Touch Events and gestures
Presentation at Mr Mobbles Magical Emporium 10/2011
http://pornel.net/mobbles
Kornel Lesiński
October 25, 2011
More Decks by Kornel Lesiński
See All by Kornel Lesiński
SudWeb
kornel
0
230
Lossy PNG for true-color images (Velocity Conf EU 2014)
kornel
2
910
Modern PNG compressors
kornel
13
1.2k
Handling binary data in JS
kornel
1
410
Server-Sent Events
kornel
5
1k
"HTML5" Transport Protocol
kornel
3
410
Front-end Performance
kornel
5
510
Other Decks in Technology
See All in Technology
自分をひらくと次のチャレンジの敷居が下がる
sudoakiy
5
1.8k
"まず試す"ためのDatabricks Apps活用法 / Databricks Apps for Early Experiments and Validation
nttcom
1
170
すごいぞManaged Kubernetes
harukasakihara
1
330
第26回FA設備技術勉強会 - Claude/Claude_codeでデータ分析 -
happysamurai294
0
390
マルチモーダル非構造データとの闘い
shibuiwilliam
1
180
ハーネスエンジニアリング×AI適応開発
aictokamiya
3
1.5k
Network Firewall Proxyで 自前プロキシを消し去ることができるのか
gusandayo
0
190
AI前提とはどういうことか
daisuketakeda
0
100
サイボウズ 開発本部採用ピッチ / Cybozu Engineer Recruit
cybozuinsideout
PRO
10
77k
JSTQB Expert Levelシラバス「テストマネジメント」日本語版のご紹介
ymty
0
130
チームで育てるAI自走環境_20260409
fuktig
0
740
Microsoft Fabricで考える非構造データのAI活用
ryomaru0825
0
650
Featured
See All Featured
The agentic SEO stack - context over prompts
schlessera
0
730
Statistics for Hackers
jakevdp
799
230k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
500
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
180
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Un-Boring Meetings
codingconduct
0
250
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
340
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
120
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Marketing to machines
jonoalderson
1
5.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
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