Mooeypoo has uploaded a new change for review.

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

Change subject: Deal with images whose size is smalled than default
......................................................................

Deal with images whose size is smalled than default

When an image smaller than the default size, the placeholder 'default'
value will be the image's actual size. This means that if a user selects
default thumb size for the image, it won't be change unless the original
size is bigger than the default. Also adjusted so that default size limits
width only, and not acts as a bounding box on size change.

Bug: 62293
Change-Id: I8341776794843ff63a93bedeadf5921851c57a26
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/31/118231/1

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index a9a77ed..0711073 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -386,15 +386,16 @@
        // of having no type specified
        if ( thumbOrFrameless ) {
 
-               // Set the placeholders to be wiki default
-               if ( this.mediaNode.getAttribute( 'width' ) > 
this.mediaNode.getAttribute( 'height' ) ) {
+               // Set the placeholders to be wiki default, but only if the 
image
+               // is not smaller. Limit on width only (according to wikitext 
default)
+               if ( this.mediaNode.getAttribute( 'width' ) > 
this.defaultThumbSize ) {
                        this.sizeWidget.setPlaceholderDimensions( {
                                'width': this.defaultThumbSize,
                        } );
                } else {
-                       this.sizeWidget.setPlaceholderDimensions( {
-                               'height': this.defaultThumbSize
-                       } );
+                       // The image is smaller than wiki default. Make the 
default dimensions
+                       // the image max size
+                       this.sizeWidget.setPlaceholderDimensions( 
this.sizeWidget.getOriginalDimensions() );
                }
 
                // Enable the size select widget 'default' option

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8341776794843ff63a93bedeadf5921851c57a26
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to