MDL-43145 dock: Enable regions before the drag operation starts

This commit is contained in:
Andrew Nicols
2014-04-14 09:34:14 +08:00
parent aa1f42288e
commit da7f707de7
4 changed files with 59 additions and 20 deletions
@@ -451,7 +451,6 @@ MANAGER.prototype = {
i = 0,
region,
regionname,
droptarget,
dragdelegation;
// Evil required by M.core.dragdrop.
@@ -480,7 +479,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'
@@ -500,9 +499,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.remove_block_move_icons();
}
@@ -544,12 +544,25 @@ MANAGER.prototype = {
/**
* Enables all fo the regions so that they are all visible while dragging is occuring.
*
* @method enable_all_regions
* @returns {undefined}
*/
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
+19 -6
View File
@@ -447,7 +447,6 @@ MANAGER.prototype = {
i = 0,
region,
regionname,
droptarget,
dragdelegation;
// Evil required by M.core.dragdrop.
@@ -476,7 +475,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'
@@ -496,9 +495,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.remove_block_move_icons();
}
@@ -539,12 +539,25 @@ MANAGER.prototype = {
/**
* Enables all fo the regions so that they are all visible while dragging is occuring.
*
* @method enable_all_regions
* @returns {undefined}
*/
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();
}
},
+19 -6
View File
@@ -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.remove_block_move_icons();
}
@@ -151,12 +151,25 @@ MANAGER.prototype = {
/**
* Enables all fo the regions so that they are all visible while dragging is occuring.
*
* @method enable_all_regions
* @returns {undefined}
*/
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();
}
},