Author: dbiatenia
Date: 2007-07-16 11:40:31 -0400 (Mon, 16 Jul 2007)
New Revision: 1635
Modified:
branches/3.0.2/sandbox/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
Log:
positioning bugfix
Modified:
branches/3.0.2/sandbox/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
===================================================================
---
branches/3.0.2/sandbox/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2007-07-16
15:20:44 UTC (rev 1634)
+++
branches/3.0.2/sandbox/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2007-07-16
15:40:31 UTC (rev 1635)
@@ -60,14 +60,12 @@
},
attachParentEvents: function(){
if(this.followMouse){
- Event.observe(this.parent, 'mousemove', this.doShow.bindAsEventListener(this),
false);
- } else {
- Event.observe(this.parent, this.event, this.doShow.bindAsEventListener(this),
false);
+ Event.observe(this.parent, 'mousemove',
this.setToolTipPosition.bindAsEventListener(this), false);
}
+ Event.observe(this.parent, this.event, this.doShow.bindAsEventListener(this), false);
Event.observe(this.parent, "mouseout", this.doHide.bindAsEventListener(this),
false);
- Event.observe(this.toolTip, 'mouseout',
this.leaveHint.bindAsEventListener(this), false)
-
+ Event.observe(this.toolTip, 'mouseout',
this.leaveToolTip.bindAsEventListener(this), false)
},
detectAncestorNode: function(leaf, element) {
@@ -79,7 +77,7 @@
},
- leaveHint: function(e) {
+ leaveToolTip: function(e) {
var hintNotLeft = false;
@@ -102,26 +100,13 @@
if (e.srcElement)
this.hintParentElement = e.srcElement;
- posX = e.clientX + document.body.scrollLeft;
- posY = e.clientY + document.body.scrollTop;
if(this.mode == 'ajax'){
var event = e;
eval(this.ajaxExecuteString);
-// this.toolTip = $(this.id);
-// this.setToolTipPosition();
-// if(this.iframe){
-// this.iframe.style.top = parseInt(this.toolTip.style.top) -
this.toolTipBorderHeight;
-// this.iframe.style.left = parseInt(this.toolTip.style.left) -
this.toolTipBorderWidth;
-// this.iframe.style.display = "block";
-// }
-// this.toolTip.style.display = "block";
}
-
- this.setToolTipPosition(e, posX, posY);
+ this.setToolTipPosition(e);
-
-
this.toolTip.style.display = "block";
if(this.iframe){
this.iframe.style.top = parseInt(this.toolTip.style.top) - this.toolTipBorderHeight;
@@ -153,14 +138,20 @@
this.disabled = true;
},
- setToolTipPosition: function(e, cursorX, cursorY){
+ setToolTipPosition: function(e){
var windowDim = this.windowSize();
-
+ var cursorX = e.clientX + document.body.scrollLeft;
+ var cursorY = e.clientY + document.body.scrollTop;
+
+ this.toolTipH = this.toolTip.getHeight();
+ this.toolTipW = this.toolTip.getWidth();
+
+
if(this.direction == "top-left"){
- if(cursorY - this.verticalOffset - this.toolTip.clientHeight < 0){
- this.toolTip.style.top = cursorY - this.verticalOffset - this.toolTipH;
+ if(cursorY - this.verticalOffset - this.toolTipH < 0){
+ this.toolTip.style.top = cursorY + this.verticalOffset - this.toolTipH;
} else {
- this.toolTip.style.top = cursorY + this.verticalOffset;
+ this.toolTip.style.top = cursorY - this.verticalOffset - this.toolTipH;
}
if(cursorX - this.horizontalOffset - this.toolTipW < 0){
this.toolTip.style.left = cursorX + this.horizontalOffset;
@@ -169,7 +160,7 @@
}
} else if(this.direction == "bottom-left"){
- if(cursorY + this.verticalOffset - this.toolTipH > windowDim[1]){
+ if(cursorY + this.verticalOffset + this.toolTipH > windowDim[1]){
this.toolTip.style.top = cursorY - this.verticalOffset - this.toolTipH;
} else {
this.toolTip.style.top = cursorY + this.verticalOffset;
@@ -177,7 +168,7 @@
if(cursorX - this.horizontalOffset - this.toolTipW < 0){
this.toolTip.style.left = cursorX + this.horizontalOffset ;
} else {
- this.toolTip.style.left = cursorX - this.horizontalOffset - this.toolTopW;
+ this.toolTip.style.left = cursorX - this.horizontalOffset - this.toolTipW;
}
} else if(this.direction == "top-right"){
if(cursorY - this.verticalOffset - this.toolTipH < 0){
Show replies by date