parse-tmx 1.33.0 → 1.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -8
- package/dist/index.js +2 -4
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -39,23 +39,18 @@ The basic implementation:
|
|
|
39
39
|
|
|
40
40
|
```ts
|
|
41
41
|
import { parseTmx } from "parse-tmx";
|
|
42
|
-
// The *.tmx file can be loaded as a string or URL encoded data
|
|
43
|
-
|
|
44
|
-
import tmxFile from "map.tmx";
|
|
42
|
+
// The *.tmx file can be loaded as a string or URL encoded data
|
|
43
|
+
import map from "map.tmx";
|
|
45
44
|
|
|
46
45
|
// Translates the tile flips in the layer data (default: false)
|
|
47
46
|
const translateFlips = true;
|
|
48
47
|
|
|
49
48
|
const loadMap = async () => {
|
|
50
|
-
const data = await parseTmx(
|
|
49
|
+
const data = await parseTmx(map, translateFlips);
|
|
51
50
|
...
|
|
52
51
|
};
|
|
53
52
|
```
|
|
54
53
|
|
|
55
|
-
#### Important
|
|
56
|
-
|
|
57
|
-
Parser only supports embedded tilesets. At the moment, external tilesets are not supported!
|
|
58
|
-
|
|
59
54
|
### Example data
|
|
60
55
|
|
|
61
56
|
[TMX Map Format documentation](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/)
|
package/dist/index.js
CHANGED
|
@@ -270,7 +270,7 @@ const parseTmx = async (xmlString, translateFlips = false) => {
|
|
|
270
270
|
case TMXNodeType.EditorSettings:
|
|
271
271
|
if (!node.$$)
|
|
272
272
|
break;
|
|
273
|
-
map.editorsettings = { ...node.$$.map((n) => ({ [n["#name"]]: n.$ }))
|
|
273
|
+
map.editorsettings = Object.assign({}, ...node.$$.map((n) => ({ [n["#name"]]: n.$ })));
|
|
274
274
|
break;
|
|
275
275
|
case TMXNodeType.Export:
|
|
276
276
|
case TMXNodeType.Image:
|
|
@@ -288,9 +288,7 @@ const parseTmx = async (xmlString, translateFlips = false) => {
|
|
|
288
288
|
case TMXNodeType.Properties:
|
|
289
289
|
if (!node.$$)
|
|
290
290
|
break;
|
|
291
|
-
map.properties = {
|
|
292
|
-
...node.$$.map(({ $: { name, value } }) => ({ [name]: value })),
|
|
293
|
-
};
|
|
291
|
+
map.properties = Object.assign({}, ...node.$$.map(({ $: { name, value } }) => ({ [name]: value })));
|
|
294
292
|
break;
|
|
295
293
|
case TMXNodeType.Tileset:
|
|
296
294
|
map.tilesets.push(parseTileset(node));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parse-tmx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.0",
|
|
4
4
|
"description": "A parser for tmx.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"export:gen": "ctix build --config ../configuration/.ctirc-ts"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@esposter/shared": "1.
|
|
33
|
+
"@esposter/shared": "1.35.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@esposter/configuration": "1.
|
|
37
|
-
"@types/node": "^22.
|
|
36
|
+
"@esposter/configuration": "1.35.0",
|
|
37
|
+
"@types/node": "^22.13.1"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "25b222d9da6491093bdcb3959719b9f369622c99"
|
|
40
40
|
}
|