fix: draw last frame at @idraw/render

This commit is contained in:
chenshenhai 2021-11-19 21:39:49 +08:00
parent c831a19d6c
commit edaf29b144
2 changed files with 8 additions and 4 deletions

View file

@ -98,6 +98,7 @@ class Core {
scrollX: transfrom.scrollX,
scrollY: transfrom.scrollY,
});
this[_renderer].thaw();
this[_renderer].render(this[_board].getContext(), this[_data], {
changeResourceUUIDs: opts?.resourceChangeUUIDs || []
});

View file

@ -116,14 +116,14 @@ export default class Renderer extends RendererEvent {
return this[_ctx]
}
thaw() {
this[_status] = DrawStatus.FREE;
}
private [_freeze]() {
this[_status] = DrawStatus.FREEZE;
}
// private _thaw() {
// this[_status] = DrawStatus.FREE;
// }
private [_drawFrame]() {
if (this[_status] === DrawStatus.FREEZE) {
return;
@ -164,6 +164,9 @@ export default class Renderer extends RendererEvent {
this.trigger('drawFrame', { t: Date.now() })
if (this[_loader].isComplete() === true && this[_queue].length === 1 && this[_status] === DrawStatus.FREE) {
if (ctx && this[_queue][0] && this[_queue][0].data) {
drawContext(ctx, this[_queue][0].data, this[_loader]);
}
this.trigger('drawFrameComplete', { t: Date.now() });
this[_freeze]();
}