Repository navigation
Invert progress bar direction, independently of UI layout (LTR/RTL) - #13382
Conversation
|
Tested on PW6 with manga folder directory defaults ( Here is how my directory defaults looks like now: Follow on (optional): is there a way to also have certain gestures flipped as well? I tried adding those lines from |
|
For completeness, I had this super hacky way, but it looks sketchy :D #7917 (comment) |
|
Also because it is semi-manual - with those script, I'd need to keep switching files by running scripts each time I transition between RTL and LTR books |
|
As I understood so far from the code, |
|
@Commodore64user
I guess I will wait for |
| }, | ||
| { | ||
| text = _("Invert progress bar direction"), | ||
| help_text = _("Invert the direction of the progress bar—useful for manga and right-to-left reading, even when using a left-to-right interface, or vice versa."), |
There was a problem hiding this comment.
bar—useful
right-to-left
Confusing to read for me French used to spaces. I don't think we use — anywhere, so can you try to use classic punctuation.
useful for manga and right-to-left reading, even when using a left-to-right interface
I think , even is uneeded, it is only useful in this case.
There was a problem hiding this comment.
for reference, that was supposed to be bar—useful and right-to-left. They are different
There was a problem hiding this comment.
You can just use a \n instead. (As an aside, en em-dash should be surrounded by hair spaces.)
There was a problem hiding this comment.
Due to the long sentence in the end, I would just put full stop after progress bar.
There was a problem hiding this comment.
That's what I mean. A period at the end, followed by a newline.
| local marker_x, icon_x, icon_y | ||
| if _mirroredUI then | ||
| marker_x = x + self.margin_h + self.bordersize + (fill_width - (fill_width * self.initial_percentage)) | ||
| else | ||
| marker_x = x + self.margin_h + self.bordersize + (fill_width * self.initial_percentage) | ||
| end | ||
| icon_x = marker_x - math.floor(self.initial_pos_icon:getSize().w / 2) | ||
| if self.height <= INITIAL_MARKER_HEIGHT_THRESHOLD then | ||
| self.initial_pos_icon:paintTo(bb, Math.round(fill_x + math.ceil(fill_width * self.initial_percentage) - self.height / 4), y - Math.round(self.height / 6)) | ||
| icon_y = y - Math.round(self.height / 6) | ||
| else | ||
| self.initial_pos_icon:paintTo(bb, Math.round(fill_x + math.ceil(fill_width * self.initial_percentage) - self.height / 2), y) | ||
| icon_y = y | ||
| end | ||
| self.initial_pos_icon:paintTo(bb, icon_x, icon_y) |
There was a problem hiding this comment.
Is this fixing a but with the original mirroredUI ?
Or is is not, and in this case why it's needed for you but not for originally for mirroredUI?
(Just asking, I haven't tried to understand what all this is doing).
Also, any change of behaviour ? I don't see the / 4 from ...self.height / 4 anywhere.
There was a problem hiding this comment.
yes, it is fixing a bug with mirroredUI. the indicator wasn't placed in the correct coordinate. i'll add the 4 back to try and keeo it as it was, i was going to when testing but somehow escaped me.
| -- Determine if we need to invert the button functionality and labels | ||
| local invert_buttons = self.progress_bar.invert_direction | ||
| -- Bottom row buttons | ||
| local button_minus = Button:new{ | ||
| text = "-1", | ||
| text = invert_buttons and "+1" or "-1", | ||
| text_font_size = button_font_size, |
There was a problem hiding this comment.
Travestizing the buttons is ugly and woke and adds noise in all of them.
Can't you just later reverse the buttons, ie with util.arrayRevers(bottom_buttons_row) before it is used?
(We do that with painting, I think you can do that after the widget is created, before it is used:
koreader/frontend/ui/widget/horizontalgroup.lua
Lines 45 to 47 in 70d13be
)
There was a problem hiding this comment.
yes I know, I felt dirty doing it :)
There was a problem hiding this comment.
unless I am misunderstanding what you are suggesting (which might as well be the case), I am trying and failing miserably. the only thing I was able to do was invert [somehow] the FocusManager cursor keys, so if you wanted to get your hands dirty ;)
There was a problem hiding this comment.
--- a/frontend/ui/widget/skimtowidget.lua
+++ b/frontend/ui/widget/skimtowidget.lua
@@ -302,6 +302,10 @@ function SkimToWidget:init()
button_plus_ten,
}
radius = Size.radius.window
+ if true then -- if your setting (but not if UI mirroredUI as this is handled by HorizontalGroup directly)
+ local util = require("util") -- at top
+ util.arrayReverse(bottom_buttons_row)
+ end
else
top_row_span = VerticalSpan:new{ width = Size.padding.default }
top_buttons_row = HorizontalGroup:new{(do that for the other top_buttons_row (in full_mode and in not full_mode))
bottom_buttons_row is a HorizontalGroup widget - but it's also just an array of subwidgets, and util.arrayReverse() will just reorder this array part.
There was a problem hiding this comment.
that is what I was doing, never mind I figured out why focus manager was losing it's marbles. we also need to update self.layout duh
There was a problem hiding this comment.
Disgrace because of the different order than in center position?
There was a problem hiding this comment.
I see. It is the relative position of icons. Yeah, it doesn't seem right. For example, hollow arrow and the bar for chapter ones must be correct. Looks like now everything in compact Skim widget with KOReader's RTL is swapped left-right blindly.
well, you might wait for a long time because the status bar is global. perhaps you could try running a profile |
Thanks @Commodore64user ! I just learned in a different thread about "check if book path contains specific string" on book opening/closing for auto-exec Profile triggers. How feasible it is to add Dispatcher events with strictly For now I can try the Toggle event. |
|
It works fine with auto-exec Profile! Conditions: on book opening/closing either path check for [manga] Actions: My experience so far:
It would be much more definitive if there were Turn ON, Turn OFF dispatcher events for both. Then I could make two separate profiles - one for book opening (Turn OFF), one for book closing (Turn ON). @hius07 @Commodore64user |
|
I also created a new Profile to toggle statistics in Zotero documents.
That limitation also means I should AVOID switching between [manga] and Zotero books :D it will screw up Statistics and make RTL/Statistics toggles mismatch. |
you should be able to do so now.
It is quite obvious if the gesture/hotkey did on did not invert it. do you really need a bit of text to tell you what you can already verify with your eyes? |
Thank you! I'll give it a try soon. As for notification, I was just asking :D I agree that it is quite obvious if RTL Progress bar toggled or not. However, a fired notification will make sure that it was the Profile who did it (compared to, say, leftover RTL Progress bar + failed Profile for some reason). Mostly useful during testing/debugging stage |
|
Cool, it works! Thank you!
The only question I have is regarding compatibility. |
awesome
inverted is always the opposite and normal is the same, so in rtl, normal is rtl, in ltr normal is ltr. |
@Commodore64user Where is the non-full skim widget setting? I wasn't able to find it... |
because is not in logical place, |
|
Thanks! (Side note: Skim dialog positions Top and Bottom should mentioned that they are compact. I was searching for "compact" in Help - Menu Search to no avail :D ) I tested Skim widget on all three positions, and everything else so far with RTL works OK. |
|
By the way, why Skim widget in the center doesn't have a back button? It is a circular arrow icon in compact versions. Very convenient! |
a long press on the page number should do it. |
|
Crazy!
@offset-torque They are all from different places I thought we should add just "Tips and Tricks" mini-section :D P.S. Sorry for hi-jacking this ticket, I'll move to a separate one soon |
|
I think it was the poet who said it first: "In KOReader, everything is long press-able, unless it isn't". |
We already have a "User Interface tips" section. I will add these distributed tips also there. |
Yoda voice: |
|
Thank you @offset-torque for maintaining the KOReader User Guide (and people's sanity) |
|
polite reminder to @mergen3107 that you should bring all external stuff here, not the other way around. ;)
I am not entirely convinced this is a good idea, it goes back those settings being set on a book by book basis and the status bar being global. Besides that, duplicating menu entries does not seem very appropriate either. |
|
I thank you mergen3107 for the appreciation. Lots of effort (discussion, implementation, maintenance) is spent on nice features by our devs. If I don't explain them properly, much fewer users would be able to discover and use them which would be a pity for both sides. |
Elaborate please? (Sorry, I am on a strong painkiller today, hard to think straight, I am trying :D ) |
|
|
I'm not sure I understand the question, what exactly is it that you are asking... with some context ;) |
|
My guess is the question is what this inversion refers to: taps, buttons, swipes? |
|
I see, touch based page turns then. |
|
It's part of "used in conjunction with" where it's capitalized as if it's a specific named feature. |
|
that should read "Invert page turn taps and swipes" |
|
Quick question: what is the settings to use in directory defaults (for RTL progress bar)? Thanks |
|
Invert_ui_layout? |
|
I meant only the progress bar at the bottom (and maybe the skim widget). Isn't this PR about independence from whole UI inversion? |
|
And weren't you the one who asked for it to be bundled together with inverting other widgets? |
With the inverse_reading_order, not the whole UI. i.e. approximate the experience to how we read physical RTL books. Mirror imaging everything (icons, menus, ...) scrambles my brain |
|
Sorry, I forgot, is the "Invert document-related dialogs" in the Dispatcher? I am trying to add it to the auto-execute profiles for manga:
|
|
My preference would have been to have it as a dispatcher item (toggle, on, off), but directory defaults might work too |
|
Exactly. The way it makes sense to me as a reader of RTL:
My app is in English. I just read both LTR and RTL books. Thanks |
|
Well the button works, if it doesn't work with directory defaults, that needs looking into. The dispatcher stuff was removed when the setting was switched to a per-book basis, which makes sense. As for being bundled with the other widgets, is not a full inversion of ui, so nobody should be getting dizzy 🥴, it had to go there in order to control all progress bars (skim widget) so... |
|
Thanks for your work on this. I appreciate it. ETA: and the button works for me in directory defaults. |
Oh! What string did you use? Could you please share? :D |
|
|
|
Huh, I’ll give it another try later Are you sure you are not confusing it with already applied setting before directory defaults? I made this mistake before :D |
I tried it with two new epubs.
|
|
Thanks everyone! Especially @Commodore64user |




what's new
Added a new
invert_directionproperty toProgressWidgetand implemented logic to invert the direction of progress bars based on this property. This includes updates to thepaintToandgetPercentageFromPositionmethods to handle the inversion logic. (frontend/ui/widget/progresswidget.lua)Updated
ReaderFooterto initialize and toggle theinvert_directionproperty based on a newinvert_ui_layout_mirroringsetting. Added theonToggleUILayoutMiroringmethod to handle toggling this feature. (frontend/apps/reader/modules/readerfooter.lua)Added a new menu option to invert document-related dialogs for non-touch devices, including a callback to toggle the
invert_ui_layout_mirroringsetting. Updated the help text to clarify its purpose. (frontend/apps/reader/modules/readermenu.lua)Updated the existing "Invert document-related dialogs" menu entry in
page_turns.luato use the new toggle event and adjusted the help text for consistency. (frontend/ui/elements/page_turns.lua)Modified
SkimToWidgetto dynamically adjust button functionality, labels, and layout based on theinvert_ui_layout_mirroringsetting. This includes reversing button orders and D-Pad navigation layouts when inversion is enabled. (frontend/ui/widget/skimtowidget.lua)Added the
Eventmodule to support broadcasting the toggle event for UI layout mirroring. (frontend/ui/elements/page_turns.lua)Removed redundant logic in
ReaderView:shouldInvertBiDiLayoutMirroringand added a newonToggleUILayoutMiroringmethod to handle setting updates. (frontend/apps/reader/modules/readerview.lua)bug fix
frontend/ui/widget/progresswidget.lua: fixed an issue where the initial position marker had incorrect coordinates on RTL. (can be seen here Invert progress bar direction, independently of UI layout (LTR/RTL) #13382 (comment))screenshots
on non-touch devices
This change is