bugfixes + tweaks for editor 2.0

This commit is contained in:
kepler155c@gmail.com
2020-04-02 21:28:42 -06:00
parent fc1a308193
commit d88ef00652
9 changed files with 47 additions and 23 deletions

View File

@@ -18,14 +18,14 @@ UI.Button.defaults = {
focusIndicator = ' ',
event = 'button_press',
accelerators = {
space = 'button_activate',
[ ' ' ] = 'button_activate',
enter = 'button_activate',
mouse_click = 'button_activate',
}
}
function UI.Button:setParent()
if not self.width and not self.ex then
self.width = #self.text + 2
self.width = self.noPadding and #self.text or #self.text + 2
end
UI.Window.setParent(self)
end
@@ -41,7 +41,7 @@ function UI.Button:draw()
elseif self.inactive then
fg = self:getProperty('textInactiveColor')
end
local text = ind .. self.text .. ' '
local text = self.noPadding and self.text or ind .. self.text .. ' '
if self.centered then
self:clear(bg)
self:centeredWrite(1 + math.floor(self.height / 2), text, bg, fg)
@@ -59,7 +59,7 @@ end
function UI.Button:eventHandler(event)
if event.type == 'button_activate' then
self:emit({ type = self.event, button = self })
self:emit({ type = self.event, button = self, element = self })
return true
end
return false