Merge branch 'MDL-68446' of https://github.com/timhunt/moodle
[moodle.git] / question / type / ddimageortext / amd / src / form.js
index eca7993..6147e6b 100644 (file)
@@ -48,13 +48,8 @@ define(['jquery', 'core/dragdrop'], function($, dragDrop) {
 
         /**
          * Initialise the form javascript features.
-         *
-         * @param {Object} maxBgImageSize object with two properties: width and height.
-         * @param {Object} maxDragImageSize object with two properties: width and height.
          */
-        init: function(maxBgImageSize, maxDragImageSize) {
-            dragDropToImageForm.maxBgImageSize = maxBgImageSize;
-            dragDropToImageForm.maxDragImageSize = maxDragImageSize;
+        init: function() {
             dragDropToImageForm.fp = dragDropToImageForm.filePickers();
 
             $('#id_previewareaheader').append(
@@ -108,27 +103,10 @@ define(['jquery', 'core/dragdrop'], function($, dragDrop) {
          * After the background image is loaded, continue setting up the preview.
          */
         afterPreviewImageLoaded: function() {
-            var bgImg = $('fieldset#id_previewareaheader .dropbackground');
-            dragDropToImageForm.constrainImageSize(bgImg, dragDropToImageForm.maxBgImageSize);
             dragDropToImageForm.createDropZones();
             M.util.js_complete('dragDropToImageForm');
         },
 
-        /**
-         * Limits an image display size to the given maximums.
-         *
-         * @param {jQuery} img the image.
-         * @param {Object} maxSize with width and height properties.
-         */
-        constrainImageSize: function(img, maxSize) {
-            var reduceby = Math.max(img.width() / maxSize.width,
-                img.height() / maxSize.height);
-            if (reduceby > 1) {
-                img.css('width', Math.floor(img.width() / reduceby));
-            }
-            img.addClass('constrained');
-        },
-
         /**
          * Create, or recreate all the drop zones.
          */
@@ -532,9 +510,6 @@ define(['jquery', 'core/dragdrop'], function($, dragDrop) {
     return {
         /**
          * Initialise the form JavaScript features.
-         *
-         * @param {Object} maxBgImageSize object with two properties: width and height.
-         * @param {Object} maxDragImageSize object with two properties: width and height.
          */
         init: dragDropToImageForm.init
     };