mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
refactoring readertoc and readerfooter
so that they don't repeat themselves.
This commit is contained in:
@@ -11,12 +11,12 @@ local ProgressWidget = Widget:new{
|
||||
margin_v = 1,
|
||||
radius = 2,
|
||||
bordersize = 1,
|
||||
toc_marker_width = DMINIBAR_TOC_MARKER_WIDTH,
|
||||
bordercolor = 15,
|
||||
bgcolor = 0,
|
||||
rectcolor = 10,
|
||||
percentage = nil,
|
||||
TOC = {},
|
||||
ticks = {},
|
||||
tick_width = 3,
|
||||
last = nil,
|
||||
}
|
||||
|
||||
@@ -37,14 +37,12 @@ function ProgressWidget:paintTo(bb, x, y)
|
||||
bb:paintRect(x+self.margin_h, y+self.margin_v+self.bordersize,
|
||||
(my_size.w-2*self.margin_h)*self.percentage,
|
||||
(my_size.h-2*(self.margin_v+self.bordersize)), self.rectcolor)
|
||||
if DMINIBAR_PROGRESS_MARKER then
|
||||
if #self.TOC > 0 then
|
||||
for i=1, #self.TOC do
|
||||
v = self.TOC[i]
|
||||
bb:paintRect(x+(my_size.w-2*self.margin_h)*(v.page/self.last), y+self.margin_v+self.bordersize,
|
||||
self.toc_marker_width,(my_size.h-2*(self.margin_v+self.bordersize)), self.bordercolor)
|
||||
end
|
||||
end
|
||||
for i=1, #self.ticks do
|
||||
local page = self.ticks[i]
|
||||
bb:paintRect(
|
||||
x + (my_size.w-2*self.margin_h)*(page/self.last),
|
||||
y + self.margin_v + self.bordersize, self.tick_width,
|
||||
(my_size.h-2*(self.margin_v+self.bordersize)), self.bordercolor)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user