mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
removed hardcoded push button padding
This commit is contained in:
parent
3685e25713
commit
5628df56a2
@ -24,13 +24,12 @@ local function push_button(args)
|
|||||||
assert(type(args.text) == "string", "graphics.elements.controls.push_button: text is a required field")
|
assert(type(args.text) == "string", "graphics.elements.controls.push_button: text is a required field")
|
||||||
assert(type(args.callback) == "function", "graphics.elements.controls.push_button: callback is a required field")
|
assert(type(args.callback) == "function", "graphics.elements.controls.push_button: callback is a required field")
|
||||||
|
|
||||||
-- single line
|
|
||||||
args.height = 1
|
|
||||||
|
|
||||||
args.min_width = args.min_width or 0
|
|
||||||
|
|
||||||
local text_width = string.len(args.text)
|
local text_width = string.len(args.text)
|
||||||
args.width = math.max(text_width + 2, args.min_width)
|
|
||||||
|
-- single line height, calculate width
|
||||||
|
args.height = 1
|
||||||
|
args.min_width = args.min_width or 0
|
||||||
|
args.width = math.max(text_width, args.min_width)
|
||||||
|
|
||||||
-- create new graphics element base object
|
-- create new graphics element base object
|
||||||
local e = element.new(args)
|
local e = element.new(args)
|
||||||
|
Loading…
Reference in New Issue
Block a user