-
Notifications
You must be signed in to change notification settings - Fork 54
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
Use physical pixel size for preview resolution #899
Conversation
/backport to stable21 |
/backport to stable20 |
/backport to stable19 |
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.
Hi @connection-reset , thanks for your contribution 👍 .
I looked at your patch, I think the code could be improved by extracting the Math.floor
s into variables. (Or even better: extract everything behind the ?
into a variable)
I made width and height into variables. I tried out moving the whole URL Params into a variable, it is actually worse. |
@connection-reset i changed It to what I think it should be. (and accidentally closed the PR for a sec, sorry) Do you think this is OK @connection-reset? |
That is fine by me, I care more about how the preview looks than how the code does. |
@skjnldsv could you squash and merge this if this is OK for you? (The failing test is the sidebar test ) (
|
I am interested to know what happens if you limit the max preview size to below your screens resolution. Will it fail to request the preview? |
It will not fail, this patch makes no change to how previews work. |
@szaimen, this PR only changes the "max preview width" and "max preview height" send to the server when requesting a preview. The Nextcloud server will then return the largest preview it can give. So with |
@skjnldsv I rebased this on master |
Vm is not officially supported nor maintained by us. We strongly encourage to make sure any default config fits your needs :) |
I know :)
Great, sounds good! :) |
@skjnldsv , I'll merge this if the tests pass. Works for me locally |
Code was inspired by code in an MDN page (in the public domain) https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio getPreviewIfAny: extract queryParams to get preview Signed-off-by: Robbert Gurdeep Singh <[email protected]> Signed-off-by: Axel Pirek <[email protected]>
Fixes #898
MDN has an example for
<canvas>
that I basically copied.The apparent image size stays the same, zoom still works like before.
Does not watch for
devicePixelRatio
changes, eg when moving the browser window from a low DPI screen to a high DPI screen.