raeleus/skin-composer

MinWidth/Height breaks padding of NinePatches

Closed this issue · 2 comments

TZVK commented

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
	}
},

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