diff options
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/filelist.js | 3 | ||||
-rw-r--r-- | apps/files/js/mainfileinfodetailview.js | 31 | ||||
-rw-r--r-- | apps/files/js/newfilemenu.js | 2 |
3 files changed, 31 insertions, 5 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index b4cc71e2d3b..7a025e772c5 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -628,6 +628,9 @@ * Event handler when clicking on a table header */ _onClickHeader: function(e) { + if (this.$table.hasClass('multiselect')) { + return; + } var $target = $(e.target); var sort; if (!$target.is('a')) { diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js index 82cca0d0fb3..39a00d0a5a5 100644 --- a/apps/files/js/mainfileinfodetailview.js +++ b/apps/files/js/mainfileinfodetailview.js @@ -10,7 +10,7 @@ (function() { var TEMPLATE = - '<div class="thumbnailContainer"><a href="#" class="thumbnail action-default"></a></div>' + + '<div class="thumbnailContainer"><a href="#" class="thumbnail action-default"><div class="stretcher"/></a></div>' + '<div class="file-details-container">' + '<div class="fileName"><h3 title="{{name}}" class="ellipsis">{{name}}</h3></div>' + ' <div class="file-details ellipsis">' + @@ -140,13 +140,18 @@ }, loadPreview: function(path, mime, etag, $iconDiv, $container, isImage) { - var maxImageHeight = ($container.parent().width() + 50) / (16/9); // 30px for negative margin + var maxImageWidth = $container.parent().width() + 50; // 50px for negative margins + var maxImageHeight = maxImageWidth / (16/9); var smallPreviewSize = 75; var isLandscape = function(img) { return img.width > (img.height * 1.2); }; + var isSmall = function(img) { + return (img.width * 1.1) < (maxImageWidth * window.devicePixelRatio); + }; + var getTargetHeight = function(img) { if(isImage) { var targetHeight = img.height / window.devicePixelRatio; @@ -159,13 +164,23 @@ } }; + var getTargetRatio = function(img){ + var ratio = img.width / img.height; + if (ratio > 16/9) { + return ratio; + } else { + return 16/9; + } + }; + this._fileList.lazyLoadPreview({ path: path, mime: mime, etag: etag, y: isImage ? maxImageHeight : smallPreviewSize, - x: isImage ? 99999 /* only limit on y */ : smallPreviewSize, + x: isImage ? maxImageWidth : smallPreviewSize, a: isImage ? 1 : null, + mode: isImage ? 'cover' : null, callback: function (previewUrl, img) { $iconDiv.previewImg = previewUrl; @@ -176,7 +191,7 @@ $iconDiv.removeClass('icon-loading icon-32'); var targetHeight = getTargetHeight(img); if (this.model.isImage() && targetHeight > smallPreviewSize) { - $container.addClass(isLandscape(img)? 'landscape': 'portrait'); + $container.addClass((isLandscape(img) && !isSmall(img))? 'landscape': 'portrait'); $container.addClass('image'); } @@ -184,7 +199,13 @@ // when we dont have a preview we show the mime icon in the error handler $iconDiv.css({ 'background-image': 'url("' + previewUrl + '")', - height: (isLandscape(img) && targetHeight > smallPreviewSize)? 'auto': targetHeight + height: (targetHeight > smallPreviewSize)? 'auto': targetHeight, + 'max-height': isSmall(img)? targetHeight: null + }); + + var targetRatio = getTargetRatio(img); + $iconDiv.find('.stretcher').css({ + 'padding-bottom': (100 / targetRatio) + '%' }); }.bind(this), error: function () { diff --git a/apps/files/js/newfilemenu.js b/apps/files/js/newfilemenu.js index 4c021e6b873..b07999821d5 100644 --- a/apps/files/js/newfilemenu.js +++ b/apps/files/js/newfilemenu.js @@ -84,6 +84,8 @@ OC.hideMenus(); } else { event.preventDefault(); + this.$el.find('.menuitem.active').removeClass('active'); + $target.addClass('active'); this._promptFileName($target); } }, |