MCPcopy Create free account
hub / github.com/controlsjs/controls.js / ng_findMousePosX

Function ng_findMousePosX

src/ng_basic/basic.js:1454–1482  ·  view source on GitHub ↗

* Function: ng_findMousePosX * Determines horizontal element offset to absolute mouse position. * * Syntax: * int *ng_findMousePosX* (object obj) * * Parameters: * obj - element object * * Returns: * Offset to be substracted from the absolute mouse position.

(obj)

Source from the content-addressed store, hash-verified

1452 * Offset to be substracted from the absolute mouse position.
1453 */
1454function ng_findMousePosX(obj)
1455{
1456 var curleft = 0;
1457 if(obj.offsetParent)
1458 {
1459 while(obj.offsetParent)
1460 {
1461 curleft += obj.offsetLeft;
1462 curleft -= obj.scrollLeft;
1463 if(ngFireFox)
1464 {
1465 if((ng_GetCurrentStyle(obj,'overflow')!=='auto')||((ngFireFox1x)||(ngFireFox2x)))
1466 curleft+=2*ng_GetCurrentStylePx(obj,'border-left-width');
1467 else
1468 curleft+=ng_GetCurrentStylePx(obj,'border-left-width');
1469 }
1470 else
1471 {
1472 if((!ngOpera)) //Opera 10.5 still doesn't need this !!!
1473 curleft +=ng_GetCurrentStylePx(obj,'border-left-width');
1474 }
1475
1476 obj = obj.offsetParent;
1477 }
1478 }
1479 else if(obj.x) curleft += obj.x;
1480 curleft -= ng_DocumentScrollX();
1481 return curleft;
1482}
1483
1484/**
1485 * Function: ng_findMousePosY

Callers 2

ngmn_PopupMouseMenuFunction · 0.85
nga_DoPopupMenuFunction · 0.85

Calls 3

ng_GetCurrentStyleFunction · 0.85
ng_GetCurrentStylePxFunction · 0.85
ng_DocumentScrollXFunction · 0.85

Tested by

no test coverage detected