fix(menus): better cursor and widgets positionning

This commit is contained in:
Kazhnuz 2020-10-04 09:34:37 +02:00
parent d00bc782ba
commit a0c3dcea76
2 changed files with 3 additions and 3 deletions

View file

@ -51,7 +51,7 @@ end
function fancy.BaseWidget:drawCanvas() function fancy.BaseWidget:drawCanvas()
love.graphics.draw(self.box, 0, 0) love.graphics.draw(self.box, 0, 0)
local h = math.floor(self.height / 2) - (self.font:getHeight() / 2) - 1 local h = math.floor(self.height / 2) - (self.font:getHeight() / 2) - 2
self.font:draw(self.label, 16, h, -1, "left") self.font:draw(self.label, 16, h, -1, "left")
self.font:draw(self.label2, self.width -8, h, -1, "right") self.font:draw(self.label2, self.width -8, h, -1, "right")
end end

View file

@ -81,7 +81,7 @@ end
function list.ListMenu:getCursorPosition() function list.ListMenu:getCursorPosition()
local addition = MENU_ITEM_HEIGHT local addition = MENU_ITEM_HEIGHT
local x = self.x + 6 local x = self.x + 6
local y = self.y + ((self.cursorTransition) * addition) - 1 local y = self.y + ((self.cursorTransition) * addition) + 1
return x, y return x, y
end end
@ -122,7 +122,7 @@ function list.CenteredWidget:new(scene, menu_name, label)
end end
function list.CenteredWidget:drawCanvas() function list.CenteredWidget:drawCanvas()
local h = math.floor(self.height / 2) - (self.font:getHeight() / 2) - 1 local h = math.floor(self.height / 2) - (self.font:getHeight() / 2) - 2
self.font:draw(self.label, self.width / 2, h, -1, "center") self.font:draw(self.label, self.width / 2, h, -1, "center")
end end