fix: 缩放后画面消失

This commit is contained in:
unanmed 2024-12-21 23:51:39 +08:00
parent 1203b5618d
commit b018a5fd9a
2 changed files with 17 additions and 2 deletions

View File

@ -345,7 +345,6 @@ export const TextContent = defineComponent<TextContentProps, TextContentEmits>(
*
*/
const rawRender = (text: string, lines: number[]) => {
console.trace();
makeRenderable(text, lines, 0, 0);
spriteElement.value?.update();
};

View File

@ -84,11 +84,27 @@ export class MotaRenderer extends Container {
this.target.delete();
}
/**
*
*/
refreshAll() {
const stack: RenderItem[] = [this];
while (stack.length > 0) {
const item = stack.pop();
if (!item) break;
if (item.children.size === 0) {
item.update();
} else {
item.children.forEach(v => stack.push(v));
}
}
}
static get(id: string) {
return this.list.get(id);
}
}
window.addEventListener('resize', () => {
MotaRenderer.list.forEach(v => v.update(v));
MotaRenderer.list.forEach(v => v.requestAfterFrame(() => v.refreshAll()));
});