Skip to content
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

Provide some common code to create hidpi canvases? #249

Open
beaufortfrancois opened this issue Apr 14, 2023 · 3 comments
Open

Provide some common code to create hidpi canvases? #249

beaufortfrancois opened this issue Apr 14, 2023 · 3 comments
Labels
issue about many samples Issue about the samples but not a specific one

Comments

@beaufortfrancois
Copy link
Collaborator

@austinEng do we have common code anywhere for creating hidpi canvases? we should, and it should use ResizeObserver to handle devicePixelRatio changes (and forward them to the samples)

Originally posted by @kainino0x in #247 (comment)

@kainino0x
Copy link
Collaborator

Thinking about this a little more while filing another issue - I'm now thinking we should not use hidpi canvases / ResizeObserver in most of the samples. It adds some complexity and I prefer the samples to be more standalone. It's more straightforward for most samples to have fixed canvas sizes, and people have to look at a ResizeObserver or hidpi sample if they want to learn how to do that.

@greggman
Copy link
Collaborator

Switching to iframes, ideally the iframe fills the page with a canvas. That way the sample browser is in control of what size to make the sample appear. Then it can choose a smaller size on mobile. With hardcoded sizes the samples are not mobile friendly

@kainino0x
Copy link
Collaborator

kainino0x commented Feb 29, 2024

The samples are pretty minimal right now and I don't want to complicate all of them with canvas resizing stuff. Maybe I'm worried for nothing and it won't get in the way though. If it does, we could do something like, have samples use an 800x800 drawing buffer, and set up the CSS so the max-width/max-height are 800 css pixels but they can shrink to fit on mobile?

@kainino0x kainino0x added the issue about many samples Issue about the samples but not a specific one label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue about many samples Issue about the samples but not a specific one
Projects
None yet
Development

No branches or pull requests

3 participants