MDL-52365 qtype ddwtos & ddimageortext: 20 drag items IE11/Edge
authorM Kassaei <m.kassaei@open.ac.uk>
Tue, 1 Dec 2015 15:44:59 +0000 (15:44 +0000)
committerM Kassaei <m.kassaei@open.ac.uk>
Tue, 22 Dec 2015 12:36:40 +0000 (12:36 +0000)
question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd-debug.js
question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd-min.js
question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd.js
question/type/ddimageortext/yui/src/ddimageortext/js/ddimageortext.js
question/type/ddwtos/yui/build/moodle-qtype_ddwtos-dd/moodle-qtype_ddwtos-dd-debug.js
question/type/ddwtos/yui/build/moodle-qtype_ddwtos-dd/moodle-qtype_ddwtos-dd-min.js
question/type/ddwtos/yui/build/moodle-qtype_ddwtos-dd/moodle-qtype_ddwtos-dd.js
question/type/ddwtos/yui/src/ddwtos/js/ddwtos.js

index f419dba..ecfeab3 100644 (file)
Binary files a/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd-debug.js and b/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd-debug.js differ
index 9f8b0b6..f8b5a89 100644 (file)
Binary files a/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd-min.js and b/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd-min.js differ
index f419dba..ecfeab3 100644 (file)
Binary files a/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd.js and b/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd.js differ
index 69bf51d..98af8f4 100644 (file)
@@ -258,7 +258,13 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
                                                 false, 10, this.create_all_drag_and_drops);
         this.doc.drag_item_homes().after('load', this.poll_for_image_load, this,
                                                 false, 10, this.create_all_drag_and_drops);
-        Y.later(500, this, this.reposition_drags_for_question, [this.pendingid], true);
+        if (!this.get('readonly')) {
+            Y.later(500, this, this.reposition_drags_for_question, true);
+        } else {
+            Y.one('window').on('resize', function() {
+                this.reposition_drags_for_question();
+            }, this);
+        }
     },
 
     /**
@@ -400,7 +406,7 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
             inputnode.set('value', '');
         }
     },
-    reposition_drags_for_question : function() {
+    reposition_drags_for_question : function(dotimeout) {
         this.doc.drag_items().removeClass('placed');
         this.doc.drag_items().each (function (dragitem) {
             if (dragitem.dd !== undefined) {
@@ -433,6 +439,9 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
                 dragitem.setXY(dragitemhome.getXY());
             }
         }, this);
+        if (dotimeout) {
+            Y.later(500, this, this.reposition_drags_for_question, true);
+        }
     },
     get_choices_for_drop : function(choice, drop) {
         var group = drop.getData('group');
@@ -443,7 +452,7 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
         var dragitems = this.get_choices_for_drop(choice, drop);
         var dragitem = null;
         dragitems.some(function (d) {
-            if (!d.hasClass('placed') && !d.hasClass('yui3-dd-dragging')) {
+            if (this.get('readonly') || (!d.hasClass('placed') && !d.hasClass('yui3-dd-dragging'))) {
                 dragitem = d;
                 return true;
             } else {
index 2bf4732..41b9ad1 100644 (file)
Binary files a/question/type/ddwtos/yui/build/moodle-qtype_ddwtos-dd/moodle-qtype_ddwtos-dd-debug.js and b/question/type/ddwtos/yui/build/moodle-qtype_ddwtos-dd/moodle-qtype_ddwtos-dd-debug.js differ
index dbd600f..f827d75 100644 (file)
Binary files a/question/type/ddwtos/yui/build/moodle-qtype_ddwtos-dd/moodle-qtype_ddwtos-dd-min.js and b/question/type/ddwtos/yui/build/moodle-qtype_ddwtos-dd/moodle-qtype_ddwtos-dd-min.js differ
index 2bf4732..41b9ad1 100644 (file)
Binary files a/question/type/ddwtos/yui/build/moodle-qtype_ddwtos-dd/moodle-qtype_ddwtos-dd.js and b/question/type/ddwtos/yui/build/moodle-qtype_ddwtos-dd/moodle-qtype_ddwtos-dd.js differ
index cd996f2..5fabc79 100644 (file)
@@ -41,7 +41,14 @@ Y.extend(DDWTOS_DD, Y.Base, {
         this.clone_drag_items();
         this.initial_place_of_drag_items();
         this.make_drop_zones();
-        Y.later(500, this, this.position_drag_items, [pendingid], true);
+        if (!this.get('readonly')) {
+            Y.later(500, this, this.position_drag_items, [pendingid, true]);
+        } else {
+            Y.later(500, this, this.position_drag_items, [pendingid]);
+            Y.one('window').on('resize', function() {
+                this.position_drag_items(pendingid);
+            }, this);
+        }
     },
     /**
      * put all our selectors in the same place so we can quickly find and change them later
@@ -296,9 +303,12 @@ Y.extend(DDWTOS_DD, Y.Base, {
     remove_drag_from_drop : function (drop) {
         this.place_drag_in_drop(null, drop);
     },
-    position_drag_items : function (pendingid) {
+    position_drag_items : function (pendingid, dotimeout) {
        Y.all(this.selectors.drags()).each(this.position_drag_item, this);
        M.util.js_complete(pendingid);
+       if (dotimeout) {
+           Y.later(500, this, this.position_drag_items, [pendingid, true]);
+       }
     },
     position_drag_item : function (drag) {
         if (!drag.hasClass('yui3-dd-dragging')) {