feat: TextureStore 根据别名获取 id

This commit is contained in:
unanmed 2025-10-24 19:20:51 +08:00
parent 4fd2fa168b
commit dc98244a08
3 changed files with 11 additions and 1 deletions

View File

@ -99,4 +99,8 @@ export class TextureStore implements ITextureStore {
aliasOf(identifier: number): string | undefined { aliasOf(identifier: number): string | undefined {
return this.aliasInvMap.get(identifier); return this.aliasInvMap.get(identifier);
} }
identifierOf(alias: string): number | undefined {
return this.aliasMap.get(alias);
}
} }

View File

@ -110,7 +110,7 @@ export class TextureMaxRectsStreamComposer
readonly maxWidth: number, readonly maxWidth: number,
readonly maxHeight: number, readonly maxHeight: number,
readonly padding: number, readonly padding: number,
options: IOption options?: IOption
) { ) {
this.packer = new MaxRectsPacker<MaxRectsRectangle>( this.packer = new MaxRectsPacker<MaxRectsRectangle>(
this.maxWidth, this.maxWidth,

View File

@ -219,6 +219,12 @@ export interface ITextureStore {
*/ */
fromAlias(alias: string): ITexture | null; fromAlias(alias: string): ITexture | null;
/**
* id
* @param alias
*/
identifierOf(alias: string): number | undefined;
/** /**
* id `undefined` * id `undefined`
* @param texture * @param texture