fix: Two finger panning is slow (#7849)

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
pull/8035/head
zsviczian 9 months ago committed by GitHub
parent ff0b4394b1
commit be4e127f6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5097,8 +5097,11 @@ class App extends React.Component<AppProps, AppState> {
this.translateCanvas({
zoom: zoomState.zoom,
scrollX: zoomState.scrollX + deltaX / nextZoom,
scrollY: zoomState.scrollY + deltaY / nextZoom,
// 2x multiplier is just a magic number that makes this work correctly
// on touchscreen devices (note: if we get report that panning is slower/faster
// than actual movement, consider swapping with devicePixelRatio)
scrollX: zoomState.scrollX + 2 * (deltaX / nextZoom),
scrollY: zoomState.scrollY + 2 * (deltaY / nextZoom),
shouldCacheIgnoreZoom: true,
});
});

@ -10752,7 +10752,7 @@ exports[`regression tests > pinch-to-zoom works > [end of test] appState 1`] = `
"pendingImageElementId": null,
"previousSelectedElementIds": {},
"resizingElement": null,
"scrollX": -2.916666666666668,
"scrollX": -6.2500000000000036,
"scrollY": 0,
"scrolledOutside": false,
"selectedElementIds": {},
@ -13688,8 +13688,8 @@ exports[`regression tests > two-finger scroll works > [end of test] appState 1`]
"pendingImageElementId": null,
"previousSelectedElementIds": {},
"resizingElement": null,
"scrollX": 10,
"scrollY": -10,
"scrollX": 20,
"scrollY": -18.535533905932738,
"scrolledOutside": false,
"selectedElementIds": {},
"selectedElementsAreBeingDragged": false,

Loading…
Cancel
Save