Discard sub-pixel movements in gestures

On some touch devices the screen edges sometimes don't work because it detects a 0.5px movement up or down, and that cancels the swipe gesture. This patch discards sub-pixel movements for gestures to fix that.

BUG: 423842
BUG: 421212
master
Xaver Hugl 2020-08-04 13:52:16 +00:00 committed by David Edmundson
parent e41c5af676
commit 40b52eb4a4
1 changed files with 5 additions and 0 deletions

View File

@ -153,6 +153,11 @@ int GestureRecognizer::startSwipeGesture(uint fingerCount, const QPointF &startP
void GestureRecognizer::updateSwipeGesture(const QSizeF &delta)
{
m_swipeUpdates << delta;
if (std::abs(delta.width()) < 1 && std::abs(delta.height()) < 1) {
// some (touch) devices report sub-pixel movement on screen edges
// this often cancels gestures -> ignore these movements
return;
}
// determine the direction of the swipe
if (delta.width() == delta.height()) {
// special case of diagonal, this is not yet supported, thus cancel all gestures