GiniWren Posted July 7, 2018 Share Posted July 7, 2018 Hey there -- For UI menus in my game, I have created a texture-less button that has a fake 9-patch image (really Phaser Group prototype extension) as a background and a Phaser Text object as its children. This creates buttons where the 9-patch background can be animated to change the button size without changing its scale. I have added instances those buttons as a Phaser Group that aligns them in a vertical column, using the buttons' heights for spacing. The issue is, the children of the button don't affect the button's width/height or bounds, so the grid aligns them by the default texture dimensions: 32x32. This minimal codepen roughly illustrates what I'm seeing/trying to do: https://codepen.io/giniwren/pen/xzvqMr I found some old threads that suggest this is expected behavior, and I understand why, but the workarounds discussed are disruptive (e.g., using a group instead of a button means changing how all the events are attached to the button throughout the entire project). Has there been a clean solution since then? Ideally in a way that lets me check dimensions the same way as the any other children added to the alignment group? Thanks for any help on this one! Link to comment Share on other sites More sharing options...
samme Posted July 7, 2018 Share Posted July 7, 2018 https://codepen.io/samme/pen/GGVOYW GiniWren 1 Link to comment Share on other sites More sharing options...
GiniWren Posted July 8, 2018 Author Share Posted July 8, 2018 Using group's getBounds makes perfect sense -- thank you! Link to comment Share on other sites More sharing options...
Recommended Posts