Bidi: keep invert() generic, handle settings in ReaderView (#8876)

Follow up to 42dd5aad. Handle settings only in
ReaderView:shouldInvertBiDiLayoutMirroring().
reviewable/pr8882/r1
poire-z 2 years ago committed by GitHub
parent e2e2e8028b
commit 831488b9e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -643,7 +643,7 @@ function ReaderToc:expandParentNode(index)
end end
function ReaderToc:onShowToc() function ReaderToc:onShowToc()
if self.view.inverse_reading_order then if self.view:shouldInvertBiDiLayoutMirroring() then
BD.invert() BD.invert()
end end

@ -831,6 +831,11 @@ function ReaderView:onReadSettings(config)
or 8) or 8)
end end
function ReaderView:shouldInvertBiDiLayoutMirroring()
-- A few widgets may temporarily invert UI layout mirroring when both these settings are true
return self.inverse_reading_order and G_reader_settings:isTrue("invert_ui_layout_mirroring")
end
function ReaderView:onPageUpdate(new_page_no) function ReaderView:onPageUpdate(new_page_no)
self.state.page = new_page_no self.state.page = new_page_no
self.state.drawn = false self.state.drawn = false

@ -130,7 +130,7 @@ end
-- This fuction can be used by document widgets to temporarily match a widget -- This fuction can be used by document widgets to temporarily match a widget
-- to the document page turn direction instead of the UI layout direction. -- to the document page turn direction instead of the UI layout direction.
function Bidi.invert() function Bidi.invert()
if G_reader_settings:isTrue("invert_ui_layout_mirroring") and not Bidi._inverted then if not Bidi._inverted then
Bidi._mirrored_ui_layout = not Bidi._mirrored_ui_layout Bidi._mirrored_ui_layout = not Bidi._mirrored_ui_layout
Bidi._inverted = true Bidi._inverted = true
end end

@ -527,7 +527,7 @@ local BookMapWidget = InputContainer:new{
} }
function BookMapWidget:init() function BookMapWidget:init()
if self.ui.view.inverse_reading_order then if self.ui.view:shouldInvertBiDiLayoutMirroring() then
BD.invert() BD.invert()
end end

@ -39,7 +39,7 @@ local PageBrowserWidget = InputContainer:new{
} }
function PageBrowserWidget:init() function PageBrowserWidget:init()
if self.ui.view.inverse_reading_order then if self.ui.view:shouldInvertBiDiLayoutMirroring() then
BD.invert() BD.invert()
end end

Loading…
Cancel
Save