Author: tan_pham_dinh
Date: 2009-12-21 06:51:08 -0500 (Mon, 21 Dec 2009)
New Revision: 1100
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop.js
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop2.js
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIDashboard.js
Log:
GTNPORTAL-376: Adding cancel for DnD. Using it for IE when drag outside of document
Modified: portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop.js
===================================================================
---
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop.js 2009-12-21
11:48:10 UTC (rev 1099)
+++
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop.js 2009-12-21
11:51:08 UTC (rev 1100)
@@ -64,6 +64,7 @@
var dndEvent = this.dndEvent = new DragDropEvent(clickObject, dragObject) ;
document.onmousemove = this.onMouseMove ;
document.onmouseup = this.onDrop ;
+ document.onmouseout = this.onCancel ;
document.onkeypress = this.onKeyPressEvt ;
if(this.initCallback != null) {
@@ -115,6 +116,10 @@
eXo.core.DragDrop.destroy() ;
} ;
+DragDrop.prototype.onCancel = function(evt) {
+ if(eXo.core.DragDrop.cancelCallback)
eXo.core.DragDrop.cancelCallback(eXo.core.DragDrop.dndEvent);
+} ;
+
DragDrop.prototype.destroy = function() {
if(this.destroyCallback != null) {
this.destroyCallback(this.dndEvent) ;
@@ -122,6 +127,7 @@
document.onmousemove = null ;
document.onmouseup = null ;
+ document.onmouseout = null ;
document.onkeypress = null ;
this.dndEvent = null ;
Modified: portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop2.js
===================================================================
---
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop2.js 2009-12-21
11:48:10 UTC (rev 1099)
+++
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop2.js 2009-12-21
11:51:08 UTC (rev 1100)
@@ -49,6 +49,7 @@
o.root.onDragStart(x, y, o.lastMouseX, o.lastMouseY, e);
document.onmousemove = eXo.core.DragDrop2.drag;
document.onmouseup = eXo.core.DragDrop2.end;
+ document.onmouseout = eXo.core.DragDrop2.cancel;
return false;
},
@@ -76,11 +77,16 @@
e = eXo.core.DragDrop2.fixE(e);
document.onmousemove = null;
document.onmouseup = null;
+ document.onmouseout = null;
eXo.core.DragDrop2.obj.root.onDragEnd(
parseInt(eXo.core.DragDrop2.obj.root.style["left"]),
parseInt(eXo.core.DragDrop2.obj.root.style["top"]), e.clientX, e.clientY);
eXo.core.DragDrop2.obj = null;
},
+ cancel : function(e) {
+ if(eXo.core.DragDrop2.obj.root.onCancel) eXo.core.DragDrop2.obj.root.onCancel(e);
+ },
+
fixE : function(e) {
if (typeof e == 'undefined') e = window.event;
if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
===================================================================
---
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2009-12-21
11:48:10 UTC (rev 1099)
+++
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2009-12-21
11:51:08 UTC (rev 1100)
@@ -222,11 +222,6 @@
/*Set properties for drag object */
eXo.portal.PortalDragDrop.setDragObjectProperties(dragObject, tdElementList,
"column", dndEvent.backupMouseEvent) ;
}
- //when dragObject out of page
- if ((Browser.findPosY(dragObject) < 0) || (Browser.findPosX(dragObject) + 64 >
eXo.core.Browser.getBrowserWidth())) {
- DragDrop.dropCallback(dndEvent);
- document.onmousemove = null;
- }
}
} ;
@@ -248,8 +243,14 @@
eXo.portal.isInDragging = false;
eXo.portal.UIPortal.changeComposerSaveButton();
- }
+ };
+ DragDrop.cancelCallback = function(dndEvent) {
+ if(Browser.browserType == "ie" &&
Browser.findMouseYInClient(dndEvent.backupMouseEvent) < 0) {
+ DragDrop.onDrop(dndEvent.backupMouseEvent);
+ }
+ };
+
var clickObject = this;
var componentBlock = DOMUtil.findAncestorByClass(clickObject,
"UIComponentBlock") ;
@@ -338,12 +339,10 @@
var deltaBottom = mouseY - (Math.round(browserHeight/6)) ;
if(deltaTop > 0) {
document.documentElement.scrollTop += deltaTop - 5 ;
-// if(!dragObject.isComponent) dragObject.style.top = parseInt(dragObject.style.top) +
(deltaTop -5) + "px";
}
if(deltaBottom < 0 && document.documentElement.scrollTop > 0) {
document.documentElement.scrollTop += deltaBottom ;
-// if(!dragObject.isComponent) dragObject.style.top = parseInt(dragObject.style.top) +
deltaBottom + "px";
}
};
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIDashboard.js
===================================================================
---
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIDashboard.js 2009-12-21
11:48:10 UTC (rev 1099)
+++
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIDashboard.js 2009-12-21
11:51:08 UTC (rev 1100)
@@ -251,7 +251,14 @@
uiTarget = eXo.core.DOMUtil.findFirstDescendantByClass(portletFragment,
"div", "UITarget");
}
uiDashboard.targetObj = uiDashboard.currCol = uiDashboard.compId = null;
- }
+ }
+
+
+ dragObj.onCancel = function(e){
+ if(eXo.core.Browser.browserType == "ie" &&
eXo.core.Browser.findMouseYInClient() < 0) {
+ eXo.core.DragDrop2.end(e);
+ }
+ }
},
onLoad : function(windowId, canEdit) {