Replace owr mouse function for a mootool one.

This commit is contained in:
Paulo Veiga
2011-08-28 11:38:15 -03:00
parent c2521f0f9f
commit d20e5cf6d5
4 changed files with 27 additions and 81 deletions

View File

@@ -50,76 +50,6 @@ Math.sign = function(value) {
return (value >= 0) ? 1 : -1;
};
/**
* Retrieve the mouse position.
*/
core.Utils.getMousePosition = function(event) {
var xcoord = -1;
var ycoord = -1;
if (!$defined(event)) {
if ($defined(window.event)) {
//Internet Explorer
event = window.event;
} else {
//total failure, we have no way of referencing the event
throw "Could not obtain mouse position";
}
}
if ($defined(event.$extended)) {
event = event.event;
}
if (typeof( event.pageX ) == 'number') {
//most browsers
xcoord = event.pageX;
ycoord = event.pageY;
} else if (typeof( event.clientX ) == 'number') {
//Internet Explorer and older browsers
//other browsers provide this, but follow the pageX/Y branch
xcoord = event.clientX;
ycoord = event.clientY;
var badOldBrowser = ( window.navigator.userAgent.indexOf('Opera') + 1 ) ||
( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ||
( navigator.vendor == 'KDE' );
if (!badOldBrowser) {
if (document.body && ( document.body.scrollLeft || document.body.scrollTop )) {
//IE 4, 5 & 6 (in non-standards compliant mode)
xcoord += document.body.scrollLeft;
ycoord += document.body.scrollTop;
} else if (document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop )) {
//IE 6 (in standards compliant mode)
xcoord += document.documentElement.scrollLeft;
ycoord += document.documentElement.scrollTop;
}
}
} else {
throw "Could not obtain mouse position";
}
return {x:xcoord,y:ycoord};
};
/**
* Calculate the position of the passed element.
*/
core.Utils.workOutDivElementPosition = function(divElement) {
var curleft = 0;
var curtop = 0;
if ($defined(divElement.offsetParent)) {
curleft = divElement.offsetLeft;
curtop = divElement.offsetTop;
while (divElement = divElement.offsetParent) {
curleft += divElement.offsetLeft;
curtop += divElement.offsetTop;
}
}
return {x:curleft,y:curtop};
};
core.Utils.innerXML = function(/*Node*/node) {
// summary:
// Implementation of MS's innerXML function.