Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find a way to force buttons to text wrap if the button text is too long. #81

Closed
togfoxy opened this issue Mar 15, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@togfoxy
Copy link

togfoxy commented Mar 15, 2021

Wrapping button text across multiple lines then doing a corresponding auto-size would be handy.

@flamendless
Copy link
Owner

Hi @togfoxy.
There are two ways to do this as far as i can think of right now:

  1. Parse the text and check for numbers of \n occurences.
  2. Just let the user pass a number of multilines

First one would be costly as it will be calculated per frame.
Second one will allow for more control and users can even use this to easily make buttons with higher height.

Fixed in 84fc55e

here's an example of how to use it:

local str = "dsadsadsadasdasdsadsa\ndasdsadasdsadsadsdsadas" --2 lines

function love.update(dt)
	Slab.Update(dt)
	Slab.BeginWindow("test", {Title = "Test"})
	if Slab.Button(str, {
		VLines = 2
	}) then
	end
	Slab.EndWindow()
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants