Minor cleanup
This commit is contained in:
@ -33,23 +33,23 @@ function dotgrid:new()
|
||||
end
|
||||
|
||||
function dots:draw(context, cr, width, height)
|
||||
local col_size = (height - self.spacing * (self.rows-1)) // self.rows
|
||||
local row_size = (width - self.spacing * (self.cols-1)) // self.cols
|
||||
local col_size = math.floor((height - self.spacing * (self.rows-1)) / self.rows)
|
||||
local row_size = math.floor((width - self.spacing * (self.cols-1)) / self.cols)
|
||||
|
||||
-- Compute rounding offsets for better centering
|
||||
local xoffset = (
|
||||
local xoffset = math.floor((
|
||||
width - (
|
||||
(col_size * self.cols) +
|
||||
(self.spacing * (self.cols - 1))
|
||||
)
|
||||
) // 2
|
||||
) / 2)
|
||||
|
||||
local yoffset = (
|
||||
local yoffset = math.floor((
|
||||
height - (
|
||||
(row_size * self.rows) +
|
||||
(self.spacing * (self.rows - 1))
|
||||
)
|
||||
) // 2
|
||||
) / 2)
|
||||
|
||||
-- How many dots should be on
|
||||
local on = math.floor((self.value / self.max) * (self.rows * self.cols))
|
||||
|
Reference in New Issue
Block a user