Skip to content

Commit

Permalink
[Button] Added VLines option for multiline button label
Browse files Browse the repository at this point in the history
  • Loading branch information
flamendless committed Aug 21, 2021
1 parent 77a555d commit 84fc55e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions API.lua
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ end
property in the Style's table.
PadX: [Number] Amount of additional horizontal space the background will expand to from the center. The default value is 20.
PadY: [Number] Amount of additional vertical space the background will expand to from the center. The default value is 5.
VLines: [Number] Number of lines in a multiline button text. The default value is 1.
Return: [Boolean] Returns true if the user clicks on this button.
--]]
Expand Down
4 changes: 3 additions & 1 deletion Internal/UI/Button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ function Button.Begin(Label, Options)
Options.PressColor = Options.PressColor or Style.ButtonPressedColor
Options.PadX = Options.PadX or Pad * 2.0
Options.PadY = Options.PadY or Pad * 0.5
Options.VLines = Options.VLines or 1
local Id = Window.GetItemId(Label)
local W, H = Button.GetSize(Label)
H = H * Options.VLines
local LabelW = Style.Font:getWidth(Label)
local FontHeight = Style.Font:getHeight()
local FontHeight = Style.Font:getHeight() * Options.VLines
local TextColor = Options.Disabled and Style.ButtonDisabledTextColor or nil
-- If a valid image was specified, then adjust the button size to match the requested image size. Also takes into account any sub UVs.
Expand Down

0 comments on commit 84fc55e

Please sign in to comment.