Skip to content

Transformed templates lose their bounds #30

@skycatminepokie

Description

@skycatminepokie

When calling MapTemplate#transform, any bounds set are lost, leading to the copy generating bounds from scratch. This can lead to unexpected behavior when relying on the size of a template.

I think the fix is just one line before the return:

public MapTemplate transformed(MapTransform transform) {
        // ...
        for (var sourceRegion : this.metadata.regions) {
            result.metadata.regions.add(new TemplateRegion(
                    sourceRegion.getMarker(),
                    transform.transformedBounds(sourceRegion.getBounds()),
                    sourceRegion.getData().copy()
            ));
        }

+        result.setBounds(transform.transformedBounds(this.getBounds()));

        return result;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions