Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReaderHighlight: adjustable highlight dialog position #11116

Merged
merged 4 commits into from Nov 19, 2023

Conversation

hius07
Copy link
Member

@hius07 hius07 commented Nov 16, 2023

Default to "center". Closes #11081.

1

2

3


This change is Reviewable

Comment on lines 1051 to 1091
-- NOTE: Disable merging for this update,
-- or the buggy Sage kernel may alpha-blend it into the page (with a bogus alpha value, to boot)...
UIManager:show(self.highlight_dialog, "[ui]")
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment still feels relevant (explaining why the [ ] around [ui]).

Comment on lines 1104 to 1110
local screen_h = self.screen_h - Size.padding.small -- do not stick to the edge
local anchor_y, prefers_pop_down
if position == "top" then
anchor_y = Size.padding.small
prefers_pop_down = true
elseif position == "bottom" then
anchor_y = screen_h
Copy link
Contributor

Choose a reason for hiding this comment

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

Lying about screen_h :) while you could probably do in the bottom branch like you do for the top branch: anchor_y = screen_h - Size.padding.small.
(I see that you reuse this hacked screen_h below - but the unbalance in this 2 branches reads odd. And no substraction computation saved, on the contrary it's avoided if "top", if you do it explicitely in the "bottom" and "gesture" branches.)

Comment on lines +1119 to +1120
else -- above box with gest_pos
anchor_y = text_box.y - Size.padding.small
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't there be a - text_box.h here so it is fully above text_box.y ?

Copy link
Member Author

Choose a reason for hiding this comment

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

-- Enough room above the anchor
top = anchor_dimen.y - content_h

{_("Top"), "top"},
{_("Center"), "center"},
{_("Bottom"), "bottom"},
{_("Gesture"), "gesture"},
Copy link
Contributor

Choose a reason for hiding this comment

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

"Gesture" standalone feels a little bit odd. "Gesture position", "Touch position", "Near touch" ? @Frenzie ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Gesture position, I think

text = _("Anchor QuickMenu to gesture position"),

Copy link
Member

Choose a reason for hiding this comment

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

At finger?

local position = G_reader_settings:readSetting("highlight_dialog_position", "center")
for __, v in ipairs(highlight_dialog_position) do
if v[2] == position then
return T(_("Highlight dialog position: %1"), v[1]:lower())
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, "dialog" feels like some technical / internal terminology.
"Highlight popup position" ?

Copy link
Member Author

Choose a reason for hiding this comment

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

{_("Ask with popup dialog"), "ask"},

@hius07 hius07 merged commit d99c70b into koreader:master Nov 19, 2023
3 checks passed
@hius07 hius07 deleted the highlight-dialog-position branch November 19, 2023 07:52
@hius07 hius07 added this to the 2023.11 milestone Nov 19, 2023
@mergen3107
Copy link
Contributor

I come here to say this is a great feature and it works charms with the option set to “gesture”! Thank you very much @hius07 !

This also works with dictionary lookup window (chosen as a single-word highlighting action).

When this feature is set to “center”, highlight window (if more than one word is selected) shows correctly in the center. However, the dictionary popup still shows up as if it was “gesture”. But if I then tap another word in this dictionary window, a second dictionary windows shows up - but this time around in the center. So it looks a bit inconsistent.

There is no inconsistency issue when suing “gesture”: second dictionary window shows up at the same location as the first one.

I am using the “gesture” option all the time, so this is not an issue for me. Just sharing my observations :)

@hius07
Copy link
Member Author

hius07 commented Dec 10, 2023

Thank you for the feedback.

This also works with dictionary lookup window (chosen as a single-word highlighting action).

Not related to the highlight dialog, Dictionary window does not use this setting,

@mergen3107
Copy link
Contributor

Interesting, it must be working like this before this setting for highlights was introduced.

Dictionary window shows up right above or right below the highlighted word in most cases except when words are right in the middle - then screen height doesn't allow it to be neither above/below the word so the windows shows up just in the center.

I didn't know about all these on Onyx Boox, because I was using external dictionary app, so I don't know when the dictionary window behavior changed exactly :D

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: Possible to customize the behaviour and position of the long-press, pop-up menu?
4 participants