Skip to content

Commit

Permalink
- fixed a typo in getScrollSize, getScroll now behaves like it used …
Browse files Browse the repository at this point in the history
…to, and getScrolls returns the cumulative offsets, only used in getPosition.

git-svn-id: http://svn.mootools.net/trunk@1497 4db308c1-fb21-0410-9919-de62e267375e
  • Loading branch information
kamicane committed Mar 12, 2008
1 parent d2ae05e commit 60abff1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Source/Element/Element.Dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ Element.implement({
getScrollSize: function(){
if (isBody(this)) return this.getWindow().getScrollSize();

return {x: this.scrollHeight, y: this.scrollWidth};
return {x: this.scrollWidth, y: this.scrollHeight};
},

getScroll: function(){
if (isBody(this)) return this.getWindow().getScroll();
if (isBody(this)) return this.getWindow().getScrollSize();

return {x: this.scrollLeft, y: this.scrollTop};
},

getScrolls: function(){
var element = this, position = {x: 0, y: 0};

while (element && !isBody(element)){
Expand All @@ -50,7 +54,7 @@ Element.implement({
return position;
},

getOffset: function(){
getOffsets: function(){
if (isBody(this)) return {x: 0, y: 0};

var element = this, position = {x: 0, y: 0};
Expand Down Expand Up @@ -96,7 +100,7 @@ Element.implement({
getPosition: function(relative){
if (isBody(this)) return {x: 0, y: 0};

var offset = this.getOffset(), scroll = this.getScroll();
var offset = this.getOffsets(), scroll = this.getScrolls();
var position = {x: offset.x - scroll.x, y: offset.y - scroll.y};

var relativePosition = (relative && (relative = $(relative, true))) ? Element.getPosition(relative) : {x: 0, y: 0};
Expand Down

0 comments on commit 60abff1

Please sign in to comment.