delayed calling of gotoXPointer when internal properties are changed

This should fix #400 and fix #300.
pull/415/head
chrox 11 years ago
parent b0d27a021d
commit b5fd38f897

@ -6,6 +6,7 @@ local Input = require("ui/input")
local Event = require("ui/event") local Event = require("ui/event")
local GestureRange = require("ui/gesturerange") local GestureRange = require("ui/gesturerange")
local ReaderPanning = require("ui/reader/readerpanning") local ReaderPanning = require("ui/reader/readerpanning")
local UIManager = require("ui/uimanager")
local DEBUG = require("dbg") local DEBUG = require("dbg")
local _ = require("gettext") local _ = require("gettext")
@ -243,7 +244,7 @@ end
function ReaderRolling:onZoom() function ReaderRolling:onZoom()
--@TODO re-read doc_height info after font or lineheight changes 05.06 2012 (houqp) --@TODO re-read doc_height info after font or lineheight changes 05.06 2012 (houqp)
self:onUpdatePos() self:updatePos()
end end
--[[ --[[
@ -251,6 +252,11 @@ end
font has been changed, or line height has been changed. font has been changed, or line height has been changed.
--]] --]]
function ReaderRolling:onUpdatePos() function ReaderRolling:onUpdatePos()
UIManager:scheduleIn(0.1, function () self:updatePos() end)
return true
end
function ReaderRolling:updatePos()
-- reread document height -- reread document height
self.ui.document:_readMetadata() self.ui.document:_readMetadata()
-- update self.current_pos if the height of document has been changed. -- update self.current_pos if the height of document has been changed.
@ -262,7 +268,6 @@ function ReaderRolling:onUpdatePos()
self.old_page = new_page self.old_page = new_page
self.ui:handleEvent(Event:new("UpdateToc")) self.ui:handleEvent(Event:new("UpdateToc"))
end end
return true
end end
function ReaderRolling:onChangeViewMode() function ReaderRolling:onChangeViewMode()

@ -573,6 +573,7 @@ function ReaderView:onSetPageMargins(margins)
local right = margins[3] local right = margins[3]
local bottom = margins[4] local bottom = margins[4]
self.ui.document:setPageMargins(left, top, right, bottom) self.ui.document:setPageMargins(left, top, right, bottom)
self.ui:handleEvent(Event:new("UpdatePos"))
return true return true
end end

@ -509,6 +509,7 @@ function ConfigDialog:onConfigChoice(option_name, option_value)
--DEBUG("config option value", option_name, option_value) --DEBUG("config option value", option_name, option_value)
self.configurable[option_name] = option_value self.configurable[option_name] = option_value
self.ui:handleEvent(Event:new("StartActivityIndicator")) self.ui:handleEvent(Event:new("StartActivityIndicator"))
self:closeDialog()
return true return true
end end

Loading…
Cancel
Save