mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
Merge branch 'MDL-77679' of https://github.com/mkassaei/moodle
This commit is contained in:
commit
74256e9979
2
question/type/ddwtos/amd/build/ddwtos.min.js
vendored
2
question/type/ddwtos/amd/build/ddwtos.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -373,6 +373,11 @@ define([
|
||||
var oldDrag = this.getCurrentDragInPlace(this.getPlace(drop));
|
||||
if (oldDrag.length !== 0) {
|
||||
var currentPlace = this.getClassnameNumericSuffix(oldDrag, 'inplace');
|
||||
// When infinite group and there is already a drag in a drop, reject the exact clone in the same drop.
|
||||
if (this.hasDropSameDrag(currentPlace, drop, oldDrag, drag)) {
|
||||
this.sendDragHome(drag);
|
||||
return;
|
||||
}
|
||||
var hiddenDrop = this.getDrop(oldDrag, currentPlace);
|
||||
hiddenDrop.addClass('active');
|
||||
oldDrag.addClass('beingdragged');
|
||||
@ -399,6 +404,25 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* When infinite group and there is already a drag in a drop, reject the exact clone in the same drop.
|
||||
*
|
||||
* @param {int} currentPlace the position of the current drop.
|
||||
* @param {jQuery} drop the drop containing a drag.
|
||||
* @param {jQuery} oldDrag the drag already placed in drop.
|
||||
* @param {jQuery} drag the new drag which is exactly the same (clone) as oldDrag .
|
||||
* @returns {boolean}
|
||||
*/
|
||||
DragDropToTextQuestion.prototype.hasDropSameDrag = function(currentPlace, drop, oldDrag, drag) {
|
||||
if (drag.hasClass('infinite')) {
|
||||
return drop.hasClass('place' + currentPlace) &&
|
||||
this.getGroup(drag) === this.getGroup(drop) &&
|
||||
this.getChoice(drag) === this.getChoice(oldDrag) &&
|
||||
this.getGroup(drag) === this.getGroup(oldDrag);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Animate a drag back to its home.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user