fix label auto Atlas bug (#15356)

This commit is contained in:
ChiaNing
2023-06-07 18:40:20 +08:00
committed by GitHub
parent 39e7a332ed
commit 58299f0ef4
+8
View File
@@ -122,6 +122,7 @@ export const ttfUtils = {
// use canvas in assemblerData // to do to optimize
processing.setCanvasUsed(comp.assemblerData!.canvas, comp.assemblerData!.context);
style.fontFamily = this._updateFontFamily(comp);
this._resetDynamicAtlas(comp);
// TextProcessing
processing.processingString(false, style, layout, outputLayoutData, comp.string);
@@ -197,4 +198,11 @@ export const ttfUtils = {
dynamicAtlasManager.packToDynamicAtlas(comp, frame);
// TODO update material and uv
},
_resetDynamicAtlas (comp: Label) {
if (comp.cacheMode !== Label.CacheMode.BITMAP) return;
const frame = comp.ttfSpriteFrame!;
dynamicAtlasManager.deleteAtlasSpriteFrame(frame);
frame._resetDynamicAtlasFrame();
},
};