-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: [#285] Use Implicit Tiled layer order to default z index #290
Changes from all commits
1a42719
84d3458
36a9f8a
ff90fff
4cf84b1
bc34bd6
1bf563b
17c9f76
770572c
c99c046
bb2e766
4d6108f
0f90d50
3971deb
5df06dd
a213dfe
f86ae5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -78,8 +78,29 @@ export class TiledLayer extends TiledEntity { | |||||
*/ | ||||||
public compression?: TiledCompression; | ||||||
|
||||||
/** | ||||||
* Original order of the Tiled layer | ||||||
*/ | ||||||
public order!: number; | ||||||
|
||||||
/** | ||||||
* Reference to the raw tiled layer data | ||||||
*/ | ||||||
public rawLayer!: RawTiledLayer; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here too |
||||||
|
||||||
public static parse(layer: RawTiledLayer): TiledLayer { | ||||||
if (layer.type !== 'tilelayer') throw Error('Cannot parse a non tilelayer type layer'); | ||||||
const resultLayer = new TiledLayer(); | ||||||
resultLayer.id = +layer.id; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get this is a clever way to coerce but it's not clear what this does at first glance especially for someone not as familiar with hacks in JS. Might as well use the standard, it's available in all browsers we support and it's clearer.
Suggested change
Note radix is optional and is 10 by default anyway! Note also that there was code before that didn't coerce, because this one character can get lost in the noise. |
||||||
resultLayer.name = layer.name; | ||||||
resultLayer.data = (layer.data as number[]); | ||||||
resultLayer.width = layer.width; | ||||||
resultLayer.height = layer.height; | ||||||
resultLayer.encoding = layer.encoding ?? 'csv'; | ||||||
resultLayer.compression = layer.compression; | ||||||
resultLayer.order = layer.order; | ||||||
resultLayer.properties = layer.properties ?? []; | ||||||
resultLayer.rawLayer = layer; | ||||||
return resultLayer | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the other class members here aligned correctly?