Paint pulled highlights: named colors only + repaint after apply
Two rendering gaps once annotations actually synced: - KOReader draws highlight colors from a fixed name set (Blitbuffer.HIGHLIGHT_COLORS); a web hex value (#ffd54f) resolves to nothing useful. The server now serves mapped names, but keep a belt-and-braces guard: only accept plain-name colors, let anything else (hex or unknown) fall back to the device default. - applyServerAnnotations mutated the annotation model but never requested a repaint — ReaderView paints annotations from the model on each redraw, so applied highlights stayed invisible until an unrelated refresh. Mark the reader dialog dirty when anything changed (same call the native highlight flows make).
This commit is contained in:
@@ -1290,7 +1290,14 @@ function Bookhoard:applyServerAnnotations(annotations)
|
|||||||
entry.drawer = "lighten"
|
entry.drawer = "lighten"
|
||||||
entry.text = srv_text
|
entry.text = srv_text
|
||||||
if srv_notes ~= "" then entry.note = srv_notes end
|
if srv_notes ~= "" then entry.note = srv_notes end
|
||||||
if server_entry.color and server_entry.color ~= "" then entry.color = server_entry.color end
|
-- KOReader renders highlight colors from a fixed name set
|
||||||
|
-- (Blitbuffer.HIGHLIGHT_COLORS); anything else (e.g. a web
|
||||||
|
-- hex value slipping through) draws nothing useful, so only
|
||||||
|
-- keep plain names and let the device default apply.
|
||||||
|
local srv_color = server_entry.color or ""
|
||||||
|
if srv_color ~= "" and not srv_color:find("^#") then
|
||||||
|
entry.color = srv_color
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if srv_text ~= "" then entry.note = srv_text end -- bookmark label
|
if srv_text ~= "" then entry.note = srv_text end -- bookmark label
|
||||||
end
|
end
|
||||||
@@ -1367,6 +1374,11 @@ function Bookhoard:applyServerAnnotations(annotations)
|
|||||||
if self.ui.saveSettings then
|
if self.ui.saveSettings then
|
||||||
self.ui:saveSettings()
|
self.ui:saveSettings()
|
||||||
end
|
end
|
||||||
|
-- ReaderView paints annotations from the model on each repaint;
|
||||||
|
-- request one so applied highlights appear immediately.
|
||||||
|
if self.ui.dialog then
|
||||||
|
UIManager:setDirty(self.ui.dialog, "ui")
|
||||||
|
end
|
||||||
logger.dbg("Bookhoard: annotations updated from server")
|
logger.dbg("Bookhoard: annotations updated from server")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user