Update readerannotation.lua

reviewable/pr11563/r10
hius07 2 months ago committed by GitHub
parent 570624034b
commit b987aa1d18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -4,7 +4,7 @@ local _ = require("gettext")
local T = require("ffi/util").template local T = require("ffi/util").template
local ReaderAnnotation = WidgetContainer:extend{ local ReaderAnnotation = WidgetContainer:extend{
annotations = nil, annotations = nil, -- array sorted by annotation position order, ascending
} }
-- build, read, save -- build, read, save
@ -81,13 +81,8 @@ function ReaderAnnotation:getAnnotationsFromBookmarksHighlights(bookmarks, highl
table.insert(annotations, self:buildAnnotation(bookmarks[i], highlights, init)) table.insert(annotations, self:buildAnnotation(bookmarks[i], highlights, init))
end end
if #annotations > 1 then if #annotations > 1 then
local sort_func = function(a, b) local sort_func = self.ui.rolling and function(a, b) return self:isItemInPositionOrderRolling(a, b) end
if self.ui.rolling then or function(a, b) return self:isItemInPositionOrderPaging(a, b) end
return self:isItemInPositionOrderRolling(a, b)
else
return self:isItemInPositionOrderPaging(a, b)
end
end
table.sort(annotations, sort_func) table.sort(annotations, sort_func)
end end
return annotations return annotations

Loading…
Cancel
Save