| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…ler to allow use in touch story example
…made it so mousemove/pointermove events are ignored when there's multitouch and addMouseWheelListener enabled
| const getTouchDistance = (touches: TouchArray) => { | ||
| const a = touches[0].clientX - touches[1].clientX; | ||
| const b = touches[0].clientY - touches[1].clientY; | ||
| return Math.sqrt(a * a + b * b); |
There was a problem hiding this comment.
suggestion: use Math.hypot instead (perform the same calculation)
Sorry, something went wrong.
|
|
||
| InternalEvent.addListener(target, 'gesturechange', ((evt: GestureEvent) => { | ||
| InternalEvent.consume(evt); | ||
| const getTouchDistance = (touches: TouchArray) => { |
There was a problem hiding this comment.
suggestion: move this closure out of the enclosing function as it doesn't depend on any state provided by this function
Sorry, something went wrong.
|
|
||
| if (typeof evt.scale === 'number') { | ||
| const diff = scale - evt.scale; | ||
| const touchesToArray = (touches: TouchList): TouchArray => { |
There was a problem hiding this comment.
suggestion: move this closure out of the enclosing function as getTouchDistance.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Fixes jumpy multitouch zooming on Android, and restores the touch example by converting it to StoryBook and ES6 classes.
More details/caveats of this PR are in the comment at #62 (comment).
Description for the changelog
Resolves #62.