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
}
},
raeleus commented
That's a great find. I'll get back to working on Skin Composer today.
…On Mon, Jan 25, 2021, 6:12 AM TZVK ***@***.***> wrote:
*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.
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
*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.
*Solution:* The padding values should also be written in the json as
leftWidth etc.
"com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable": { "textbox3": {
"patch": "textbox3", "minWidth": 130, "minHeight": 150, "leftWidth": 35,
"rightWidth": 35, "topHeight": 40, "bottomHeight": 40 } },
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#93>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADCZLPGQABEHPF62G5BMLH3S3V34BANCNFSM4WRZ27RA>
.
raeleus commented
This will be resolved with the next release. Thanks for the excellent data, that saved me a lot of trouble.