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

ui-spacetimechart: handle devicePixelRatio changes #918

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

emersion
Copy link
Member

Introduce a small hook to listen to devicePixelRatio changes. Useful to react to browser zoom or switching a window between HiDPI/LoDPI screens (and still render a crisp frame in these cases).

Introduce a small hook to listen to devicePixelRatio changes.
Useful to react to browser zoom or switching a window between
HiDPI/LoDPI screens (and still render a crisp frame in these cases).

Signed-off-by: Simon Ser <[email protected]>
@emersion emersion requested a review from a team as a code owner February 19, 2025 16:40
@emersion emersion self-assigned this Feb 19, 2025
@jacomyal
Copy link
Contributor

I'm not sure it's that useful, since I can't imagine a case where DPR is changed without a resize trigger, but the code is real clean and it can't hurt. I didn't know about that smart method to detect DPR changes either, that's really nice.
LGTM!

@emersion
Copy link
Member Author

emersion commented Feb 20, 2025

Here are two situations on my machine where devicePixelRatio changes while the ResizeObserver doesn't (checked with a console.log() in updateSize()):

  • Set a fixed width/height on the .space-time-chart HTML element, then zoom/dezoom.
  • On a multi-monitor setup with one HiDPI screen and one LoDPI screen, make the browser window floating and drag it between monitors.

Copy link
Contributor

@kmer2016 kmer2016 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@emersion emersion added this pull request to the merge queue Feb 20, 2025
Merged via the queue into dev with commit 9067771 Feb 20, 2025
6 checks passed
@emersion emersion deleted the emr/device-pixel-ratio-change branch February 20, 2025 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants