code refactoring

pull/528/head
chrox 10 years ago
parent 9f50393f35
commit 5157a67ce2

@ -41,9 +41,8 @@ function ReaderFrontLight:onAdjust(arg, ges)
local powerd = Device:getPowerDevice()
if powerd.flIntensity ~= nil then
DEBUG("frontlight intensity", powerd.flIntensity)
local rel_proportion = ges.distance / Screen:getWidth()
local delta_int = self.steps[math.ceil(#self.steps*rel_proportion)] or self.steps[#self.steps]
local msg = nil
local step = math.ceil(#self.steps * ges.distance / Screen:getWidth())
local delta_int = self.steps[step] or self.steps[0]
if ges.direction == "north" then
powerd:setIntensity(powerd.flIntensity + delta_int)
elseif ges.direction == "south" then
@ -61,6 +60,7 @@ function ReaderFrontLight:onShowIntensity()
timeout = 1.0,
})
end
return true
end
function ReaderFrontLight:onSwipe(arg, ges)

Loading…
Cancel
Save