-
Notifications
You must be signed in to change notification settings - Fork 10
feat(replay): Manual snapshots can skip rAF #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(replay): Manual snapshots can skip rAF #247
Conversation
Changes `snapshot()` to skip rAF. This should fix some cases where manual snapshots were not able to capture the canvas buffer. Cleaned up the code a bit and fixes the `initCanvasFPSObserver` so we can properly clean-up the recording loop.
| }); | ||
| } | ||
|
|
||
| public snapshot(canvasElement?: HTMLCanvasElement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved so its grouped with the other public methods.
| rafId = onRequestAnimationFrame(rafCallback); | ||
|
|
||
| this.restoreHandlers.push(() => { | ||
| cancelAnimationFrame(rafId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didn't work as expected since takeSnapshot() loops on itself and this rafId is only for the first call.
| private getCanvasElements( | ||
| blockClass?: blockClass, | ||
| blockSelector?: string | null, | ||
| unblockSelector?: string | null, | ||
| ): HTMLCanvasElement[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted from inside of takeSnapshot
Adds an option to
snapshot()to skip rAF. This should fix some cases where manual snapshots were not able to capture the canvas buffer.Also cleans up the code a bit and fixes the
initCanvasFPSObserverso we can properly clean-up the recording loop.