feat: TextureStore 根据别名获取 id

This commit is contained in:
AncTe committed 2025-10-24 19:20:51 +08:00
1 parent 4fd2fa168b
commit dc98244a08
3 files changed
+11 -1

No files matched your search

+4
View File
@@ -99,4 +99,8 @@ export class TextureStore implements ITextureStore {
aliasOf(identifier: number): string | undefined {
return this.aliasInvMap.get(identifier);
}
identifierOf(alias: string): number | undefined {
return this.aliasMap.get(alias);
}
}
+1 -1
View File
@@ -110,7 +110,7 @@ export class TextureMaxRectsStreamComposer
readonly maxWidth: number,
readonly maxHeight: number,
readonly padding: number,
options: IOption
options?: IOption
) {
this.packer = new MaxRectsPacker<MaxRectsRectangle>(
this.maxWidth,
+6
View File
@@ -219,6 +219,12 @@ export interface ITextureStore {
*/
fromAlias(alias: string): ITexture | null;
/**
* 根据贴图对象别名获取贴图对象 id
* @param alias 贴图对象别名
*/
identifierOf(alias: string): number | undefined;
/**
* 根据贴图对象获取此贴图对象在此控制器中的 id,如果贴图不在此控制器,返回 `undefined`
* @param texture 贴图对象