mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
resolve conflict on frontend/ui/widget/scrolltextwidget.lua
This commit is contained in:
@@ -4,10 +4,11 @@ local VerticalScrollBar = require("ui/widget/verticalscrollbar")
|
||||
local Geom = require("ui/geometry")
|
||||
local GestureRange = require("ui/gesturerange")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local Screen = require("device").screen
|
||||
local Device = require("device")
|
||||
local Screen = Device.screen
|
||||
local Input = Device.input
|
||||
local HorizontalGroup = require("ui/widget/horizontalgroup")
|
||||
local HorizontalSpan = require("ui/widget/horizontalspan")
|
||||
local Device = require("device")
|
||||
local Blitbuffer = require("ffi/blitbuffer")
|
||||
|
||||
--[[
|
||||
@@ -64,13 +65,20 @@ function ScrollTextWidget:init()
|
||||
},
|
||||
}
|
||||
end
|
||||
if Device:hasKeyboard() or Device:hasKeys() then
|
||||
self.key_events = {
|
||||
ScrollDown = {{Input.group.PgFwd}, doc = "scroll down"},
|
||||
ScrollUp = {{Input.group.PgBack}, doc = "scroll up"},
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ScrollTextWidget:onScrollText(arg, ges)
|
||||
if ges.direction == "north" then
|
||||
function ScrollTextWidget:scrollText(direction)
|
||||
if direction == 0 then return end
|
||||
if direction > 0 then
|
||||
low, high = self.text_widget:scrollDown()
|
||||
self.v_scroll_bar:set(low, high)
|
||||
elseif ges.direction == "south" then
|
||||
else
|
||||
low, high = self.text_widget:scrollUp()
|
||||
self.v_scroll_bar:set(low, high)
|
||||
end
|
||||
@@ -79,4 +87,23 @@ function ScrollTextWidget:onScrollText(arg, ges)
|
||||
end)
|
||||
end
|
||||
|
||||
function ScrollTextWidget:onScrollText(arg, ges)
|
||||
if ges.direction == "north" then
|
||||
self:scrollText(1)
|
||||
elseif ges.direction == "south" then
|
||||
self:scrollText(-1)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function ScrollTextWidget:onScrollDown()
|
||||
self:scrollText(1)
|
||||
return true
|
||||
end
|
||||
|
||||
function ScrollTextWidget:onScrollUp()
|
||||
self:scrollText(-1)
|
||||
return true
|
||||
end
|
||||
|
||||
return ScrollTextWidget
|
||||
|
||||
Reference in New Issue
Block a user