-
Notifications
You must be signed in to change notification settings - Fork 131
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
fix: canvas recording patches #1082
Conversation
Size Change: +459 B (0%) Total Size: 942 kB
ℹ️ View Unchanged
|
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.
nice
I ended up switching off auto-formatting and finding out how to save without formatting no matter what to avoid adding lots of whitespacee to the patch
but that's nitpicky
yeah that sounds like a good idea, its also easier to review/less chance of conflicts |
@daibhin I did CMD + shift + P in vs code, found "save without formatting", and then bound some keys to it. For me I bound CMD + S since I don't work in vscode full time. But then we'll see the diff of just the lines you changed pretty plz and thank you 😊 |
+ // The browser throws if the canvas is 0 in size | ||
+ // Uncaught (in promise) DOMException: Failed to execute 'createImageBitmap' on 'Window': The source image width is 0. | ||
+ // Assuming the same happens with height | ||
+ if (canvas.width === 0 || canvas.height === 0) return; | ||
+ |
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 this up based on rrweb-io/rrweb@d860a4b
@pauldambra done! TIL disabling Prettier requires VS Code to be restarted to take effect |
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.
🚢
way nicer diff 😍
Changes
Closes PostHog/posthog-flutter#69
Main aim is to support session recording in Flutter!
Does so in two ways:
Support canvas capture in shadow roots
getCanvas
method to also traverse shadow rootsCapture correct canvas size
width
andheight
attributes which set the internal coordinates of the canvasclientWidth
andclientHeight
(based on this description) properties of the canvas to resize the output image when callingcreateImageBitmap
Checklist