Nineslice in container works unexpected

Hello, dear community! I’m not an experienced developer, so maybe my question is silly.
I’m trying to make a prefab of container. In this container, I want to make a nineslice image.
So my container class looks like this.

class AnswerButton extends Phaser.GameObjects.Container {
    constructor(data) {
        super(data.scene, data.posX, data.posY);

        this.answerBtnImg = data.scene.add.nineslice( 
            data.posX, 
            data.posY,
            data.texture, 
            data.frame, 
            data.sizeX, 
            data.sizeY, 
            data.radius);
        this.add(this.answerBtnImg); 
        data.scene.add.existing(this);                                       
    }

Then I call in from my games scene like this

const btnAttrib = {
            scene: this,
            posX: 0,
            posY: 0,
            texture: 'answerBtn',
            frame: 0,
            sizeX: 100,
            sizeY: 100,
            radius: 15,
        }
        this.answerBtn = new AnswerButton(btnAttrib);
        this.answerBtn.x = config.width / 2;
        this.answerBtn.y = config.height / 2;

The problem is my nineslice rectangle squashed by y direction, but I expect a nice rectangle 100x100 pixels

In the picture, how the rectangle looks like
Screenshot 2024-06-22 at 21.24.25

:wave:

I think you have to give all the arguments.

1 Like

thank you! it works!