mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-43145 dock: Enable regions before the drag operation starts
This commit is contained in:
parent
34df4e4ba4
commit
58f70bb6af
@ -443,7 +443,6 @@ MANAGER.prototype = {
|
||||
i = 0,
|
||||
region,
|
||||
regionname,
|
||||
droptarget,
|
||||
dragdelegation;
|
||||
|
||||
// Evil required by M.core.dragdrop.
|
||||
@ -472,7 +471,7 @@ MANAGER.prototype = {
|
||||
// Setting blockregion as droptarget (the case when it is empty)
|
||||
// The region-post (the right one)
|
||||
// is very narrow, so add extra padding on the left to drop block on it.
|
||||
droptarget = new Y.DD.Drop({
|
||||
new Y.DD.Drop({
|
||||
node: region.get_droptarget(),
|
||||
groups: this.groups,
|
||||
padding: '40 240 40 240'
|
||||
@ -492,9 +491,10 @@ MANAGER.prototype = {
|
||||
moveOnEnd: false
|
||||
});
|
||||
dragdelegation.dd.plug(Y.Plugin.DDWinScroll);
|
||||
// On the mouse down event we will enable all block regions so that they can be dragged to.
|
||||
// This is VERY important as without it dnd won't work for empty block regions.
|
||||
dragdelegation.on('drag:start', this.enable_all_regions, this);
|
||||
|
||||
// On the DD Manager start operation, we enable all block regions so that they can be drop targets. This
|
||||
// must be done *before* drag:start but after dragging has been initialised.
|
||||
Y.DD.DDM.on('ddm:start', this.enable_all_regions, this);
|
||||
|
||||
region.change_block_move_icons(this);
|
||||
}
|
||||
@ -536,11 +536,24 @@ MANAGER.prototype = {
|
||||
|
||||
/**
|
||||
* Enables all fo the regions so that they are all visible while dragging is occuring.
|
||||
*
|
||||
* @method enable_all_regions
|
||||
*/
|
||||
enable_all_regions : function() {
|
||||
var i = 0;
|
||||
var groups = Y.DD.DDM.activeDrag.get('groups');
|
||||
|
||||
// As we're called by Y.DD.DDM, we can't be certain that the call
|
||||
// relates specifically to a block drag/drop operation. Test
|
||||
// whether the relevant group applies here.
|
||||
if (!groups || Y.Array.indexOf(groups, 'block') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var i;
|
||||
for (i in this.regionobjects) {
|
||||
if (!this.regionobjects.hasOwnProperty(i)) {
|
||||
continue;
|
||||
}
|
||||
this.regionobjects[i].enable();
|
||||
}
|
||||
},
|
||||
|
File diff suppressed because one or more lines are too long
@ -439,7 +439,6 @@ MANAGER.prototype = {
|
||||
i = 0,
|
||||
region,
|
||||
regionname,
|
||||
droptarget,
|
||||
dragdelegation;
|
||||
|
||||
// Evil required by M.core.dragdrop.
|
||||
@ -468,7 +467,7 @@ MANAGER.prototype = {
|
||||
// Setting blockregion as droptarget (the case when it is empty)
|
||||
// The region-post (the right one)
|
||||
// is very narrow, so add extra padding on the left to drop block on it.
|
||||
droptarget = new Y.DD.Drop({
|
||||
new Y.DD.Drop({
|
||||
node: region.get_droptarget(),
|
||||
groups: this.groups,
|
||||
padding: '40 240 40 240'
|
||||
@ -488,9 +487,10 @@ MANAGER.prototype = {
|
||||
moveOnEnd: false
|
||||
});
|
||||
dragdelegation.dd.plug(Y.Plugin.DDWinScroll);
|
||||
// On the mouse down event we will enable all block regions so that they can be dragged to.
|
||||
// This is VERY important as without it dnd won't work for empty block regions.
|
||||
dragdelegation.on('drag:start', this.enable_all_regions, this);
|
||||
|
||||
// On the DD Manager start operation, we enable all block regions so that they can be drop targets. This
|
||||
// must be done *before* drag:start but after dragging has been initialised.
|
||||
Y.DD.DDM.on('ddm:start', this.enable_all_regions, this);
|
||||
|
||||
region.change_block_move_icons(this);
|
||||
}
|
||||
@ -531,11 +531,24 @@ MANAGER.prototype = {
|
||||
|
||||
/**
|
||||
* Enables all fo the regions so that they are all visible while dragging is occuring.
|
||||
*
|
||||
* @method enable_all_regions
|
||||
*/
|
||||
enable_all_regions : function() {
|
||||
var i = 0;
|
||||
var groups = Y.DD.DDM.activeDrag.get('groups');
|
||||
|
||||
// As we're called by Y.DD.DDM, we can't be certain that the call
|
||||
// relates specifically to a block drag/drop operation. Test
|
||||
// whether the relevant group applies here.
|
||||
if (!groups || Y.Array.indexOf(groups, 'block') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var i;
|
||||
for (i in this.regionobjects) {
|
||||
if (!this.regionobjects.hasOwnProperty(i)) {
|
||||
continue;
|
||||
}
|
||||
this.regionobjects[i].enable();
|
||||
}
|
||||
},
|
||||
|
25
lib/yui/src/blocks/js/manager.js
vendored
25
lib/yui/src/blocks/js/manager.js
vendored
@ -58,7 +58,6 @@ MANAGER.prototype = {
|
||||
i = 0,
|
||||
region,
|
||||
regionname,
|
||||
droptarget,
|
||||
dragdelegation;
|
||||
|
||||
// Evil required by M.core.dragdrop.
|
||||
@ -87,7 +86,7 @@ MANAGER.prototype = {
|
||||
// Setting blockregion as droptarget (the case when it is empty)
|
||||
// The region-post (the right one)
|
||||
// is very narrow, so add extra padding on the left to drop block on it.
|
||||
droptarget = new Y.DD.Drop({
|
||||
new Y.DD.Drop({
|
||||
node: region.get_droptarget(),
|
||||
groups: this.groups,
|
||||
padding: '40 240 40 240'
|
||||
@ -107,9 +106,10 @@ MANAGER.prototype = {
|
||||
moveOnEnd: false
|
||||
});
|
||||
dragdelegation.dd.plug(Y.Plugin.DDWinScroll);
|
||||
// On the mouse down event we will enable all block regions so that they can be dragged to.
|
||||
// This is VERY important as without it dnd won't work for empty block regions.
|
||||
dragdelegation.on('drag:start', this.enable_all_regions, this);
|
||||
|
||||
// On the DD Manager start operation, we enable all block regions so that they can be drop targets. This
|
||||
// must be done *before* drag:start but after dragging has been initialised.
|
||||
Y.DD.DDM.on('ddm:start', this.enable_all_regions, this);
|
||||
|
||||
region.change_block_move_icons(this);
|
||||
}
|
||||
@ -151,11 +151,24 @@ MANAGER.prototype = {
|
||||
|
||||
/**
|
||||
* Enables all fo the regions so that they are all visible while dragging is occuring.
|
||||
*
|
||||
* @method enable_all_regions
|
||||
*/
|
||||
enable_all_regions : function() {
|
||||
var i = 0;
|
||||
var groups = Y.DD.DDM.activeDrag.get('groups');
|
||||
|
||||
// As we're called by Y.DD.DDM, we can't be certain that the call
|
||||
// relates specifically to a block drag/drop operation. Test
|
||||
// whether the relevant group applies here.
|
||||
if (!groups || Y.Array.indexOf(groups, 'block') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var i;
|
||||
for (i in this.regionobjects) {
|
||||
if (!this.regionobjects.hasOwnProperty(i)) {
|
||||
continue;
|
||||
}
|
||||
this.regionobjects[i].enable();
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user