fix(webgl): use stable numeric sort for merging texture pages
The merging-pages index sort used (a, b) => a > b ? 1 : -1, which returns -1 when a === b and violates the comparator contract. Use (a, b) => a - b for ascending numeric order. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -191,7 +191,7 @@ export class TextureAtlas implements ITextureAtlas {
|
||||
return newPage;
|
||||
}
|
||||
|
||||
const sortedMergingPagesIndexes = mergingPages.map(e => e.glyphs[0].texturePage).sort((a, b) => a > b ? 1 : -1);
|
||||
const sortedMergingPagesIndexes = mergingPages.map(e => e.glyphs[0].texturePage).sort((a, b) => a - b);
|
||||
const mergedPageIndex = this.pages.length - mergingPages.length;
|
||||
|
||||
// Merge into the new page
|
||||
|
||||
Reference in New Issue
Block a user