MarkTraceur has uploaded a new change for review.
https://gerrit.wikimedia.org/r/82561
Change subject: Pull changes from multilightbox
......................................................................
Pull changes from multilightbox
Fixes for resizing the image - should make things a little nicer
Change-Id: I52ea4fcf0cb8b4ee3a6e2ca835f846264fffae3b
---
M js/multilightbox/lightboximage.js
M js/multilightbox/lightboxinterface.js
2 files changed, 12 insertions(+), 2 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer
refs/changes/61/82561/1
diff --git a/js/multilightbox/lightboximage.js
b/js/multilightbox/lightboximage.js
index 8205458..f39ecd1 100644
--- a/js/multilightbox/lightboximage.js
+++ b/js/multilightbox/lightboximage.js
@@ -28,11 +28,11 @@
LIP.autoResize = function ( ele ) {
function updateRatios() {
- if ( imgHeight !== 0 ) {
+ if ( imgHeight ) {
imgHeightRatio = imgMaxHeight / imgHeight;
}
- if ( imgHeight !== 0 ) {
+ if ( imgWidth ) {
imgWidthRatio = imgMaxWidth / imgWidth;
}
}
@@ -47,6 +47,14 @@
imgWidth = $img.width(),
imgHeight = $img.height();
+ if ( this.globalMaxWidth && imgMaxWidth > this.globalMaxWidth )
{
+ imgMaxWidth = this.globalMaxWidth;
+ }
+
+ if ( this.globalMaxHeight && imgMaxHeight >
this.globalMaxHeight ) {
+ imgMaxHeight = this.globalMaxHeight;
+ }
+
updateRatios();
if ( imgWidth > imgMaxWidth ) {
diff --git a/js/multilightbox/lightboxinterface.js
b/js/multilightbox/lightboxinterface.js
index 24af0ea..9a4edc4 100644
--- a/js/multilightbox/lightboxinterface.js
+++ b/js/multilightbox/lightboxinterface.js
@@ -128,6 +128,8 @@
var ele = image.getImageElement( function () {
iface.$image = $( ele );
iface.$imageDiv.html( ele );
+ image.globalMaxWidth = iface.$image.width();
+ image.globalMaxHeight = iface.$image.height();
image.autoResize( ele );
window.addEventListener( 'resize', function () {
--
To view, visit https://gerrit.wikimedia.org/r/82561
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I52ea4fcf0cb8b4ee3a6e2ca835f846264fffae3b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits