Non-touch: highlight support (#8877)

readerhighlight: non-touch support
focusmanager: fix same type container share same selected field
radiobuttonwidget: non touch support
sortwidget: non touch support
openwithdialog: fix layout contains textinput, checkboxes added to layout twice
This commit is contained in:
Philip Chan
2022-03-12 19:16:50 +08:00
committed by GitHub
parent a6d6ba3606
commit 4f849c23ab
7 changed files with 282 additions and 65 deletions

View File

@@ -19,6 +19,7 @@ local UIManager = require("ui/uimanager")
local dbg = require("dbg")
local logger = require("logger")
local optionsutil = require("ui/data/optionsutil")
local Size = require("ui/size")
local _ = require("gettext")
local Screen = Device.screen
local T = require("ffi/util").template
@@ -44,6 +45,7 @@ local ReaderView = OverlapGroup:extend{
temp = {},
saved_drawer = "lighten",
saved = {},
indicator = nil, -- geom: non-touch highlight position indicator: {x = 50, y=50}
},
highlight_visible = true,
-- PDF/DjVu continuous paging
@@ -199,6 +201,10 @@ function ReaderView:paintTo(bb, x, y)
if self.highlight.temp then
self:drawTempHighlight(bb, x, y)
end
-- draw highlight position indicator for non-touch
if self.highlight.indicator then
self:drawHighlightIndicator(bb, x, y)
end
-- paint dogear
if self.dogear_visible then
self.dogear:paintTo(bb, x, y)
@@ -454,6 +460,23 @@ function ReaderView:drawScrollView(bb, x, y)
self.state.pos)
end
function ReaderView:drawHighlightIndicator(bb, x, y)
local rect = self.highlight.indicator
-- paint big cross line +
bb:paintRect(
rect.x,
rect.y + rect.h / 2 - Size.border.thick / 2,
rect.w,
Size.border.thick
)
bb:paintRect(
rect.x + rect.w / 2 - Size.border.thick / 2,
rect.y,
Size.border.thick,
rect.h
)
end
function ReaderView:drawTempHighlight(bb, x, y)
for page, boxes in pairs(self.highlight.temp) do
for i = 1, #boxes do