mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Highlights: add strikeout style, fix pdf highlights (#8725)
- Add new strikeout highlight style. - Fix highlight style in pdf documents (save_document enabled) not updated when KOReader highlight style changed. - Fix ugly combination of mupdf and KOReader highlights
This commit is contained in:
@@ -37,7 +37,7 @@ local ReaderView = OverlapGroup:extend{
|
||||
bbox = nil,
|
||||
},
|
||||
outer_page_color = Blitbuffer.gray(DOUTER_PAGE_COLOR / 15),
|
||||
-- highlight with "lighten" or "underscore" or "invert"
|
||||
-- highlight with "lighten" or "underscore" or "strikeout" or "invert"
|
||||
highlight = {
|
||||
lighten_factor = G_reader_settings:readSetting("highlight_lighten_factor", 0.2),
|
||||
temp_drawer = "invert",
|
||||
@@ -542,15 +542,16 @@ end
|
||||
|
||||
function ReaderView:drawHighlightRect(bb, _x, _y, rect, drawer)
|
||||
local x, y, w, h = rect.x, rect.y, rect.w, rect.h
|
||||
|
||||
if drawer == "underscore" then
|
||||
self.highlight.line_width = self.highlight.line_width or 2
|
||||
self.highlight.line_color = self.highlight.line_color or Blitbuffer.COLOR_GRAY
|
||||
bb:paintRect(x, y+h-1, w,
|
||||
self.highlight.line_width,
|
||||
self.highlight.line_color)
|
||||
elseif drawer == "lighten" then
|
||||
if drawer == "lighten" then
|
||||
bb:lightenRect(x, y, w, h, self.highlight.lighten_factor)
|
||||
elseif drawer == "underscore" then
|
||||
bb:paintRect(x, y + h - 1, w, 2, Blitbuffer.COLOR_GRAY)
|
||||
elseif drawer == "strikeout" then
|
||||
local line_y = y + math.floor(h / 2) + 1
|
||||
if self.ui.paging then
|
||||
line_y = line_y + 2
|
||||
end
|
||||
bb:paintRect(x, line_y, w, 2, Blitbuffer.COLOR_BLACK)
|
||||
elseif drawer == "invert" then
|
||||
bb:invertRect(x, y, w, h)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user