From: Jun Pataleta Date: Tue, 10 Nov 2020 06:08:57 +0000 (+0800) Subject: Merge branch 'MDL-69930-310' of https://github.com/HuongNV13/moodle into MOODLE_310_S... X-Git-Tag: v3.10.1~93 X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=commitdiff_plain;h=e803a24401fb20ebb403e3341edbb815b6af61ae Merge branch 'MDL-69930-310' of https://github.com/HuongNV13/moodle into MOODLE_310_STABLE # Conflicts: # question/type/ddimageortext/amd/build/question.min.js # question/type/ddimageortext/amd/build/question.min.js.map # question/type/ddimageortext/amd/src/question.js --- e803a24401fb20ebb403e3341edbb815b6af61ae diff --cc question/type/ddimageortext/amd/build/question.min.js index ddab8b6b09f,e5c040f9161..7bebe76cc34 Binary files differ diff --cc question/type/ddimageortext/amd/build/question.min.js.map index e731d7163b3,75f4f821fbd..801f7400072 Binary files differ diff --cc question/type/ddimageortext/amd/src/question.js index bdd8d17c4ea,f3318d3c2ef..c62e6119af4 --- a/question/type/ddimageortext/amd/src/question.js +++ b/question/type/ddimageortext/amd/src/question.js @@@ -377,8 -375,7 +377,8 @@@ define(['jquery', 'core/dragdrop', 'cor }); this.getRoot().find('.draghome.placed.group' + this.getGroup(drag)).not('.beingdragged').each(function(i, dropNode) { var drop = $(dropNode); - if (thisQ.isPointInDrop(pageX, pageY, drop) && !highlighted) { - if (thisQ.isPointInDrop(pageX, pageY, drop) && !thisQ.isDragSameAsDrop(drag, drop)) { ++ if (thisQ.isPointInDrop(pageX, pageY, drop) && !highlighted && !thisQ.isDragSameAsDrop(drag, drop)) { + highlighted = true; drop.addClass('valid-drag-over-drop'); } else { drop.removeClass('valid-drag-over-drop'); @@@ -413,24 -408,21 +413,24 @@@ return false; // Stop the each() here. }); - root.find('.draghome.placed.group' + this.getGroup(drag)).not('.beingdragged').each(function(i, placedNode) { - var placedDrag = $(placedNode); - if (!thisQ.isPointInDrop(pageX, pageY, placedDrag) || thisQ.isDragSameAsDrop(drag, placedDrag)) { - // Not this placed drag. - return true; - } + if (!placed) { + // Looking for drag that was dropped on a placed drag. + root.find('.draghome.placed.group' + this.getGroup(drag)).not('.beingdragged').each(function(i, placedNode) { + var placedDrag = $(placedNode); - if (!thisQ.isPointInDrop(pageX, pageY, placedDrag)) { ++ if (!thisQ.isPointInDrop(pageX, pageY, placedDrag) || thisQ.isDragSameAsDrop(drag, placedDrag)) { + // Not this placed drag. + return true; + } - // Now put this drag into the drop. - placedDrag.removeClass('valid-drag-over-drop'); - var currentPlace = thisQ.getClassnameNumericSuffix(placedDrag, 'inplace'); - var drop = thisQ.getDrop(drag, currentPlace); - thisQ.sendDragToDrop(drag, drop); - placed = true; - return false; // Stop the each() here. - }); + // Now put this drag into the drop. + placedDrag.removeClass('valid-drag-over-drop'); + var currentPlace = thisQ.getClassnameNumericSuffix(placedDrag, 'inplace'); + var drop = thisQ.getDrop(drag, currentPlace); + thisQ.sendDragToDrop(drag, drop); + placed = true; + return false; // Stop the each() here. + }); + } if (!placed) { this.sendDragHome(drag);