Closed kevinfoley closed 7 years ago
Thanks a lot for the pull request, Kevin!
I actually really like this idea!! Automatically applying the scale9 settings is something that should really be automated. And your approach has the advantage that it doesn't pollute the Texture class.
I'm actually considering making this even more versatile. E.g. sometimes a texture also indicates a certain pivot point. Perhaps we can use your "binding" approach for that, as well — or change it to one technique (a callback, maybe?) that solves both (and more) issues.
I'm currently busy with finally getting the "Starling Handbook" out of the door, but that's really in the final stage. I'll review this when it's out!
Thanks again for this great suggestion, Kevin!!
That's now part of the master branch!
I actually added a generic function called automateSetupForTexture
that can be used to execute arbitrary code whenever a specific texture is assigned. Then, I added two convenience methods that bind a scale9Grid
or a pivot point to a given texture.
Thanks again for the idea and for the pull request! I hope you're fine with this implementation, as well. :smile:
The scale9Grid will automatically be applied whenever the Texture is displayed in an Image, saving us the boilerplate of passing around the scale9Grid with the Texture.
Usage: