* canvas overhaul * minor tweaks * list mode for overview * bugfixes + tweaks for editor 2.0 * minor tweaks * more editor work * refactor + new transitions * use layout() where appropriate and cleanup * mouse triple click + textEntry scroll ind * cleanup * cleanup + theme editor * color rework + cleanup * changes for deprecated ui methods * can now use named colors
21 lines
436 B
Lua
21 lines
436 B
Lua
local class = require('opus.class')
|
|
local UI = require('opus.ui')
|
|
local Util = require('opus.util')
|
|
|
|
UI.Text = class(UI.Window)
|
|
UI.Text.defaults = {
|
|
UIElement = 'Text',
|
|
value = '',
|
|
height = 1,
|
|
}
|
|
function UI.Text:layout()
|
|
if not self.width and not self.ex then
|
|
self.width = #tostring(self.value)
|
|
end
|
|
UI.Window.layout(self)
|
|
end
|
|
|
|
function UI.Text:draw()
|
|
self:write(1, 1, Util.widthify(self.value, self.width, self.align))
|
|
end
|