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

Fixed template instance size and position overrides #311

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

bjorn
Copy link
Member

@bjorn bjorn commented Sep 3, 2024

Template instances of rectangle, ellipse and text objects can override the width and height of the template object. This is now taken into account when reading out the attributes and when inheriting the shape from the template.

Template instances of point objects are now also correctly storing the instance position in the Point shape, instead of the position of the template object.

Closes #310

@bjorn bjorn force-pushed the fix-shape-size-override branch 2 times, most recently from 3a6798c to f0cad80 Compare September 3, 2024 09:57
@bjorn
Copy link
Member Author

bjorn commented Sep 3, 2024

Whoops, I should have opened this PR from my personal fork.

@bjorn
Copy link
Member Author

bjorn commented Sep 3, 2024

I guess it would be good to add some kind of test for overriding size in a template instance...

@bjorn bjorn mentioned this pull request Sep 3, 2024
aleokdev
aleokdev previously approved these changes Sep 3, 2024
Copy link
Contributor

@aleokdev aleokdev left a comment

Choose a reason for hiding this comment

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

Looks great!

Template instances of rectangle, ellipse and text objects can override
the width and height of the template object. This is now taken into
account when reading out the attributes and when inheriting the shape
from the template.

Template instances of point objects are now also correctly storing the
instance position in the Point shape, instead of the position of the
template object.

Added a small test for the resized templated object case.

Closes #310
@bjorn
Copy link
Member Author

bjorn commented Sep 3, 2024

@aleokdev Thanks! Most annoying was the handling of the Text objects, heh. What a bunch of boilerplate, which I don't think I could avoid thanks to it being an enum variant rather than a plain struct.

I decided to add a small test to verify the behavior.

assets/tiled_object_template.tmx Show resolved Hide resolved
@bjorn bjorn merged commit 1ffab03 into current Sep 3, 2024
4 checks passed
@bjorn bjorn deleted the fix-shape-size-override branch September 3, 2024 13:34
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.

Template property override
2 participants