Skip to content

Commit

Permalink
Merge pull request #899 from connection-reset/hidpi
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Jun 5, 2021
2 parents 7f91121 + c7aceae commit 46e17ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/mixins/PreviewUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,17 @@ export default {
* @returns {String} the absolute url
*/
getPreviewIfAny({ fileid, filename, hasPreview, davPath }) {
const searchParams = `fileId=${fileid}`
+ `&x=${Math.floor(screen.width * devicePixelRatio)}`
+ `&y=${Math.floor(screen.height * devicePixelRatio)}`
+ '&a=true'

if (hasPreview) {
// TODO: find a nicer standard way of doing this?
if (isPublic()) {
return generateUrl(`/apps/files_sharing/publicpreview/${getToken()}?fileId=${fileid}&file=${encodeFilePath(filename)}&x=${screen.width}&y=${screen.height}&a=true`)
return generateUrl(`/apps/files_sharing/publicpreview/${getToken()}?file=${encodeFilePath(filename)}&${searchParams}`)
}
return generateUrl(`/core/preview?fileId=${fileid}&x=${screen.width}&y=${screen.height}&a=true`)
return generateUrl(`/core/preview?${searchParams}`)
}
return davPath
},
Expand Down

0 comments on commit 46e17ee

Please sign in to comment.