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
Update ScrollGestureRecognizer.java
For the scroll events you must use the x and y points not the absX and absY points.
If the application is in fullscreen it works with absX and absY, because then x and absX and y and absY is the same.
But when you are in window mode the scene.sceneListener.scrollEvent methods are called with wrong x and y points.
michael-p-89 authored Jun 18, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 0c0a2e9e3742d0118c61d01ef52bdc809fc85570
Original file line number Diff line number Diff line change
@@ -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;
@@ -106,7 +106,7 @@ class ScrollGestureRecognizer implements GestureRecognizer {
totalDeltaY += deltaY;

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

@@ -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;
@@ -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 ???
@@ -255,8 +255,8 @@ public void notifyEndTouchEvent(long time) {
scrollStartTime = time;
}

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