FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

New pinch touch zoom [draft] by mcyph · Pull Request #149 · maxGraph/maxGraph · GitHub

forked from jgraph/mxgraph

New pinch touch zoom [draft] - #149

Draft
mcyph wants to merge 14 commits into
maxGraph:mainfrom
mcyph:new-pinch-touch-zoom
Draft

New pinch touch zoom [draft]#149
mcyph wants to merge 14 commits into
maxGraph:mainfrom
mcyph:new-pinch-touch-zoom

Conversation

mcyph commented Nov 30, 2022
edited
Loading

Copy link
Copy Markdown

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.

mcyph marked this pull request as draft December 5, 2022 10:47
mcyph requested a review from csouchet December 5, 2022 10:58
tbouffard added the enhancement New feature or request label Dec 3, 2023
tbouffard changed the base branch from development to main February 15, 2024 09:17
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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

suggestion: use Math.hypot instead (perform the same calculation)


InternalEvent.addListener(target, 'gesturechange', ((evt: GestureEvent) => {
InternalEvent.consume(evt);
const getTouchDistance = (touches: TouchArray) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

suggestion: move this closure out of the enclosing function as it doesn't depend on any state provided by this function


if (typeof evt.scale === 'number') {
const diff = scale - evt.scale;
const touchesToArray = (touches: TouchList): TouchArray => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

suggestion: move this closure out of the enclosing function as getTouchDistance.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pinch zoom not working

2 participants


Back | FazBrowse Home | New Git URL