Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

WIP: 8206253: Problem with scoll events in window mode #115

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class ScrollGestureRecognizer implements GestureRecognizer {

private double centerX, centerY;
private double centerAbsX, centerAbsY;
private double lastCenterAbsX, lastCenterAbsY;
private double lastCenterX, lastCenterY;

private double deltaX, deltaY;
private double totalDeltaX, totalDeltaY;
Expand All @@ -106,7 +106,7 @@ class ScrollGestureRecognizer implements GestureRecognizer {
totalDeltaY += deltaY;

//send inertia scroll event
sendScrollEvent(true, centerAbsX, centerAbsY, currentTouchCount);
sendScrollEvent(true, centerX, centerY, currentTouchCount);
});
}

Expand Down Expand Up @@ -173,7 +173,7 @@ public void notifyEndTouchEvent(long time) {

if (currentTouchCount < 1) {
if (state == ScrollRecognitionState.ACTIVE) {
sendScrollFinishedEvent(lastCenterAbsX, lastCenterAbsY, lastTouchCount);
sendScrollFinishedEvent(lastCenterX, lastCenterY, lastTouchCount);

if (SCROLL_INERTIA_ENABLED) {
double timeFromLastScroll = ((double)time - scrollStartTime) / 1000000;
Expand Down Expand Up @@ -220,30 +220,30 @@ public void notifyEndTouchEvent(long time) {
}
if (state == ScrollRecognitionState.ACTIVE) {
//finish previous gesture
sendScrollFinishedEvent(lastCenterAbsX, lastCenterAbsY, lastTouchCount);
sendScrollFinishedEvent(lastCenterX, lastCenterY, lastTouchCount);
totalDeltaX = 0.0;
totalDeltaY = 0.0;
//start previous gesture
sendScrollStartedEvent(centerAbsX, centerAbsY, currentTouchCount);
sendScrollStartedEvent(centerX, centerY, currentTouchCount);
}
lastTouchCount = currentTouchCount;
lastCenterAbsX = centerAbsX;
lastCenterAbsY = centerAbsY;
lastCenterX = centerX;
lastCenterY = centerY;
} else {
//state should be either TRACKING or ACTIVE
deltaX = centerAbsX - lastCenterAbsX;
deltaY = centerAbsY - lastCenterAbsY;
deltaX = centerX - lastCenterX;
deltaY = centerY - lastCenterY;
if (state == ScrollRecognitionState.TRACKING) {
if ( Math.abs(deltaX) > SCROLL_THRESHOLD || Math.abs(deltaY) > SCROLL_THRESHOLD) {
state = ScrollRecognitionState.ACTIVE;
sendScrollStartedEvent(centerAbsX, centerAbsY, currentTouchCount);
sendScrollStartedEvent(centerX, centerY, currentTouchCount);
}
}
if (state == ScrollRecognitionState.ACTIVE) {
totalDeltaX += deltaX;
totalDeltaY += deltaY;

sendScrollEvent(false, centerAbsX, centerAbsY, currentTouchCount);
sendScrollEvent(false, centerX, centerY, currentTouchCount);
double timePassed = ((double)time - scrollStartTime) / 1000000000;
if (timePassed > 1e-4) {
//capture radius (pytaguras) or init to variables x,y ???
Expand All @@ -255,8 +255,8 @@ public void notifyEndTouchEvent(long time) {
scrollStartTime = time;
}

lastCenterAbsX = centerAbsX;
lastCenterAbsY = centerAbsY;
lastCenterX = centerX;
lastCenterY = centerY;
}
}
}
Expand Down