Merge pull request #1427 from Lurkars/fixFlattenGroupLayers

Fix flatten group layers
This commit is contained in:
David Négrier 2021-09-09 10:20:05 +02:00 committed by GitHub
commit 7432f15e27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ export function flattenGroupLayersMap(map: ITiledMap) {
} }
function flattenGroupLayers(layers: ITiledMapLayer[], prefix: string, flatLayers: ITiledMapLayer[]) { function flattenGroupLayers(layers: ITiledMapLayer[], prefix: string, flatLayers: ITiledMapLayer[]) {
for (const layer of layers) { for (const layer of layers.map((layer) => ({ ...layer }))) {
if (layer.type === "group") { if (layer.type === "group") {
flattenGroupLayers(layer.layers, prefix + layer.name + "/", flatLayers); flattenGroupLayers(layer.layers, prefix + layer.name + "/", flatLayers);
} else { } else {