Gergő Tisza has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/191825

Change subject: Fix IE crop/stretch problems
......................................................................

Fix IE crop/stretch problems

It seems that IE11 sometimes does not keep the aspect ratio when
the width DOM property is set but height is not.

Also attempt to clarify what the two similar canvas setters are
good for, to the extent I could figure it out.

Bug: T89679
Change-Id: I9c87e2146e3d99d1ee00d7c00142b2ae1c3d7951
---
M resources/mmv/ui/mmv.ui.canvas.js
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer 
refs/changes/25/191825/1

diff --git a/resources/mmv/ui/mmv.ui.canvas.js 
b/resources/mmv/ui/mmv.ui.canvas.js
index 2ed1f2f..fef3c7d 100644
--- a/resources/mmv/ui/mmv.ui.canvas.js
+++ b/resources/mmv/ui/mmv.ui.canvas.js
@@ -102,7 +102,10 @@
        };
 
        /**
-        * Sets contained image.
+        * Sets image on the canvas; does not resize it to fit. This is used to 
make the placeholder
+        * image available; it will be resized and displayed by 
#maybeDisplayPlaceholder().
+        * FIXME maybeDisplayPlaceholder() receives the placeholder so it is 
very unclear why this
+        * is necessary at all (apart from setting the LightboxImage, which is 
used in size calculations).
         * @param {mw.mmv.LightboxImage} imageRawMetadata
         * @param {jQuery} $imageElement
         */
@@ -117,8 +120,8 @@
        };
 
        /**
-        * Sets contained image and also the max dimensions. Called while 
resizing the viewer.
-        * Assumes set function called before.
+        * Resizes image to the given dimensions and displays it on the canvas.
+        * This is used to display the actual image; it assumes set function 
was already called before.
         * @param {mw.mmv.model.Thumbnail} thumbnail thumbnail information
         * @param {HTMLImageElement} imageElement
         * @param {mw.mmv.model.ThumbnailWidth} imageWidths
@@ -129,6 +132,7 @@
                // we downscale larger images but do not scale up smaller ones, 
that would look ugly
                if ( thumbnail.width > imageWidths.cssWidth ) {
                        imageElement.width = imageWidths.cssWidth;
+                       imageElement.height = imageWidths.cssHeight;
                }
 
                if ( !this.$image.is( imageElement ) ) { // 
http://bugs.jquery.com/ticket/4087

-- 
To view, visit https://gerrit.wikimedia.org/r/191825
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c87e2146e3d99d1ee00d7c00142b2ae1c3d7951
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to