@@ -9,41 +9,17 @@ function addData(p5, fn){
9
9
return this . mouseDragged ( ...args ) ;
10
10
} ;
11
11
p5 . Element . prototype . touchStarted = function ( cb ) {
12
- if ( cb === false ) {
13
- return this . mousePressed ( false ) ;
14
- }
15
- return this . mousePressed ( function ( event ) {
16
- if ( this . _hasTouchMoveHandler ) {
17
- this . _pointers = this . _pointers || { } ;
18
- this . _pointers [ event . pointerId ] = true ;
19
- }
20
- event . target . setPointerCapture ( event . pointerId ) ;
21
- return cb ( event ) ;
22
- } ) ;
12
+ return this . mousePressed ( cb ) ;
23
13
} ;
24
14
p5 . Element . prototype . touchEnded = function ( cb ) {
25
- if ( cb === false ) {
26
- return this . mouseReleased ( false ) ;
27
- }
28
- return this . mouseReleased ( function ( event ) {
29
- if ( this . _hasTouchMoveHandler ) {
30
- this . _pointers = this . _pointers || { } ;
31
- if ( this . _pointers [ event . pointerId ] ) {
32
- event . target . releasePointerCapture ( event . pointerId ) ;
33
- delete this . _pointers [ event . pointerId ] ;
34
- }
35
- }
36
- return cb ( event ) ;
37
- } ) ;
15
+ return this . mouseReleased ( cb ) ;
38
16
} ;
39
17
p5 . Element . prototype . touchMoved = function ( cb ) {
40
18
if ( cb === false ) {
41
- this . _hasTouchMoveHandler = false ;
42
19
return this . mouseMoved ( false ) ;
43
20
}
44
- this . _hasTouchMoveHandler = true ;
45
21
return this . mouseMoved ( function ( event ) {
46
- if ( Object . keys ( this . _pointers || { } ) . length > 0 ) {
22
+ if ( ( event . buttons & 1 ) !== 0 ) {
47
23
return cb ( event ) ;
48
24
}
49
25
} ) ;
0 commit comments