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

Page overlap menu #8180

Merged
merged 11 commits into from
Sep 6, 2021
Merged

Page overlap menu #8180

merged 11 commits into from
Sep 6, 2021

Conversation

hius07
Copy link
Member

@hius07 hius07 commented Sep 4, 2021

Add a default option for Page overlap enabled/disabled for new books (long-press as usual).
Closes #7757.

1

Page overlap menu is a separate module.
Cleaned readerpaging, readerrolling, readerview of duplicated code.


This change is Reviewable

@hius07 hius07 marked this pull request as ready for review September 4, 2021 16:04
Copy link
Contributor

@poire-z poire-z left a 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.

Comment on lines 195 to 196
self.show_overlap_enable = config:isTrue("show_overlap_enable") or
G_reader_settings:isTrue("show_overlap_enable") or DSHOWOVERLAP
Copy link
Contributor

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

Copy link
Member Author

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()
Copy link
Contributor

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.

Comment on lines 8 to 14
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
Copy link
Contributor

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()
Copy link
Contributor

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)

@hius07 hius07 marked this pull request as draft September 4, 2021 17:11
@hius07 hius07 marked this pull request as ready for review September 5, 2021 08:08
Comment on lines 23 to 27
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
Copy link
Contributor

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

)

Copy link
Contributor

@poire-z poire-z left a 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.

@poire-z poire-z merged commit 0283c44 into koreader:master Sep 6, 2021
@Frenzie Frenzie added this to the 2021.09 milestone Sep 6, 2021
@hius07 hius07 deleted the patch-1 branch September 7, 2021 02:24
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.

Unable to set page overlap ON as a default option
3 participants