Skip to content
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
5 changes: 5 additions & 0 deletions kart/gui/mapswipetool.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ def canvasReleaseEvent(self, e):
self.canvas().setCursor(QCursor(Qt.PointingHandCursor))

def canvasMoveEvent(self, e):
if (e.x(), e.y()) == (self.firstPoint.x(), self.firstPoint.y()):
# the moveEvent was fired immediately after the press event,
# don't change the swipe direction
return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's better to move this further down?

I think the issue is that dX=0; dY=0, then isVertical is set to False always, even if it was True before? Whereas maybe we should if not dX and not dY: return at that point?

Copy link
Copy Markdown
Contributor Author

@pfw pfw May 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also seems to happen depending on where the first click is and you can end up with a dX > dY. I'm not totally clear on all the conditions where it happened but it was at least some times where the values were non-zero and it got stuck as True. The case that I ran into this was that the swipe would always turn vertical and stay that way.

Re-thinking this... that explanation isn't so clear around how it initially came to my attention but there are cases where the move event came where the first point and even point were the same so I wanted to bail out completely there. I suspect there are other cases as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On helper.py, yes will need the rebase, just depends on the order that these might be applied.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged the other 2 PRs

THRESHOLD = 10
if self.hasSwipe:
if self.checkDirection:
Expand Down