Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using pixi v8.3.4 and ui v2.1.5, when trying to use a nineslicesprite bg for an Input #194

Open
CyberDex opened this issue Sep 1, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@CyberDex
Copy link
Member

CyberDex commented Sep 1, 2024

Using pixi v8.3.4 and ui v2.1.5, when trying to use a nineslicesprite bg for an Input
, it fails with a console warning: NineSliceSprite can not be used with views set as Container.

const input = new Input({
  bg: Sprite.from(texture),
  nineSliceSprite: [7,7,6,6],
});```
@CyberDex CyberDex added the bug Something isn't working label Sep 1, 2024
@CatchABus
Copy link
Contributor

In that case, It seems that latest the version prefers bg to be an actual string.
This is the code that handles this:

        if (this.options?.nineSliceSprite)
        {
            if (typeof bg === 'string')
            {
                this._bg = new NineSliceSprite({
                    texture: Texture.from(bg),
                    leftWidth: this.options.nineSliceSprite[0],
                    topHeight: this.options.nineSliceSprite[1],
                    rightWidth: this.options.nineSliceSprite[2],
                    bottomHeight: this.options.nineSliceSprite[3],
                });
            }
            else
            {
                console.warn('NineSliceSprite can not be used with views set as Container.');
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants