mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'MDL-69930-master' of https://github.com/HuongNV13/moodle
# 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
This commit is contained in:
commit
84b7d23334
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -377,7 +377,7 @@ define(['jquery', 'core/dragdrop', 'core/key_codes'], function($, dragDrop, keys
|
||||
});
|
||||
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) && !highlighted && !thisQ.isDragSameAsDrop(drag, drop)) {
|
||||
highlighted = true;
|
||||
drop.addClass('valid-drag-over-drop');
|
||||
} else {
|
||||
@ -417,7 +417,7 @@ define(['jquery', 'core/dragdrop', 'core/key_codes'], function($, dragDrop, keys
|
||||
// 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;
|
||||
}
|
||||
@ -925,6 +925,17 @@ define(['jquery', 'core/dragdrop', 'core/key_codes'], function($, dragDrop, keys
|
||||
return zIndex;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check that the drag is drop to it's clone.
|
||||
*
|
||||
* @param {jQuery} drag The drag.
|
||||
* @param {jQuery} drop The drop.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
DragDropOntoImageQuestion.prototype.isDragSameAsDrop = function(drag, drop) {
|
||||
return this.getChoice(drag) === this.getChoice(drop) && this.getGroup(drag) === this.getGroup(drop);
|
||||
};
|
||||
|
||||
/**
|
||||
* Singleton object that handles all the DragDropOntoImageQuestions
|
||||
* on the page, and deals with event dispatching.
|
||||
@ -1004,6 +1015,8 @@ define(['jquery', 'core/dragdrop', 'core/key_codes'], function($, dragDrop, keys
|
||||
* @param {jQuery} element Element to bind the event
|
||||
*/
|
||||
addEventHandlersToDrag: function(element) {
|
||||
// Unbind all the mousedown and touchstart events to prevent double binding.
|
||||
element.unbind('mousedown touchstart');
|
||||
element.on('mousedown touchstart', questionManager.handleDragStart);
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user