Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upMake collages resolution independent #144
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Apanatshka
Jan 26, 2015
I took a look at the support for devicePixelRatio on MDN which in turn refers to PPK. I would suggest that you use a local variable and default the value to 1 if window.devicePixelRatio doesn't exist:
devicePixelRatio = window.devicePixelRatio || 1;
And please note that MDN says this property doesn't get updated if the browser is moved between screens with different device pixel ratios.
Apanatshka
commented
Jan 26, 2015
|
I took a look at the support for
And please note that MDN says this property doesn't get updated if the browser is moved between screens with different device pixel ratios. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Jan 26, 2015
Member
Great, thank you so much! :D
I think there is one place that needs to know about the new initial scale though. Specifically when dealing with an Element inserted with toForm. I believe there's something like createTransform that needs its initial configuration updated.
|
Great, thank you so much! :D I think there is one place that needs to know about the new initial scale though. Specifically when dealing with an |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Jan 26, 2015
Member
Is there an event that triggers when windew.devicePixelRatio changes?
There is already a mechanism to do a redraw asynchronously (for images), so I assume that could be reused?
|
Is there an event that triggers when There is already a mechanism to do a redraw asynchronously (for images), so I assume that could be reused? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
salutis
Jan 26, 2015
Contributor
MDN says: There are no callbacks or events to listen to when this value changes (for example, if you drag the window between displays with different densities).
|
MDN says: There are no callbacks or events to listen to when this value changes (for example, if you drag the window between displays with different densities). |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Jan 26, 2015
Member
Oh, I guess the toForm stuff should work the same, maybe I was wrong about that! Do you mind testing toForm thing to see if it is the right size?
Hmm, is there a recommended behavior for apps that need to cross from screen to screen? I assume going low to high is not a big deal, but is the reverse true?
Also, if the dimensions of the canvas are set initially, but then the scaling is done on a per-render bases, is it possible for them to get out of sync with each other?
|
Oh, I guess the Hmm, is there a recommended behavior for apps that need to cross from screen to screen? I assume going low to high is not a big deal, but is the reverse true? Also, if the dimensions of the canvas are set initially, but then the scaling is done on a per-render bases, is it possible for them to get out of sync with each other? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
salutis
Jan 26, 2015
Contributor
@evancz, I've just tried to embed Clock using toForm like this:
collage 400 400 [(toForm (collage 400 400 ...
... and it works as expected. Is that what you saying?
|
@evancz, I've just tried to embed Clock using |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Jan 26, 2015
Member
Yeah, I was worried it might show up half size or something. Another example would be adding toForm (image 20 20 "http://elm-lang.org/yogi.jpg") and see if it comes out 20x20.
|
Yeah, I was worried it might show up half size or something. Another example would be adding |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Jan 26, 2015
Member
Does the question about crossing from a normal monitor to a hi-DPI monitor make sense?
|
Does the question about crossing from a normal monitor to a hi-DPI monitor make sense? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
salutis
Jan 26, 2015
Contributor
@evancz No issues. This:
collage 400 400 [toForm (image 20 20 "http://elm-lang.org/yogi.jpg")]
... draws exactly the same output as with http://elm-lang.org/try.
|
@evancz No issues. This: |
evancz
merged commit c8f7c86
into
elm:master
Jan 27, 2015
1 check passed
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Jan 27, 2015
Member
Ah, I have read through the code all in one go and my concern is not realized there. Transferring from lo to hi should be no problem. Thanks a ton for working on this @salutis!
|
Ah, I have read through the code all in one go and my concern is not realized there. Transferring from lo to hi should be no problem. Thanks a ton for working on this @salutis! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
My pleasure, @evancz! |
salutis commentedJan 26, 2015
This should make Elm more usable on modern systems with high-resolution screens. Tested with Retina MacBook Pro 15".
Related discussion: https://groups.google.com/forum/#!topic/elm-discuss/pq1KS8XgFiQ