Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/electron.renderer/data/def/TilesetDef.hx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ class TilesetDef {
var oldRelPath = relPath;
var oldPxWid = pxWid;
var oldPxHei = pxHei;
var oldCWid = cWid;

// Init
if( relFilePath!=null ) {
Expand Down Expand Up @@ -284,15 +285,15 @@ class TilesetDef {

if( oldRelPath!=null || isUsingEmbedAtlas() && oldPxWid>0 ) {
// Try to update previous image
return remapAllTileIdsAfterResize(oldPxWid, oldPxHei);
return remapAllTileIdsAfterResize(oldPxWid, oldPxHei, oldCWid);
}
else
return Ok;
}
}


function remapAllTileIdsAfterResize(oldPxWid:Int, oldPxHei:Int) : EditorTypes.ImageLoadingResult {
function remapAllTileIdsAfterResize(oldPxWid:Int, oldPxHei:Int, oldCWid:Int) : EditorTypes.ImageLoadingResult {
App.LOG.warning('Tileset $identifier remapping (image size changed)...');
if( oldPxWid==pxWid && oldPxHei==pxHei )
return Ok;
Expand All @@ -304,7 +305,11 @@ class TilesetDef {
return TrimmedPadding;
}

return remapAllTileIds( dn.M.ceil( oldPxWid/tileGridSize ) );
// Height-only expansion with unchanged grid width: existing tile IDs are still valid
if( oldPxWid==pxWid && oldCWid==cWid && oldPxHei<pxHei )
return Ok;

return remapAllTileIds(oldCWid);
}


Expand Down