Skip to content

Commit caa32ba

Browse files
committed
Always show full previews
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent 3f4941e commit caa32ba

2 files changed

Lines changed: 15 additions & 21 deletions

File tree

apps/files/css/detailsView.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,13 @@
7272
}
7373

7474
#app-sidebar .thumbnail {
75-
width: 75px;
76-
height: 75px;
75+
width: 100%;
76+
min-height: 75px;
7777
display: inline-block;
7878
float: left;
7979
margin-right: 10px;
80-
background-size: 75px;
80+
background-size: contain;
81+
background-repeat: no-repeat;
8182
}
8283

8384
#app-sidebar .ellipsis {

apps/files/js/sidebarpreviewmanager.js

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
var isImage = model.isImage();
6161
var maxImageWidth = $thumbnailContainer.parent().width() + 50; // 50px for negative margins
6262
var maxImageHeight = maxImageWidth / (16 / 9);
63-
var smallPreviewSize = 75;
6463

6564
var isLandscape = function (img) {
6665
return img.width > (img.height * 1.2);
@@ -71,15 +70,11 @@
7170
};
7271

7372
var getTargetHeight = function (img) {
74-
if (isImage) {
75-
var targetHeight = img.height / window.devicePixelRatio;
76-
if (targetHeight <= smallPreviewSize) {
77-
targetHeight = smallPreviewSize;
78-
}
79-
return targetHeight;
80-
} else {
81-
return smallPreviewSize;
73+
var targetHeight = img.height / window.devicePixelRatio;
74+
if (targetHeight <= maxImageHeight) {
75+
targetHeight = maxImageHeight;
8276
}
77+
return targetHeight;
8378
};
8479

8580
var getTargetRatio = function (img) {
@@ -96,10 +91,10 @@
9691
path: model.getFullPath(),
9792
mime: model.get('mimetype'),
9893
etag: model.get('etag'),
99-
y: isImage ? maxImageHeight : smallPreviewSize,
100-
x: isImage ? maxImageWidth : smallPreviewSize,
101-
a: isImage ? 1 : null,
102-
mode: isImage ? 'cover' : null,
94+
y: maxImageHeight,
95+
x: maxImageWidth,
96+
a: 1,
97+
mode: 'cover',
10398
callback: function (previewUrl, img) {
10499
$thumbnailDiv.previewImg = previewUrl;
105100

@@ -109,16 +104,14 @@
109104
}
110105
$thumbnailDiv.removeClass('icon-loading icon-32');
111106
var targetHeight = getTargetHeight(img);
112-
if (isImage && targetHeight > smallPreviewSize) {
113-
$thumbnailContainer.addClass((isLandscape(img) && !isSmall(img)) ? 'landscape' : 'portrait');
114-
$thumbnailContainer.addClass('large');
115-
}
107+
$thumbnailContainer.addClass((isLandscape(img) && !isSmall(img)) ? 'landscape' : 'portrait');
108+
$thumbnailContainer.addClass('large');
116109

117110
// only set background when we have an actual preview
118111
// when we don't have a preview we show the mime icon in the error handler
119112
$thumbnailDiv.css({
120113
'background-image': 'url("' + previewUrl + '")',
121-
height: (targetHeight > smallPreviewSize) ? 'auto' : targetHeight,
114+
height: (targetHeight > maxImageHeight) ? 'auto' : targetHeight,
122115
'max-height': isSmall(img) ? targetHeight : null
123116
});
124117

0 commit comments

Comments
 (0)