Hi,
I want to Present you my 9 Slice implementation for PlayCanvas.
As some of you maybe find it useful. I based it on sprite.js .
It is by far not Perfect. Here is a gist link Slice9Sprite.js
I expanded the events that get handled.
You can register:
down
up
click
Usage:
The variables pixelXMinSlice, pixelYMaxSlice, pixelXMinSlice, pixelYMaxSlice describe where to slice.
pixelYMaxSlice and pixelYMaxSlice can also filled with negative values so it slices relative to the texture borders.
And you can configure with repeatX and repeatY if you want to repeat the Texture instead of stretching it.
margin is needed when the slicing is not accurate enough to display it seamless.
Problems:
At the moment scales Playcanas imported Pictures to power of 2 sizes.
So you maybe need to slice different than you thought.
No SpriteAtlas Support.
If enough people like it I maybe put it into a git repo for now I think a gist should be sufficient.
I would like to hear some comments especially about Technical Improvements.
best regards
HummingSwordsman