summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2012-02-02 14:20:09 +0000
committerctrlaltca@gmail.com <>2012-02-02 14:20:09 +0000
commit871b91b471434aef56e421888bae1146dd74c990 (patch)
tree5ec9956bbe56a164f884aee5f5d8a27d9503d0f1 /framework
parent44b8ec3ad302ed1eb241aac0313951f761aaad8f (diff)
Added some dirty js code to get dropcontainer-relative offset for onDrop events of draggable controls
Diffstat (limited to 'framework')
-rwxr-xr-xframework/Web/Javascripts/source/prado/activecontrols/dragdrop.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js b/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js
index 107269f2..efec6a69 100755
--- a/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js
+++ b/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js
@@ -22,12 +22,36 @@ Object.extend(Prado.WebUI.DropContainer.prototype,
{
var elementId=dragElement.id.replace(/clone_/,"");
var req = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ var curleft = curtop = 0;
+ var obj = dropElement;
+ if (obj.offsetParent) {
+ curleft = obj.offsetLeft
+ curtop = obj.offsetTop
+ while (obj = obj.offsetParent) {
+ curleft += obj.offsetLeft
+ curtop += obj.offsetTop
+ }
+ }
+ var scrOfX = 0, scrOfY = 0;
+ if( typeof( window.pageYOffset ) == 'number' ) {
+ //Netscape compliant
+ scrOfY = window.pageYOffset;
+ scrOfX = window.pageXOffset;
+ } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
+ //DOM compliant
+ scrOfY = document.body.scrollTop;
+ scrOfX = document.body.scrollLeft;
+ } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
+ //IE6 standards compliant mode
+ scrOfY = document.documentElement.scrollTop;
+ scrOfX = document.documentElement.scrollLeft;
+ }
req.setCallbackParameter({
DragElementID : elementId,
ScreenX : event.screenX,
ScreenY : event.screenY,
- OffsetX : event.offsetX,
- OffsetY : event.offsetY,
+ OffsetX : event.offsetX || event.clientX - curleft + scrOfX,
+ OffsetY : event.offsetY || event.clientY - curtop + scrOfY,
ClientX : event.clientX,
ClientY : event.clientY,
AltKey : event.altKey,