mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #641 from Markismus/master
Frontlight decrease of sensitivity for two-fingered pan gesture
This commit is contained in:
@@ -116,6 +116,10 @@ DAUTO_SAVE_PAGING_COUNT = nil
|
||||
-- dictionary font size
|
||||
DDICT_FONT_SIZE = 20
|
||||
|
||||
-- Frontlight decrease of sensitivity for two-fingered pan gesture,
|
||||
-- e.g. 2 changes the sensitivity by 1/2, 3 by 1/3 etc.
|
||||
FRONTLIGHT_SENSITIVITY_DECREASE = 2
|
||||
|
||||
-- ####################################################################
|
||||
-- following features are not supported right now
|
||||
-- ####################################################################
|
||||
|
||||
@@ -11,6 +11,7 @@ local _ = require("gettext")
|
||||
|
||||
local ReaderFrontLight = InputContainer:new{
|
||||
steps = {0,1,1,1,1,2,2,2,3,4,5,6,7,8,9,10},
|
||||
gestureScale = Screen:getWidth() * FRONTLIGHT_SENSITIVITY_DECREASE,
|
||||
}
|
||||
|
||||
function ReaderFrontLight:init()
|
||||
@@ -42,7 +43,7 @@ function ReaderFrontLight:onAdjust(arg, ges)
|
||||
local powerd = Device:getPowerDevice()
|
||||
if powerd.flIntensity ~= nil then
|
||||
DEBUG("frontlight intensity", powerd.flIntensity)
|
||||
local step = math.ceil(#self.steps * ges.distance / Screen:getWidth())
|
||||
local step = math.ceil(#self.steps * ges.distance / self.gestureScale)
|
||||
DEBUG("step = ", step)
|
||||
local delta_int = self.steps[step] or self.steps[#self.steps]
|
||||
DEBUG("delta_int = ", delta_int)
|
||||
|
||||
Reference in New Issue
Block a user