mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Merge pull request #501 from immense/jaredg-scroll-touch-refinements
Scroll touch refinement.
This commit is contained in:
commit
db11194254
@ -286,8 +286,17 @@ export function ApplyInputHandlers() {
|
||||
if (e.touches.length == 2) {
|
||||
let touchMove1 = lastScrollTouchY1 - e.touches[0].pageY;
|
||||
let touchMove2 = lastScrollTouchY2 - e.touches[1].pageY;
|
||||
if (!isPinchZooming && (touchMove1 * touchMove2 > 0 || isScrolling)) {
|
||||
if (!isPinchZooming && (isScrolling || touchMove1 * touchMove2 > 0)) {
|
||||
// Both touch points are moving in the same direction. We're doing a scroll.
|
||||
if (!isScrolling) {
|
||||
// If this is the start of scrolling, move the mouse to our touch point so
|
||||
// the scroll wheel action will target the intended element on screen.
|
||||
var screenViewerLeft = viewer.getBoundingClientRect().left;
|
||||
var screenViewerTop = viewer.getBoundingClientRect().top;
|
||||
var pagePercentX = (e.touches[0].pageX - screenViewerLeft) / viewer.clientWidth;
|
||||
var pagePercentY = (e.touches[0].pageY - screenViewerTop) / viewer.clientHeight;
|
||||
ViewerApp.MessageSender.SendMouseMove(pagePercentX, pagePercentY);
|
||||
}
|
||||
isScrolling = true;
|
||||
if (Date.now() - lastScrollTime < 100) {
|
||||
return;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -357,8 +357,19 @@ export function ApplyInputHandlers() {
|
||||
let touchMove1 = lastScrollTouchY1 - e.touches[0].pageY;
|
||||
let touchMove2 = lastScrollTouchY2 - e.touches[1].pageY;
|
||||
|
||||
if (!isPinchZooming && (touchMove1 * touchMove2 > 0 || isScrolling)) {
|
||||
if (!isPinchZooming && (isScrolling || touchMove1 * touchMove2 > 0)) {
|
||||
// Both touch points are moving in the same direction. We're doing a scroll.
|
||||
|
||||
if (!isScrolling) {
|
||||
// If this is the start of scrolling, move the mouse to our touch point so
|
||||
// the scroll wheel action will target the intended element on screen.
|
||||
var screenViewerLeft = viewer.getBoundingClientRect().left;
|
||||
var screenViewerTop = viewer.getBoundingClientRect().top;
|
||||
var pagePercentX = (e.touches[0].pageX - screenViewerLeft) / viewer.clientWidth;
|
||||
var pagePercentY = (e.touches[0].pageY - screenViewerTop) / viewer.clientHeight;
|
||||
ViewerApp.MessageSender.SendMouseMove(pagePercentX, pagePercentY);
|
||||
}
|
||||
|
||||
isScrolling = true;
|
||||
if (Date.now() - lastScrollTime < 100) {
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user