Skip to content

Commit

Permalink
fix: add draw frame callback
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoiver committed Mar 19, 2024
1 parent db01fac commit 439f0a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/g-canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-canvas",
"version": "0.5.16",
"version": "0.5.17",
"description": "A canvas library which providing 2d",
"main": "lib/index.js",
"module": "esm/index.js",
Expand Down
4 changes: 4 additions & 0 deletions packages/g-canvas/src/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class Canvas extends AbstractCanvas {
// 触发绘制
_startDraw() {
let drawFrame = this.get('drawFrame');
let drawFrameCallback = this.get('drawFrameCallback');
if (!drawFrame) {
drawFrame = requestAnimationFrame(() => {
if (this.get('localRefresh')) {
Expand All @@ -222,6 +223,9 @@ class Canvas extends AbstractCanvas {
this._drawAll();
}
this.set('drawFrame', null);
if (drawFrameCallback) {
drawFrameCallback();
}
});
this.set('drawFrame', drawFrame);
}
Expand Down

0 comments on commit 439f0a2

Please sign in to comment.