Author: sergeyhalipov
Date: 2008-01-11 10:31:56 -0500 (Fri, 11 Jan 2008)
New Revision: 5303
Modified:
trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
Log:
http://jira.jboss.com/jira/browse/RF-1485
Modified:
trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
===================================================================
---
trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2008-01-11
15:10:13 UTC (rev 5302)
+++
trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2008-01-11
15:31:56 UTC (rev 5303)
@@ -213,6 +213,7 @@
},
doShow: function(e){
+ this.setScrollDelta();
var obj;
if (!e) var e = window.event;
@@ -318,6 +319,8 @@
window.clearTimeout(this.hidingTimerHandle);
this.hidingTimerHandle = undefined;
}
+
+ this.scrollDelta = undefined;
},
doEnable: function(){
@@ -327,11 +330,28 @@
this.disabled = true;
},
+ setScrollDelta: function() {
+ if (!this.scrollDelta) {
+ this.scrollDelta = [0, 0];
+ }
+ var parentNode = this.parent;
+ while (parentNode && !/^body$/i.test(parentNode.tagName)) {
+ if (/^absolute$/i.test(Richfaces.getComputedStyle(parentNode, "position")))
{
+ if (parentNode.scrollLeft) {
+ this.scrollDelta[0] += parentNode.scrollLeft;
+ }
+ if (parentNode.scrollTop) {
+ this.scrollDelta[1] += parentNode.scrollTop;
+ }
+ }
+ parentNode = parentNode.parentNode;
+ }
+ },
+
/*
* we can pass here not event only, but also object {'clientX':XXX,
'clientY':XXX}
*/
setToolTipPosition: function(e){
-
var toolTipX=0;
var toolTipY=0;
@@ -364,6 +384,10 @@
var coords = this.fitToolTip(e.clientX, e.clientY, {'x':toolTipX ,
'y':toolTipY},elementDim, horizontalDirection, verticalDirection,
{'x':this.horizontalOffset, 'y':this.verticalOffset});
+ if (this.scrollDelta) {
+ coords.x += this.scrollDelta[0];
+ coords.y += this.scrollDelta[1];
+ }
Element.setStyle(this.toolTip, {"left": coords.x + "px",
"top": coords.y + "px"});
if(this.iframe)
{