TileMap.insertLayerAt() and GroupLayer.insertLayerAt() behave different
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 12.9k
- Forks
- 2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 8
Description
Describe the bug
TileMap.insertLayerAt() and GroupLayer.insertLayerAt() behave different with a new layer and size not set. TileMap version will resize the layer to the size of the map. GroupLayer version will leave the size at 0,0. The GroupLayer documentation says it should resize it (TileMap doc does not say).
To Reproduce
layer1 = new TileLayer("New Layer")
TileMap.insertLayerAt(0, layer1)
// versus
layer2 = new TileLayer("New Layer")
GroupLayer.insertLayerAt(0, layer2)
Expected behavior
TileMap doc:
Inserts the layer at the given index. The layer can’t already be part of a map.
GroupLayer doc:
Inserts the layer at the given index. The layer can't already be part of a map.
When adding a TileLayer to a map, the layer's width and height are automatically initialized to the size of the map (since Tiled 1.4.2).
Workaround is to set the size explicitly.
Specifications:
- OS: Windows 10
- Tiled Version: 1.9.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TileMap.insertLayerAt() and GroupLayer.insertLayerAt() entry points and compare how each handles a new TileLayer with no size. Use the reproduction in the issue to verify the behavior, then check the TileMap and GroupLayer documentation. Done means both methods consistently initialize the layer size and the documentation matches the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, javascript
- Domain
- api, game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100