-
Notifications
You must be signed in to change notification settings - Fork 863
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 tilemap new weird behaviors #6957
Conversation
AlexandreSi
commented
Sep 16, 2024
•
edited
Loading
edited
- Improve performance display when painting using a PIXI.TilingSprite
- Fix painting when tilemap is rotated
- Allow atlas size to be something else than a tile size multiple and ignore last column and row
- Display error message only when the the tile size is greater than the atlas image
- Do not crash preview if tilemap badly configured
- Add object name in actions and conditions
const allXCoordinates = spritesCoordinatesInTileMapGrid.map(({ x }) => x); | ||
const allYCoordinates = spritesCoordinatesInTileMapGrid.map(({ y }) => y); | ||
const minX = Math.min(...allXCoordinates); | ||
const maxX = Math.max(...allXCoordinates); | ||
const minY = Math.min(...allYCoordinates); | ||
const maxY = Math.max(...allYCoordinates); |
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.
While it looks elegant, probably a better idea to just do a for loop on spritesCoordinatesInTileMapGrid and a if (x < minX) minX = x;
, because otherwise you're allocating 2 arrays of easily 500-200 elements at each render (not bad, but ok) and calling Math.min/max with 500-2000 parameters - JS engines are certainly not happy with this.
A good old for loop while be easily optimized by JS engines and even CPUs.
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.
Yeah good idea, it was a bit brainless 😅
Extensions/TileMap/JsExtension.js
Outdated
@@ -940,7 +955,7 @@ const defineSimpleTileMap = function (extension, _, gd) { | |||
'RemoveTileAtGridCoordinates', | |||
_('Remove tile (on the grid)'), | |||
_('Remove the tile at the grid coordinates.'), | |||
_('Remove tile at grid coordinates _PARAM1_ ; _PARAM2_'), | |||
_('Remove tile at grid coordinates _PARAM1_ ; _PARAM2_ of _PARAM0_'), |
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.
_('Remove tile at grid coordinates _PARAM1_ ; _PARAM2_ of _PARAM0_'), | |
_('Remove tile of _PARAM0_ at grid coordinates _PARAM1_;_PARAM2_'), |
Extensions/TileMap/JsExtension.js
Outdated
@@ -922,7 +937,7 @@ const defineSimpleTileMap = function (extension, _, gd) { | |||
_('Flip tile horizontally (on the grid)'), | |||
_('Flip tile horizontally at grid coordinates.'), | |||
_( | |||
'Flip tile horizontally at grid coordinates _PARAM1_ ; _PARAM2_: _PARAM3_' | |||
'Flip tile horizontally at grid coordinates _PARAM1_ ; _PARAM2_: _PARAM3_ of _PARAM0_' |
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.
'Flip tile horizontally at grid coordinates _PARAM1_ ; _PARAM2_: _PARAM3_ of _PARAM0_' | |
'Flip tile horizontally at grid coordinates _PARAM1_;_PARAM2_ of _PARAM0_: _PARAM3_' |
Extensions/TileMap/JsExtension.js
Outdated
@@ -903,7 +918,7 @@ const defineSimpleTileMap = function (extension, _, gd) { | |||
_('Flip tile vertically (on the grid)'), | |||
_('Flip tile vertically at grid coordinates.'), | |||
_( | |||
'Flip tile vertically at grid coordinates _PARAM1_ ; _PARAM2_: _PARAM3_' | |||
'Flip tile vertically at grid coordinates _PARAM1_ ; _PARAM2_: _PARAM3_ of _PARAM0_' |
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.
'Flip tile vertically at grid coordinates _PARAM1_ ; _PARAM2_: _PARAM3_ of _PARAM0_' | |
'Flip tile vertically at grid coordinates _PARAM1_;_PARAM2_ of _PARAM0_: _PARAM3_' |
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.
Extensions/TileMap/JsExtension.js
Outdated
@@ -832,7 +847,7 @@ const defineSimpleTileMap = function (extension, _, gd) { | |||
_('Flip tile vertically (at position)'), | |||
_('Flip tile vertically at scene coordinates.'), | |||
_( | |||
'Flip tile vertically at scene coordinates _PARAM1_ ; _PARAM2_: _PARAM3_' | |||
'Flip tile vertically at scene coordinates _PARAM1_ ; _PARAM2_: _PARAM3_ of _PARAM0_' |
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.
Everywhere: don't put "of " after a boolean but after the scene coordinates.
For coordinates, use X;Y
, not X ; Y
Extensions/TileMap/JsExtension.js
Outdated
@@ -815,7 +830,7 @@ const defineSimpleTileMap = function (extension, _, gd) { | |||
'TileIdAtPosition', | |||
_('Tile (at position)'), | |||
_('the id of the tile at the scene coordinates'), | |||
_('the tile id at scene coordinates _PARAM3_ ; _PARAM4_'), | |||
_('the tile id at scene coordinates _PARAM3_ ; _PARAM4_ of _PARAM0_'), |
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.
_('the tile id at scene coordinates _PARAM3_ ; _PARAM4_ of _PARAM0_'), | |
_('the tile id of _PARAM0_ at scene coordinates _PARAM3_ ; _PARAM4_'), |
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.
lgtm once sentences are updated