mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-69955 qtype_ddimageortext: drop zone disappear in special case
This commit is contained in:
parent
2444c9d9be
commit
d67bcd6b9a
3 changed files with 27 additions and 19 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -364,10 +364,12 @@ define(['jquery', 'core/dragdrop', 'core/key_codes'], function($, dragDrop, keys
|
||||||
* @param {jQuery} drag the item being moved.
|
* @param {jQuery} drag the item being moved.
|
||||||
*/
|
*/
|
||||||
DragDropOntoImageQuestion.prototype.dragMove = function(pageX, pageY, drag) {
|
DragDropOntoImageQuestion.prototype.dragMove = function(pageX, pageY, drag) {
|
||||||
var thisQ = this;
|
var thisQ = this,
|
||||||
|
highlighted = false;
|
||||||
this.getRoot().find('.dropzone.group' + this.getGroup(drag)).each(function(i, dropNode) {
|
this.getRoot().find('.dropzone.group' + this.getGroup(drag)).each(function(i, dropNode) {
|
||||||
var drop = $(dropNode);
|
var drop = $(dropNode);
|
||||||
if (thisQ.isPointInDrop(pageX, pageY, drop)) {
|
if (thisQ.isPointInDrop(pageX, pageY, drop) && !highlighted) {
|
||||||
|
highlighted = true;
|
||||||
drop.addClass('valid-drag-over-drop');
|
drop.addClass('valid-drag-over-drop');
|
||||||
} else {
|
} else {
|
||||||
drop.removeClass('valid-drag-over-drop');
|
drop.removeClass('valid-drag-over-drop');
|
||||||
|
@ -375,7 +377,8 @@ 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) {
|
this.getRoot().find('.draghome.placed.group' + this.getGroup(drag)).not('.beingdragged').each(function(i, dropNode) {
|
||||||
var drop = $(dropNode);
|
var drop = $(dropNode);
|
||||||
if (thisQ.isPointInDrop(pageX, pageY, drop)) {
|
if (thisQ.isPointInDrop(pageX, pageY, drop) && !highlighted) {
|
||||||
|
highlighted = true;
|
||||||
drop.addClass('valid-drag-over-drop');
|
drop.addClass('valid-drag-over-drop');
|
||||||
} else {
|
} else {
|
||||||
drop.removeClass('valid-drag-over-drop');
|
drop.removeClass('valid-drag-over-drop');
|
||||||
|
@ -394,6 +397,8 @@ define(['jquery', 'core/dragdrop', 'core/key_codes'], function($, dragDrop, keys
|
||||||
var thisQ = this,
|
var thisQ = this,
|
||||||
root = this.getRoot(),
|
root = this.getRoot(),
|
||||||
placed = false;
|
placed = false;
|
||||||
|
|
||||||
|
// Looking for drag that was dropped on a dropzone.
|
||||||
root.find('.dropzone.group' + this.getGroup(drag)).each(function(i, dropNode) {
|
root.find('.dropzone.group' + this.getGroup(drag)).each(function(i, dropNode) {
|
||||||
var drop = $(dropNode);
|
var drop = $(dropNode);
|
||||||
if (!thisQ.isPointInDrop(pageX, pageY, drop)) {
|
if (!thisQ.isPointInDrop(pageX, pageY, drop)) {
|
||||||
|
@ -408,21 +413,24 @@ define(['jquery', 'core/dragdrop', 'core/key_codes'], function($, dragDrop, keys
|
||||||
return false; // Stop the each() here.
|
return false; // Stop the each() here.
|
||||||
});
|
});
|
||||||
|
|
||||||
root.find('.draghome.placed.group' + this.getGroup(drag)).not('.beingdragged').each(function(i, placedNode) {
|
if (!placed) {
|
||||||
var placedDrag = $(placedNode);
|
// Looking for drag that was dropped on a placed drag.
|
||||||
if (!thisQ.isPointInDrop(pageX, pageY, placedDrag)) {
|
root.find('.draghome.placed.group' + this.getGroup(drag)).not('.beingdragged').each(function(i, placedNode) {
|
||||||
// Not this placed drag.
|
var placedDrag = $(placedNode);
|
||||||
return true;
|
if (!thisQ.isPointInDrop(pageX, pageY, placedDrag)) {
|
||||||
}
|
// Not this placed drag.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Now put this drag into the drop.
|
// Now put this drag into the drop.
|
||||||
placedDrag.removeClass('valid-drag-over-drop');
|
placedDrag.removeClass('valid-drag-over-drop');
|
||||||
var currentPlace = thisQ.getClassnameNumericSuffix(placedDrag, 'inplace');
|
var currentPlace = thisQ.getClassnameNumericSuffix(placedDrag, 'inplace');
|
||||||
var drop = thisQ.getDrop(drag, currentPlace);
|
var drop = thisQ.getDrop(drag, currentPlace);
|
||||||
thisQ.sendDragToDrop(drag, drop);
|
thisQ.sendDragToDrop(drag, drop);
|
||||||
placed = true;
|
placed = true;
|
||||||
return false; // Stop the each() here.
|
return false; // Stop the each() here.
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!placed) {
|
if (!placed) {
|
||||||
this.sendDragHome(drag);
|
this.sendDragHome(drag);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue