File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
src/renderers/RealDrawBoard Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,24 @@ export function _getMouseCoords(
1212
1313 return [ x , y ] ; // In graph coordinates
1414}
15+
16+ export function _getTouchCoords (
17+ this : RealDrawBoard ,
18+ e : TouchEvent
19+ ) : [ number , number ] [ ] {
20+ let allCoords : [ number , number ] [ ] = [ ] ;
21+
22+ for ( let i = 0 ; i < e . touches . length ; i ++ ) {
23+ const touch = e . touches . item ( i ) ;
24+
25+ let x = touch . clientX - this . canvas . getBoundingClientRect ( ) . left ;
26+ let y = this . dimensions [ 1 ] - ( touch . clientY - this . canvas . getBoundingClientRect ( ) . top ) ;
27+
28+ x = x / this . xScaleFactor - ( this . dimensions [ 0 ] * ( this . yOffset / 100 ) ) / this . xScaleFactor ;
29+ y = y / this . yScaleFactor - ( this . dimensions [ 1 ] * ( this . xOffset / 100 ) ) / this . yScaleFactor ;
30+
31+ allCoords . push ( [ x , y ] ) ;
32+ }
33+
34+ return allCoords ;
35+ }
You can’t perform that action at this time.
0 commit comments