fix: adjust pan rate for eink and non-eink screens

pull/2610/merge
Qingping Hou 7 years ago committed by Frans de Jonge
parent fc12ee6537
commit a943b73303

@ -10,9 +10,6 @@ local logger = require("logger")
local _ = require("gettext") local _ = require("gettext")
local pan_rate = Screen.eink and 4.0 or 10.0
local function copyPageState(page_state) local function copyPageState(page_state)
return { return {
page = page_state.page, page = page_state.page,
@ -27,6 +24,7 @@ end
local ReaderPaging = InputContainer:new{ local ReaderPaging = InputContainer:new{
pan_rate = 30, -- default 30 ops, will be adjusted in readerui
current_page = 0, current_page = 0,
number_of_pages = 0, number_of_pages = 0,
last_pan_relative_y = 0, last_pan_relative_y = 0,
@ -133,7 +131,7 @@ function ReaderPaging:setupTouchZones()
{ {
id = "paging_pan", id = "paging_pan",
ges = "pan", ges = "pan",
rate = pan_rate, rate = self.pan_rate,
screen_zone = { screen_zone = {
ratio_x = 0, ratio_y = 0, ratio_w = 1, ratio_h = 1, ratio_x = 0, ratio_y = 0, ratio_w = 1, ratio_h = 1,
}, },

@ -8,7 +8,6 @@ local UIManager = require("ui/uimanager")
local logger = require("logger") local logger = require("logger")
local _ = require("gettext") local _ = require("gettext")
local pan_rate = Screen.eink and 4.0 or 10.0
--[[ --[[
Rolling is just like paging in page-based documents except that Rolling is just like paging in page-based documents except that
@ -31,6 +30,7 @@ local pan_rate = Screen.eink and 4.0 or 10.0
rendering. rendering.
--]] --]]
local ReaderRolling = InputContainer:new{ local ReaderRolling = InputContainer:new{
pan_rate = 30, -- default 30 ops, will be adjusted in readerui
old_doc_height = nil, old_doc_height = nil,
old_page = nil, old_page = nil,
current_pos = 0, current_pos = 0,
@ -225,7 +225,7 @@ function ReaderRolling:setupTouchZones()
{ {
id = "rolling_pan", id = "rolling_pan",
ges = "pan", ges = "pan",
rate = pan_rate, rate = self.pan_rate,
screen_zone = { screen_zone = {
ratio_x = 0, ratio_y = 0, ratio_w = 1, ratio_h = 1, ratio_x = 0, ratio_y = 0, ratio_w = 1, ratio_h = 1,
}, },

@ -85,6 +85,9 @@ function ReaderUI:registerPostInitCallback(callback)
end end
function ReaderUI:init() function ReaderUI:init()
-- cap screen refresh on pan to 2 refreshes per second
local pan_rate = Screen.eink and 2.0 or 30.0
self.postInitCallback = {} self.postInitCallback = {}
-- if we are not the top level dialog ourselves, it must be given in the table -- if we are not the top level dialog ourselves, it must be given in the table
if not self.dialog then if not self.dialog then
@ -229,6 +232,7 @@ function ReaderUI:init()
}) })
-- paging controller -- paging controller
self:registerModule("paging", ReaderPaging:new{ self:registerModule("paging", ReaderPaging:new{
pan_rate = pan_rate,
dialog = self.dialog, dialog = self.dialog,
view = self.view, view = self.view,
ui = self ui = self
@ -284,6 +288,7 @@ function ReaderUI:init()
}) })
-- rolling controller -- rolling controller
self:registerModule("rolling", ReaderRolling:new{ self:registerModule("rolling", ReaderRolling:new{
pan_rate = pan_rate,
dialog = self.dialog, dialog = self.dialog,
view = self.view, view = self.view,
ui = self ui = self

Loading…
Cancel
Save