-
-
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
Page overlap menu #8180
Page overlap menu #8180
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine and correct (the previous logic is respected).
You could even extract more bits from Rolling and Paging and put it into ReaderView.
self.show_overlap_enable = config:isTrue("show_overlap_enable") or | ||
G_reader_settings:isTrue("show_overlap_enable") or DSHOWOVERLAP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also deduplicate this (and the saveSetting, as it already does save page_overlap_style
) in ReaderView - and in readerpaging and readerrolling, in the few places that access self.show_overlap_enable
, use self.view.show_overlap_enable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I like it, will do it accurately.
@@ -1004,4 +966,15 @@ function ReaderView:checkAutoSaveSettings() | |||
end | |||
end | |||
|
|||
function ReaderView:isOverlapAllowed() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Followup to previous comment)
And then, you could either check for it here , or add a ReaderView:isOverlapEnabled()
, or just access view.overlap_enable
where you need it.
local function isOverlapEnabled() | ||
if ReaderUI.instance.document.info.has_pages then | ||
return ReaderUI.instance.paging.show_overlap_enable | ||
else | ||
return ReaderUI.instance.rolling.show_overlap_enable | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Followup to previous comment)
Instead of having this - you wouldn't need to pick in the various modules, all is in instance.view
.
return text | ||
end, | ||
checked_func = function() | ||
return ReaderUI.instance.view:isOverlapAllowed() and isOverlapEnabled() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Followup to previous comment)
return ReaderUI.instance.view:isOverlapAllowed() and ReaderUI.instance.view.isOverlapEnabled()
or if you prefer local function wrappers:
return isOverlapAllowed() and isOverlapEnabled()
(but not a mix)
if ReaderUI.instance.view:isOverlapAllowed() then | ||
if ReaderUI.instance.view.page_overlap_enable then | ||
ReaderUI.instance.view.dim_area:clear() | ||
end | ||
ReaderUI.instance.view.page_overlap_enable = not ReaderUI.instance.view.page_overlap_enable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(
You could may be make this easier to read when it's crowded like in there by using some of these at the start of the function:
local ui = ReaderUI.instance
local view = ReaderUI.instance.view
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Add a default option for Page overlap enabled/disabled for new books (long-press as usual).
Closes #7757.
Page overlap menu is a separate module.
Cleaned readerpaging, readerrolling, readerview of duplicated code.
This change is