mapeditor / rs-tiled

Reads files from the Tiled editor into Rust
https://crates.io/crates/tiled
MIT License
268 stars 102 forks source link

Fixed template instance size and position overrides #311

Closed bjorn closed 3 months ago

bjorn commented 3 months ago

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 commented 3 months ago

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

bjorn commented 3 months ago

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

bjorn commented 3 months ago

@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.