diff options
| author | Stanley Yip <stanley_yip@brown.edu> | 2020-01-07 14:49:27 -0500 |
|---|---|---|
| committer | Stanley Yip <stanley_yip@brown.edu> | 2020-01-07 14:49:27 -0500 |
| commit | d16636a8246dadb486476fe98da63fc0db4d36dc (patch) | |
| tree | 6a1b449336311d4f75b6957387aec1233749accf /src/client/views/Touchable.tsx | |
| parent | 4ead7eccb8ed9dd5708384315f8c5454b9725106 (diff) | |
resizing works, the math is just wrong looool
Diffstat (limited to 'src/client/views/Touchable.tsx')
| -rw-r--r-- | src/client/views/Touchable.tsx | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/client/views/Touchable.tsx b/src/client/views/Touchable.tsx index a647dec04..7b0581376 100644 --- a/src/client/views/Touchable.tsx +++ b/src/client/views/Touchable.tsx @@ -26,7 +26,6 @@ export abstract class Touchable<T = {}> extends React.Component<T> { } if (this.prevPoints.size) { - console.log(e.targetTouches.length); switch (this.prevPoints.size) { case 1: this.handle1PointerDown(e); @@ -35,11 +34,6 @@ export abstract class Touchable<T = {}> extends React.Component<T> { this.handle2PointersDown(e); break; } - - document.removeEventListener("touchmove", this.onTouch); - document.addEventListener("touchmove", this.onTouch); - document.removeEventListener("touchend", this.onTouchEnd); - document.addEventListener("touchend", this.onTouchEnd); } } @@ -110,6 +104,17 @@ export abstract class Touchable<T = {}> extends React.Component<T> { e.preventDefault(); } - handle1PointerDown = (e: React.TouchEvent): any => { }; - handle2PointersDown = (e: React.TouchEvent): any => { }; + handle1PointerDown = (e: React.TouchEvent): any => { + document.removeEventListener("touchmove", this.onTouch); + document.addEventListener("touchmove", this.onTouch); + document.removeEventListener("touchend", this.onTouchEnd); + document.addEventListener("touchend", this.onTouchEnd); + } + + handle2PointersDown = (e: React.TouchEvent): any => { + document.removeEventListener("touchmove", this.onTouch); + document.addEventListener("touchmove", this.onTouch); + document.removeEventListener("touchend", this.onTouchEnd); + document.addEventListener("touchend", this.onTouchEnd); + } }
\ No newline at end of file |
