fix: 显伤层报错

This commit is contained in:
unanmed 2024-12-08 21:32:03 +08:00
parent d535fe82c0
commit dbae5a7c7d
2 changed files with 7 additions and 10 deletions

View File

@ -130,24 +130,20 @@ export class BlockCacher<
if (deep & (1 << i)) {
const nowIndex = index * this.cacheDepth + i;
const item = this.cache.get(nowIndex);
if (item) {
item.destroy();
item?.destroy();
this.cache.delete(nowIndex);
}
}
}
}
/**
* {@link clearCache} ->void
*/
clearCacheByIndex(index: number, func: (item: T) => void) {
clearCacheByIndex(index: number) {
const item = this.cache.get(index);
if (item) {
item.destroy();
item?.destroy();
this.cache.delete(index);
}
}
/**
*

View File

@ -503,7 +503,8 @@ export class Damage extends RenderItem<EDamageEvent> {
this.emit('dirtyUpdate', v);
// 否则依次渲染并写入缓存
const temp = cache?.canvas ?? new MotaOffscreenCanvas2D();
const temp =
block.cache.get(v)?.canvas ?? new MotaOffscreenCanvas2D();
temp.clear();
temp.setHD(true);
temp.setAntiAliasing(true);