|
|
@ -37,7 +37,6 @@ local ReaderPaging = InputContainer:new{
|
|
|
|
page_area = nil,
|
|
|
|
page_area = nil,
|
|
|
|
overlap = Screen:scaleBySize(DOVERLAPPIXELS),
|
|
|
|
overlap = Screen:scaleBySize(DOVERLAPPIXELS),
|
|
|
|
|
|
|
|
|
|
|
|
inverse_reading_order = nil,
|
|
|
|
|
|
|
|
page_flipping_mode = false,
|
|
|
|
page_flipping_mode = false,
|
|
|
|
bookmark_flipping_mode = false,
|
|
|
|
bookmark_flipping_mode = false,
|
|
|
|
flip_steps = {0,1,2,5,10,20,50,100},
|
|
|
|
flip_steps = {0,1,2,5,10,20,50,100},
|
|
|
@ -108,24 +107,12 @@ function ReaderPaging:onReaderReady()
|
|
|
|
self:setupTouchZones()
|
|
|
|
self:setupTouchZones()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function ReaderPaging:setupTapTouchZones()
|
|
|
|
function ReaderPaging:setupTouchZones()
|
|
|
|
local forward_zone = {
|
|
|
|
self.ges_events = {}
|
|
|
|
ratio_x = DTAP_ZONE_FORWARD.x, ratio_y = DTAP_ZONE_FORWARD.y,
|
|
|
|
self.onGesture = nil
|
|
|
|
ratio_w = DTAP_ZONE_FORWARD.w, ratio_h = DTAP_ZONE_FORWARD.h,
|
|
|
|
if not Device:isTouchDevice() then return end
|
|
|
|
}
|
|
|
|
|
|
|
|
local backward_zone = {
|
|
|
|
|
|
|
|
ratio_x = DTAP_ZONE_BACKWARD.x, ratio_y = DTAP_ZONE_BACKWARD.y,
|
|
|
|
|
|
|
|
ratio_w = DTAP_ZONE_BACKWARD.w, ratio_h = DTAP_ZONE_BACKWARD.h,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local do_mirror = BD.mirroredUILayout()
|
|
|
|
local forward_zone, backward_zone = self.view:getTapZones()
|
|
|
|
if self.inverse_reading_order then
|
|
|
|
|
|
|
|
do_mirror = not do_mirror
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
if do_mirror then
|
|
|
|
|
|
|
|
forward_zone.ratio_x = 1 - forward_zone.ratio_x - forward_zone.ratio_w
|
|
|
|
|
|
|
|
backward_zone.ratio_x = 1 - backward_zone.ratio_x - backward_zone.ratio_w
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.ui:registerTouchZones({
|
|
|
|
self.ui:registerTouchZones({
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -148,19 +135,6 @@ function ReaderPaging:setupTapTouchZones()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- This method will be called in onSetDimensions handler
|
|
|
|
|
|
|
|
function ReaderPaging:setupTouchZones()
|
|
|
|
|
|
|
|
-- deligate gesture listener to readerui
|
|
|
|
|
|
|
|
self.ges_events = {}
|
|
|
|
|
|
|
|
self.onGesture = nil
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not Device:isTouchDevice() then return end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self:setupTapTouchZones()
|
|
|
|
|
|
|
|
self.ui:registerTouchZones({
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id = "paging_swipe",
|
|
|
|
id = "paging_swipe",
|
|
|
|
ges = "swipe",
|
|
|
|
ges = "swipe",
|
|
|
@ -194,11 +168,6 @@ function ReaderPaging:onReadSettings(config)
|
|
|
|
self.flipping_zoom_mode = config:readSetting("flipping_zoom_mode") or "page"
|
|
|
|
self.flipping_zoom_mode = config:readSetting("flipping_zoom_mode") or "page"
|
|
|
|
self.flipping_scroll_mode = config:isTrue("flipping_scroll_mode")
|
|
|
|
self.flipping_scroll_mode = config:isTrue("flipping_scroll_mode")
|
|
|
|
self.is_reflowed = config:has("kopt_text_wrap") and config:readSetting("kopt_text_wrap") == 1
|
|
|
|
self.is_reflowed = config:has("kopt_text_wrap") and config:readSetting("kopt_text_wrap") == 1
|
|
|
|
if config:has("inverse_reading_order") then
|
|
|
|
|
|
|
|
self.inverse_reading_order = config:isTrue("inverse_reading_order")
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
self.inverse_reading_order = G_reader_settings:isTrue("inverse_reading_order")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
for _, v in ipairs(ReaderZooming.zoom_pan_settings) do
|
|
|
|
for _, v in ipairs(ReaderZooming.zoom_pan_settings) do
|
|
|
|
self[v] = config:readSetting(v) or G_reader_settings:readSetting(v) or ReaderZooming[v]
|
|
|
|
self[v] = config:readSetting(v) or G_reader_settings:readSetting(v) or ReaderZooming[v]
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -211,7 +180,6 @@ function ReaderPaging:onSaveSettings()
|
|
|
|
self.ui.doc_settings:saveSetting("percent_finished", self:getLastPercent())
|
|
|
|
self.ui.doc_settings:saveSetting("percent_finished", self:getLastPercent())
|
|
|
|
self.ui.doc_settings:saveSetting("flipping_zoom_mode", self.flipping_zoom_mode)
|
|
|
|
self.ui.doc_settings:saveSetting("flipping_zoom_mode", self.flipping_zoom_mode)
|
|
|
|
self.ui.doc_settings:saveSetting("flipping_scroll_mode", self.flipping_scroll_mode)
|
|
|
|
self.ui.doc_settings:saveSetting("flipping_scroll_mode", self.flipping_scroll_mode)
|
|
|
|
self.ui.doc_settings:saveSetting("inverse_reading_order", self.inverse_reading_order)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function ReaderPaging:getLastProgress()
|
|
|
|
function ReaderPaging:getLastProgress()
|
|
|
@ -400,7 +368,7 @@ function ReaderPaging:onSwipe(_, ges)
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|
elseif direction == "west" then
|
|
|
|
elseif direction == "west" then
|
|
|
|
if G_reader_settings:nilOrFalse("page_turns_disable_swipe") then
|
|
|
|
if G_reader_settings:nilOrFalse("page_turns_disable_swipe") then
|
|
|
|
if self.inverse_reading_order then
|
|
|
|
if self.view.inverse_reading_order then
|
|
|
|
self:onGotoViewRel(-1)
|
|
|
|
self:onGotoViewRel(-1)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
self:onGotoViewRel(1)
|
|
|
|
self:onGotoViewRel(1)
|
|
|
@ -409,7 +377,7 @@ function ReaderPaging:onSwipe(_, ges)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elseif direction == "east" then
|
|
|
|
elseif direction == "east" then
|
|
|
|
if G_reader_settings:nilOrFalse("page_turns_disable_swipe") then
|
|
|
|
if G_reader_settings:nilOrFalse("page_turns_disable_swipe") then
|
|
|
|
if self.inverse_reading_order then
|
|
|
|
if self.view.inverse_reading_order then
|
|
|
|
self:onGotoViewRel(1)
|
|
|
|
self:onGotoViewRel(1)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
self:onGotoViewRel(-1)
|
|
|
|
self:onGotoViewRel(-1)
|
|
|
@ -1141,18 +1109,4 @@ function ReaderPaging:onToggleReflow()
|
|
|
|
self:onReflowUpdated()
|
|
|
|
self:onReflowUpdated()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Duplicated in ReaderRolling
|
|
|
|
|
|
|
|
function ReaderPaging:onToggleReadingOrder()
|
|
|
|
|
|
|
|
self.inverse_reading_order = not self.inverse_reading_order
|
|
|
|
|
|
|
|
self:setupTouchZones()
|
|
|
|
|
|
|
|
local is_rtl = BD.mirroredUILayout()
|
|
|
|
|
|
|
|
if self.inverse_reading_order then
|
|
|
|
|
|
|
|
is_rtl = not is_rtl
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
UIManager:show(Notification:new{
|
|
|
|
|
|
|
|
text = is_rtl and _("RTL page turning.") or _("LTR page turning."),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ReaderPaging
|
|
|
|
return ReaderPaging
|
|
|
|