Add fallback preview size for DOM-only reference examples#1218
Add fallback preview size for DOM-only reference examples#1218ksen0 merged 2 commits intoprocessing:mainfrom
Conversation
|
As discussed this PR adds a fallback preview size when no canvas dimensions are detected. The change introduces a 400×300 fallback so those examples render a visible preview, while sketches that use Let me know if this direction looks good or if you would prefer a different fallback approach. |
ksen0
left a comment
There was a problem hiding this comment.
Thanks! Just 2 small things. Also, if possible, could you please revert unrelated changes in this and future PRs? It's harder to review when there's additional spacing/etc lines changed, so it would be really nice to exclude these. With things like regex especially having a more reliable gitblame is also good
…formatting changes
|
Thanks for the review @ksen0 💜 |
ksen0
left a comment
There was a problem hiding this comment.
I'll merge this one to fix the DOM-only examples, but I've changed the PR as "Addresses" because the other examples are still not showing up right (unrelated to size)
|
Yes, this PR only targets the DOM only cases where no canvas size is detected which was causing the preview container to collapse. The remaining examples already define a canvas size, so their rendering issue seems to be coming from a different part of the preview pipeline rather than the sizing logic. I am still figuring it out, will update further. |
Addresses #1204
Example previews on the reference site currently rely on detecting canvas dimensions via
createCanvas().For DOM-only examples (e.g.
createCapture()used withnoCanvas()), no canvas dimensions are detected, causing the preview container to collapse or clip the output.This PR adds a fallback preview size (400×300) when both
previewWidthandpreviewHeightremain undefined. This ensures DOM-based examples render a visible preview.Changes
createCanvas()largeSketchcalculation