Skip to content

Conversation

@ufrshubham
Copy link
Member

@ufrshubham ufrshubham commented Nov 25, 2025

Description

Fixes image layers not rendering at correct size when canvas size differs from map size.

The issue was that paint area calculations relied on _canvasSize (the viewport size), but for image layers we actually need to paint based on the map's dimensions. When someone uses a fixed-resolution camera or the viewport doesn't match the map size, this caused background images to render at the wrong size, typically showing only in the top-left corner.

The fix swaps _canvasSize for _mapSize, which is just the map's tile count multiplied by tile size. For non-repeating images, this means the paint area now correctly matches the map bounds. For repeating images, the calculation now includes both the parallax translation offset and the full map size.

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • [NA] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • [NA] I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #2990

Copy link

@jwest15mcarthur-web jwest15mcarthur-web left a comment

Choose a reason for hiding this comment

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

ITS OK

@ufrshubham ufrshubham marked this pull request as ready for review January 7, 2026 15:30
Copy link
Member

@spydon spydon left a comment

Choose a reason for hiding this comment

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

Lgtm!

@spydon spydon merged commit 437d4be into main Jan 7, 2026
14 checks passed
@spydon spydon deleted the devkage/image-layer-paint-area-fix branch January 7, 2026 15:48
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.

Background Image Layer

5 participants