Skip to content

Commit 00dbd13

Browse files
fix: Data section of Layers was null (when loading from JSON) (#84)
# Description I have loaded a JSON TiledMap File but the data sections of the Tilelayer's were always null. Here is a simple JSON to test the loader with: ```json { "compressionlevel":-1, "height":25, "infinite":false, "layers":[ { "compression":"zlib", "data":"eJzVV0kOxDAIa\/7\/6TmNVFVAsFlCkHrIDGZxw9LnmSPrdAAJsoSn2++tIsXfkdOpd5YtVtxMbh6MxN2NHCIxe3QRnQiHU\/iW\/DO5deXC3teq+DT+UBtdvVL73XtnLTyTQ4Q\/ti8i4s0NqXkUh\/rNijcDh7xLRq+qbqr6XAV\/aB9ksYhU7RZMzWfoWLoTZ3iWvmePjPqdwF\/2nfLav4m\/rHvA6i\/jHPXXtX9lvcPoLnOyhzJ2lvN\/1Ffl90xkLqN+LJ+euonsg9bDSnU\/sbDoOeo\/W7K+w1istmN6euBuxnT1aQYX9Snxo9XzjkO2Fnd9doftxL3x2rlzZ3rngXJ+iru\/De1cOR8le1\/+vLuHNdcq5tPXRydOs8Xyp9mZNNMkqbqDFbanSnaOkfnRKT9oHwEi", "encoding":"base64", "height":25, "id":1, "name":"main", "opacity":1, "type":"tilelayer", "visible":true, "width":80, "x":0, "y":0 }], "nextlayerid":2, "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", "tiledversion":"1.8.2", "tileheight":8, "tilesets":[ { "firstgid":1, "source":"world1.json" }], "tilewidth":8, "type":"map", "version":"1.8", "width":80 } ``` Co-authored-by: Jochen Heizmann <[email protected]> Co-authored-by: Lukas Klingsbo <[email protected]>
1 parent 8aacd31 commit 00dbd13

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/tiled/lib/src/layer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ abstract class Layer {
146146
final width = parser.getInt('width');
147147
final height = parser.getInt('height');
148148
final dataNode = parser.formatSpecificParsing(
149-
(json) => null, // data is just a string or list of int on JSON
149+
(json) => json, // data is just a string or list of int on JSON
150150
(xml) => xml.getSingleChildOrNull('data'),
151151
);
152152
final compression = parser.getCompressionOrNull('compression') ??

0 commit comments

Comments
 (0)