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 tilemap object edge cases causing crashes #6945

Merged
merged 6 commits into from
Sep 12, 2024

Conversation

AlexandreSi
Copy link
Collaborator

@AlexandreSi AlexandreSi commented Sep 11, 2024

When tile size is not compatible with atlas and trying to paint:
image

When atlas is not set:
image

Comment on lines 1908 to 1916
_placeholderTextNoAtlasPixiObject = new PIXI.Text(
'Set up an atlas image\nin the tilemap object.',
new PIXI.TextStyle({
fontFamily: 'Arial',
fontSize: 16,
align: 'center',
padding: 5,
})
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if you should change the text of 1 PIXI.Text instead of creating one for each message.
Also, should the placeholders only be instanciated if you actually need them to reduce memory footprint?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes good idea, it was not optimal, I use only one text now.
Regarding the instanciation, I'd rather do pixi container manipulation in the constructor only and then only switch visibility but if you think it's important, I can change this

Copy link
Owner

Choose a reason for hiding this comment

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

I think that's it indeed safer to:

  • instantiate what you need (even things that will be hidden) in the constructor
  • then only switch visibility or text.

@AlexandreSi AlexandreSi merged commit 3b9a612 into master Sep 12, 2024
6 checks passed
@AlexandreSi AlexandreSi deleted the fix-tilemap-edge-cases branch September 12, 2024 13:49
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