Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Use the BoundsInfo object when positioning the element to take advant…
Browse files Browse the repository at this point in the history
…age of the cached x/y
  • Loading branch information
Jason Johnston committed Sep 5, 2010
1 parent de0be44 commit 673c731
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sources/RootRenderer.js
Expand Up @@ -25,7 +25,7 @@ PIE.RootRenderer = PIE.RendererBase.newRenderer( {
var el = this.targetElement,
par = el,
docEl,
elRect, parRect,
elBounds, parRect,
s = this.getBox().style, cs,
x = 0, y = 0;

Expand All @@ -34,16 +34,16 @@ PIE.RootRenderer = PIE.RendererBase.newRenderer( {
do {
par = par.offsetParent;
} while( par && par.currentStyle.position === 'static' );
elRect = el.getBoundingClientRect();
elBounds = this.boundsInfo.getBounds();
if( par ) {
parRect = par.getBoundingClientRect();
cs = par.currentStyle;
x = elRect.left - parRect.left - ( parseFloat(cs.borderLeftWidth) || 0 );
y = elRect.top - parRect.top - ( parseFloat(cs.borderTopWidth) || 0 );
x = elBounds.x - parRect.left - ( parseFloat(cs.borderLeftWidth) || 0 );
y = elBounds.y - parRect.top - ( parseFloat(cs.borderTopWidth) || 0 );
} else {
docEl = doc.documentElement;
x = elRect.left + docEl.scrollLeft - docEl.clientLeft;
y = elRect.top + docEl.scrollTop - docEl.clientTop;
x = elBounds.x + docEl.scrollLeft - docEl.clientLeft;
y = elBounds.y + docEl.scrollTop - docEl.clientTop;
}

s.left = x;
Expand Down

0 comments on commit 673c731

Please sign in to comment.