Skip to content

GestureDetector: Make two_finger pans & swipes report the same sort of data than their standard brethren#10649

Merged
NiLuJe merged 15 commits into
koreader:masterfrom
NiLuJe:gesture_pan-vs-swipe_semantics
Jul 9, 2023
Merged

GestureDetector: Make two_finger pans & swipes report the same sort of data than their standard brethren#10649
NiLuJe merged 15 commits into
koreader:masterfrom
NiLuJe:gesture_pan-vs-swipe_semantics

Conversation

@NiLuJe

@NiLuJe NiLuJe commented Jul 5, 2023

Copy link
Copy Markdown
Member

In the process of looking over the "swipe reports the contact point (i.e., gesture start) as pos while pretty much everything else reports the lift point (i.e., gesture end)" for the QuickMenu anchoring thingy, I realized that the two-finger variants of the pans & swipes were doing things... differently (by always using the "swipe" semantics, which effectively means that two_finger_pan reports completely different things than pan).

So, I started looking into best to handle that, and I came up with an ugly mess.

Which leads me to a simple question: why? Wouldn't it be much, much simpler is swipes just behaved like everything else and reported the lift point as pos?

I don't think we actually care about it much... unless it's used for the tap/gesture zone hit detection, in which case it makes sense to use the start position, dammit (yes, I just thought about that right now :D).

Anyway, RFC, I haven't even started testing this anyway ;D.


This change is Reviewable

@NiLuJe NiLuJe changed the title GestureDetector: Swipe vs. Pan semantics RFC (FIXME to final) GestureDetector: Swipe vs. Pan semantics RFC (FIXME to final title) Jul 5, 2023
@NiLuJe

NiLuJe commented Jul 5, 2023

Copy link
Copy Markdown
Member Author

Hmm, tweaking the hit-detection is probably as simple a tweaking GestureRange's match function, but then I still need some nastiness to make sure only actual swipes have a start_pos set...

Sooo, it's probably still cleaner to leave the nastiness inside GestureDetector, and let everyhting else be happy in the fact that pos will always be what the gesture was triggered for, oblivious to the fact that it may not be the lift point...

@NiLuJe NiLuJe changed the title GestureDetector: Swipe vs. Pan semantics RFC (FIXME to final title) GestureDetector: Make two_finger pans & swipes report the same sort of data than their standard brethren Jul 5, 2023
@NiLuJe NiLuJe marked this pull request as ready for review July 5, 2023 18:39
@NiLuJe

NiLuJe commented Jul 5, 2023

Copy link
Copy Markdown
Member Author

Didn't fit in the title, but this also switches the QuickMenu anchor the the lift point for swipes, re: #10636 ;).

@NiLuJe NiLuJe left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r1, 1 of 1 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @NiLuJe)

@hius07

hius07 commented Jul 5, 2023

Copy link
Copy Markdown
Member

Can you please keep the dispatcher unchanged for a while, to avoid conflicts with #10646.

@NiLuJe

NiLuJe commented Jul 5, 2023

Copy link
Copy Markdown
Member Author

Oops, thought it was in an unmodified chunk ;).

@Frenzie Frenzie added this to the 2023.07 milestone Jul 5, 2023

@NiLuJe NiLuJe left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @NiLuJe)

@hius07

hius07 commented Jul 7, 2023

Copy link
Copy Markdown
Member

Dispatcher is ready to get gesture end_pos when it appears.

@NiLuJe NiLuJe merged commit 4194244 into koreader:master Jul 9, 2023
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
…f data than their standard brethren (koreader#10649)

Namely, that swipes report the gesture's *starting* coordinates as `pos` (for hit-detection purposes), while pans (and basically everything else) use the *lift* coordinates (as well as provide a relative vector).

In each case, we now also provide a separate `start_pos`/`end_pos`, in case handlers need finer-grained data (e.g., anchoring UI elements to a swipe's lift coordinates).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants