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

fix: setSize not being overridden #190

Merged
merged 1 commit into from
Aug 22, 2024
Merged

fix: setSize not being overridden #190

merged 1 commit into from
Aug 22, 2024

Conversation

Zyie
Copy link
Member

@Zyie Zyie commented Aug 16, 2024

in pixi v8 there is the get/set size functions that allow you to set both the width and height at the same time which is a bit more optimised than setting them individually

This PR ensure that any ui element that overrides width/height also overrides get/set size to ensure it works as expected

Copy link
Member

@GoodBoyDigital GoodBoyDigital left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is cool, what would be your thoughts on having width / height call setSize under the hood?

Perf wise it should be ok - the main bonus would be that mean that we only have one place for the resizing code?

{
if (this.options?.nineSliceSprite)
{
if (this._views.defaultView)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we do:

this._views.defaultView?.setSize(value, height);
this._views.hoverView?.setSize(value, height);

...

rather than the ifs? will be cleaner i think!

{
if (this._bg)
{
this._bg.setSize(value, height);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here:

this._bg?.setSize(value, height);

@CyberDex CyberDex merged commit 0008693 into main Aug 22, 2024
3 checks passed
@CyberDex CyberDex deleted the fix/set-size branch August 22, 2024 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants