Fixes from MLB upstream

Bug: 56054
Bug: 56059
Change-Id: I549ba702c3b9bf9adec9fab692664eec1ff90005
This commit is contained in:
Mark Holmquist 2013-10-23 16:35:05 -07:00 committed by MarkTraceur
parent ea778e990f
commit 4dd724838d
2 changed files with 9 additions and 5 deletions

View file

@ -26,7 +26,7 @@
return ele;
};
LIP.autoResize = function ( ele ) {
LIP.autoResize = function ( ele, ratio ) {
function updateRatios() {
if ( imgHeight ) {
imgHeightRatio = imgMaxHeight / imgHeight;
@ -38,12 +38,13 @@
}
var imgWidthRatio, imgHeightRatio,
multRatio = ratio || 0.5,
$window = $( window ),
winWidth = $window.width(),
winHeight = $window.height(),
$img = $( ele ),
imgMaxWidth = winWidth * 0.5,
imgMaxHeight = winHeight * 0.5,
imgMaxWidth = winWidth * multRatio,
imgMaxHeight = winHeight * multRatio,
imgWidth = $img.width(),
imgHeight = $img.height();

View file

@ -63,6 +63,9 @@
if ( e.keyCode === 27 ) {
// Escape button pressed
lbinterface.unattach();
if ( lbinterface.isFullScreen ) {
lbinterface.fullscreen();
}
}
} );
@ -135,10 +138,10 @@
iface.$imageDiv.html( ele );
image.globalMaxWidth = iface.$image.width();
image.globalMaxHeight = iface.$image.height();
image.autoResize( ele );
image.autoResize( ele, iface.isFullScreen ? 0.9 : 0.5 );
window.addEventListener( 'resize', function () {
image.autoResize( ele );
image.autoResize( ele, iface.isFullScreen ? 0.9 : 0.5 );
} );
lightboxHooks.callAll( 'imageLoaded', iface );