-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add an option to *always* flash on chapter boundaries #6528
Conversation
A more complex CRe-only algorithm could try to simply detect vertical rivers between pages by keeping track of the amount of lines of text rendered, and flash if there's a significant discrepancy between pages. But, in practice, that only matters when scene breaks are involved, and it'd make handling the crazy people reading with vertical padding between paragraphs harder, maybe? |
Speaking of scene breaks, I don't think we do that currently, but flashing when there's (significant) image content should probably be NTH, too. I think all the bits necessary are here, because we already detect those cases for dithering. EDIT: Yup, done. |
(Those extra forced flashes will reset the refresh_rate counter). |
I didn't know we had that :/ I may like it, dunno yet :)
That might be too dependant on the content. You may get the same number of lines, but have a little shift because of some bigger font size header or just sup/sub that shifted the line height for one single line, or some small padding/margin added to DIV/P/BLOCKQUOTE containers by the publisher. If I end up liking it, I guess the only little annoying thing is that for the kind of book I'm reading currently, with a heading every 2 pages (so, a chapter, but I don't mind having 1000 chapters and a crowder progress bar), it will flash every 2 page - and the only way to disable that is the toggle you added - which is global. So, I'll have to toggle the global setting back on when switching to another book. Some local override ("Disable for current book") might come handy later (if I really like it :) |
Agreed, hence my next § ;). That was mainly just me thinking out loud ;).
Well, it is global by design (i.e., like refresh_rate), and disabled by default ;p. And refresh_rate is also never -1 by default. But that ties in to something I wanted to ask @yparitcher: what do I need to do to make this accessible to dispatcher/gesture/profile, because that'd take care of @poire-z's concerns nicely. |
Please, make it possible to override this manually without having to compile KOreader. For me, there's nothing more distracting in Nickel while reading than the flash between the first and second page of the chapter (okay, a complete flash after every 6 page turns is worse ;-) ). For some reason, I never read books that would benefit from a second flash -- even if high-contrast ornaments or images are used as chapter headings, for me, some ghosting is much less intrusive than the flash afterwards. |
What is the best way to add these instructions to the docs for the future? |
once you make a event/dispatcher for this you might want to add one for the regular refresh frequency :) |
Okay, good to know I got it right in #6530 then ;p. So, yeah, have to make new events for those. |
What's your actual setup? There's no silver bullet here. I can either create an inconsistency by having rr -1 behave as usual, but flash_on_boundaries flash on both, OR add an insane new layer of complexity by adding two new settings to handle both cases: rr -1 for the usual, rr -2 for both; flash_on_chapter for rr -1 behavior, flash_on_boundaries for rr -2 behavior. I'm not particularly happy about either, but since I don't personally use rr -1, the selfish and easy solution would be the former ;p. |
of a chapter. (There's often a large river at the top of the page on a chapter's first page)
No matter the current chosen refresh rate.
content on the page.
Not a great fan of the historical use of "refresh" instead of "flash" in this whole menu, TBH.
Keep it around for documentation purposes/making the logic more obvious.
Bit strange to have one of these positive and the other negative:
|
And register them in Dispatcher
Probably more useful in dispatcher than a toggle
That's the new default behavior. I'm not a fan of inverted settings (i.e., whose defaults is true, which would be necessary to make this behavior default if presented this way). EDIT: Duh. Thinko. |
Makes it clear those two go hand-in-hand (and explains the lack of leading capital).
Okay, managed not to break anything when switching to Events, so this should be good to go ;). |
Just mentionning that (as I don't mind much this strange phrasing as we won't visit that menu often): |
True, but I'm also not a fan of those either, and I managed to subtly bork stuff when doing just that in the past ;p. |
Sidenote, would you be interested in adding this to |
Not sure I follow? (I'm wholly unfamiliar with the readtimer plugin). AFAICT, that plugin deals in time, not chapters, so, not the right scope? |
Exactly. Oh, and thanks for adding the option to disable the second page flash :-) |
Also use the right event while I'm at it :D.
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
@NiLuJe : can you have a look at how that works with a Wikipedia EPUB, where there are many small chapters. (I have a small patch to readertoc to get ticks for all TOC entries and not limit them to some level - but I don't think this should be at play there.) |
@poire-z: Yep, there's quite probably potential for false-negatives with small chapters. I've rewritten the heuristic, I'll see how it fares now. Do you happen to have an example article I could check? |
Been testing with Soufisme.FR.epub (just look it up and Save as EPUB). |
Probably because #5500 (comment) : only lower headings (one of H3 or H4) get ticks. It may feel like H2 got a tick (and a flash) probably because they have a H3 or H4 on the same page ? #6540 indeed makes it consistent (but flash on every page :/) , and it works for me on "3 Doctrine" (Can't we find some heuristic for such book so that it doesn't flash on every page ? :) |
* Boundaries are now detected both when paging forward and backward. Fixes potential false-negatives in the chapter boundary heuristic code, as mentioned in #6528 (comment) ;). * Tweaked ReaderFooter to not repaint ReaderUI when it's unnecessary. (toggling/cycling it on a page with significant image content would flash the full screen). * Only flash the first time a page w/ significant image content is shown. (Menus, among other things, could otherwise re-trip the flash).
Just for info, I helped myself with: --- frontend/apps/reader/modules/readertoc.lua
+++ frontend/apps/reader/modules/readertoc.lua
@@ -53,2 +53,3 @@
self.expanded_nodes = {}
+ self.avoid_chapter_flash = nil
end
@@ -62,2 +63,10 @@
if UIManager.FULL_REFRESH_COUNT == -1 or G_reader_settings:isTrue("refresh_on_chapter_boundaries") then
+ if self.avoid_chapter_flash == nil then
+ -- No flash on chapter if too many ticks
+ self.avoid_chapter_flash = (#self:getTocTicks(0) / self.ui.document:getPageCount()) > 0.3
+ end
+ if self.avoid_chapter_flash then
+ self.pageno = pageno
+ return
+ end
local flash_on_second = G_reader_settings:nilOrFalse("no_refresh_on_second_chapter_page") Not a super reliable check (if most of all the ticks are in some small part of the book), but good enough to not have it with Wikipedia EPUBs. |
Another approach would be counting consecutive chapter flashes (or near consecutive flashes), and throttle them. The event handler where the current heuristic is should have all the info. |
Minor QoL change, because I like the concept ;).
Also, when this (or refresh rate is set to chapter) is enabled, also flash on the second page of a chapter, as chapter headings usually mean extra whitespace, meaning more chance for visible ghosting/contrast deviations.
(Note that the current algo only flashes when paging forward, I didn't touch that).
This change is