mirror of
https://github.com/idrawjs/idraw
synced 2026-05-23 17:48:23 +00:00
fix: core render loop
This commit is contained in:
parent
a2bec8eda9
commit
f9b5bbb114
2 changed files with 7 additions and 5 deletions
|
|
@ -144,10 +144,9 @@ class Core {
|
|||
this[_selectedUUID] = uuid;
|
||||
} else {
|
||||
const [index] = this[_element].isPointInElement(point, this[_data]);
|
||||
// console.log('index ===', index);
|
||||
this.selectElement(index);
|
||||
}
|
||||
// console.log('this[_mode] =', this[_mode], point)
|
||||
this.draw();
|
||||
}
|
||||
|
||||
private _handleMoveStart(point: TypePoint): void {
|
||||
|
|
|
|||
|
|
@ -52,8 +52,11 @@ export class Renderer {
|
|||
requestAnimationFrame(() => {
|
||||
// console.log('------ render frame ------', this._loader.isComplete())
|
||||
let item: QueueItem | undefined = this._queue[0];
|
||||
let isLastFrame = false;
|
||||
if (this._queue.length > 1) {
|
||||
item = this._queue.shift();
|
||||
} else {
|
||||
isLastFrame = true;
|
||||
}
|
||||
if (this._loader.isComplete() !== true) {
|
||||
this._drawFrame();
|
||||
|
|
@ -62,13 +65,13 @@ export class Renderer {
|
|||
drawContext(ctx, item.data, item.helper, this._loader);
|
||||
this._board.draw();
|
||||
this._retainQueueOneItem();
|
||||
if (this._queue.length > 1) {
|
||||
if (!isLastFrame) {
|
||||
this._drawFrame();
|
||||
} else {
|
||||
this._status = DrawStatus.FREE
|
||||
this._status = DrawStatus.FREE;
|
||||
}
|
||||
} else {
|
||||
this._status = DrawStatus.FREE
|
||||
this._status = DrawStatus.FREE;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue