From a26a14745048a31a79257f0df66f941c7b5a9b0b Mon Sep 17 00:00:00 2001 From: j Date: Thu, 5 Dec 2019 15:51:51 +0000 Subject: [PATCH] toggle size --- static/js/documentInfoView.leftovers.js | 32 ++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/static/js/documentInfoView.leftovers.js b/static/js/documentInfoView.leftovers.js index c140ca4..a105adb 100644 --- a/static/js/documentInfoView.leftovers.js +++ b/static/js/documentInfoView.leftovers.js @@ -126,7 +126,7 @@ pandora.ui.documentInfoView = function(data, isMixed) { height: iconHeight + 'px' }) .bindEvent({ - // singleclick: toggleIconSize + singleclick: toggleIconSize }) .appendTo($info), @@ -667,6 +667,36 @@ pandora.ui.documentInfoView = function(data, isMixed) { //renderCapabilities(data.rightslevel); } + function toggleIconSize() { + iconSize = iconSize == 256 ? 512 : 256; + iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio); + iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio); + iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0, + $icon.animate({ + left: margin + iconLeft + 'px', + width: iconWidth + 'px', + height: iconHeight + 'px', + }, 250); + $reflection.animate({ + top: margin + iconHeight + 'px', + width: iconSize + 'px', + height: iconSize / 2 + 'px' + }, 250); + $reflectionIcon.animate({ + left: iconLeft + 'px', + width: iconWidth + 'px', + height: iconHeight + 'px', + }, 250); + $reflectionGradient.animate({ + width: iconSize + 'px', + height: iconSize / 2 + 'px' + }, 250); + $text.animate({ + left: margin + (iconSize == 256 ? 256 : iconWidth) + margin + 'px' + }, 250); + pandora.UI.set({infoIconSize: iconSize}); + } + that.reload = function() { /* var src = '/documents/' + data.id + '/512p.jpg?' + data.modified;