stop reverting to el.height for offsets if it is bigger than parent.height.

This commit is contained in:
Christopher Jeffrey 2013-06-11 14:00:18 -05:00
parent 94426dfd79
commit 6357b4dfff

View File

@ -624,7 +624,7 @@ Element.prototype.__defineGetter__('left', function() {
if (typeof left === 'string') {
if (left === 'center') left = '50%';
left = +left.slice(0, -1) / 100;
left = Math.max(this.width, this.parent.width) * left | 0;
left = this.parent.width * left | 0;
if (this.position.left === 'center') {
left -= this.width / 2 | 0;
}
@ -650,7 +650,7 @@ Element.prototype.__defineGetter__('top', function() {
if (typeof top === 'string') {
if (top === 'center') top = '50%';
top = +top.slice(0, -1) / 100;
top = Math.max(this.height, this.parent.height) * top | 0;
top = this.parent.height * top | 0;
if (this.position.top === 'center') {
top -= this.height / 2 | 0;
}
@ -718,7 +718,7 @@ Element.prototype.__defineGetter__('rleft', function() {
if (typeof left === 'string') {
if (left === 'center') left = '50%';
left = +left.slice(0, -1) / 100;
left = Math.max(this.width, this.parent.width) * left | 0;
left = this.parent.width * left | 0;
if (this.position.left === 'center') {
left -= this.width / 2 | 0;
}
@ -744,7 +744,7 @@ Element.prototype.__defineGetter__('rtop', function() {
if (typeof top === 'string') {
if (top === 'center') top = '50%';
top = +top.slice(0, -1) / 100;
top = Math.max(this.height, this.parent.height) * top | 0;
top = this.parent.height * top | 0;
if (this.position.top === 'center') {
top -= this.height / 2 | 0;
}