Skip to content

QuickMenu: anchor to gesture position#10636

Merged
yparitcher merged 1 commit into
koreader:masterfrom
yparitcher:qm_anchor
Jul 4, 2023
Merged

QuickMenu: anchor to gesture position#10636
yparitcher merged 1 commit into
koreader:masterfrom
yparitcher:qm_anchor

Conversation

@yparitcher

@yparitcher yparitcher commented Jul 3, 2023

Copy link
Copy Markdown
Member

Fixes: #10631

Lightly tested


This change is Reviewable

@yparitcher yparitcher added this to the 2023.07 milestone Jul 3, 2023
@poire-z

poire-z commented Jul 3, 2023

Copy link
Copy Markdown
Contributor

Simple :) I'm fine with the code, but not using QuickMenu, I don't have any opinion on the behaviour with the different type of gesture. Is it always convenient?
Pinging @jonnyl2 if he wants to test it.

@jonnyl2

jonnyl2 commented Jul 3, 2023

Copy link
Copy Markdown
Contributor

Tested and it works well, thank you. Very convenient for short gestures. However, is it possible to make the position dependent on the end point of the gesture, rather than the starting point? For longer gestures across the whole screen, the QuickMenu otherwise appears on the opposite end of the screen after completing the gesture.

@NiLuJe

NiLuJe commented Jul 3, 2023

Copy link
Copy Markdown
Member

Technically, yes, although GestureDetector doesn't currently forward that information (and every gesture would have to be handled, and the data may not always make sense for all of them?).

As an example, here's how the swipe data is exported:

return {
ges = ges,
-- use first pan tev coordination as swipe start point
pos = start_pos,
direction = swipe_direction,
multiswipe_directions = multiswipe_directions,
distance = swipe_distance,
time = tev.timev,
}

(See earlier in that function (Contact:handleSwipe) for how start_pos is computed, and how to get at the end contact instead via self.current_tev).

That could be forwarded as end_pos for gestures where it makes sense (most of the gesture detection code will have access to it, and might already have it processed in a ready-to-use format), and then the code use end_pos if available, or fallback to pos otherwise.

@jonnyl2

jonnyl2 commented Jul 3, 2023

Copy link
Copy Markdown
Contributor

Thanks @NiLuJe. If someone would like to write the code I'm happy to test it, otherwise it also works fine with the current changes (most gestures are usually performed on a small area on the screen anyway -- especially to call a QuickMenu).

@yparitcher

Copy link
Copy Markdown
Member Author

I don't use quickmenu so this is done on my end, not going to rework gesturedetector to find the gesture end, just this as it was quick and easy.

@NiLuJe

NiLuJe commented Jul 3, 2023

Copy link
Copy Markdown
Member

I don't use quickmenu

Ditto ;).

Fairly low hanging branch for interested parties, though ;).

@yparitcher yparitcher merged commit 27f7f1d into koreader:master Jul 4, 2023
@yparitcher yparitcher deleted the qm_anchor branch July 4, 2023 00:18
@hius07

hius07 commented Jul 4, 2023

Copy link
Copy Markdown
Member

Doesn't work with Profiles.
I will fix it (and maybe will make it optional for profiles, I used to the centered QMs).

The design question regarding the width, which one is better?

Current width factor 0.8

1

Width factor 0.7 (the last long item is shrinked)

2

Adaptive width based on the buttons width (a long item is in the list)

3

No long items in the list

4

@Frenzie

Frenzie commented Jul 4, 2023

Copy link
Copy Markdown
Member

Probably adaptive provided it doesn't adapt out of bounds?

@hius07

hius07 commented Jul 4, 2023

Copy link
Copy Markdown
Member

5

@hius07

hius07 commented Jul 4, 2023

Copy link
Copy Markdown
Member

And truncated if longer

6

@poire-z

poire-z commented Jul 4, 2023

Copy link
Copy Markdown
Contributor

No strong opinion. May be Adaptative with a min width of 0.5 or 0.6 or 0.7.

@jonnyl2

jonnyl2 commented Jul 4, 2023

Copy link
Copy Markdown
Contributor

If I get a vote, my preference would be adapative width with no minimum, and a max width as in the last screenshot (0.8?).

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.

FR: Open QuickMenu pop-ups at location of gesture

6 participants