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

MinWidth/Height breaks padding of NinePatches #93

Closed
TZVK opened this issue Jan 25, 2021 · 2 comments
Closed

MinWidth/Height breaks padding of NinePatches #93

TZVK opened this issue Jan 25, 2021 · 2 comments

Comments

@TZVK
Copy link

TZVK commented Jan 25, 2021

Problem: When using a NinePatch that has a MinWidth or MinHeight set, the values for the content/padding in the NinePatch are ignored and always zero.

Details: It seems that libgdx ignores certain atlas values of the NinePatch, if the NinePatch has an entry in the the json. MinWidth/Height creates a entry in the json, thus breaking the padding.

Atlas file:

textbox3
  rotate: false
  xy: 1, 379
  size: 573, 349
  split: 65, 60, 57, 91
  pad: 35, 35, 40, 40
  orig: 573, 349
  offset: 0, 0
  index: -1

broken json entry:

"com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable": {
	"textbox3": {
		"patch": "textbox3",
		"minWidth": 130,
		"minHeight": 150,
	}
},

Solution: The padding values should also be written in the json as leftWidth etc.

corrected json entry:

"com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable": {
	"textbox3": {
		"patch": "textbox3",
		"minWidth": 130,
		"minHeight": 150,
        "leftWidth": 35,
        "rightWidth": 35,
        "topHeight": 40,
        "bottomHeight": 40
	}
},
@raeleus
Copy link
Owner

raeleus commented Jan 25, 2021 via email

@raeleus
Copy link
Owner

raeleus commented Jan 27, 2021

This will be resolved with the next release. Thanks for the excellent data, that saved me a lot of trouble.

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

No branches or pull requests

2 participants