cleanup scroll.

This commit is contained in:
Christopher Jeffrey 2013-07-27 05:16:56 -05:00
parent ee71a1ac61
commit 2dc3146d1f
1 changed files with 14 additions and 30 deletions

View File

@ -2633,19 +2633,13 @@ Element.prototype._getCoords = function(get) {
, xl = xi + this._getWidth(get)
, yi = this._getTop(get)
, yl = yi + this._getHeight(get)
, base = this.childBase || 0
, el = this
, coords
, v
, base
, cbase
, notop
, nobot;
// Find a scrollable ancestor if we have one.
var el = this;
while (el = el.parent) {
if (el.scrollable) break;
}
// Attempt to shrink the element base on the
// size of the content and child elements.
if (this.shrink) {
@ -2654,6 +2648,11 @@ Element.prototype._getCoords = function(get) {
yi = coords.yi, yl = coords.yl;
}
// Find a scrollable ancestor if we have one.
while (el = el.parent) {
if (el.scrollable) break;
}
// Check to make sure we're visible and
// inside of the visible scroll area.
// NOTE: Lists have a property where only
@ -2669,13 +2668,11 @@ Element.prototype._getCoords = function(get) {
// Is above.
return;
} else {
// Is partially covered below.
// Is partially covered above.
notop = true;
v = (this.parent.lpos.yi + 0) - yi;
//if (!this.itop) v += this.parent.itop;
v = this.parent.lpos.yi - yi;
v += this.parent.itop - this.itop;
base = (this.childBase || 0) + v;
cbase = base;
base += v;
yi += v;
}
} else if (yl > this.parent.lpos.yl - this.parent.ibottom) {
@ -2685,7 +2682,7 @@ Element.prototype._getCoords = function(get) {
} else {
// Is partially covered below.
nobot = true;
v = yl - (this.parent.lpos.yl - 0);
v = yl - this.parent.lpos.yl;
v += this.parent.ibottom - this.ibottom;
yl -= v;
}
@ -2700,8 +2697,7 @@ Element.prototype._getCoords = function(get) {
xl: xl,
yi: yi,
yl: yl,
base: base != null ? base : this.childBase || 0,
cbase: cbase != null ? cbase : this.childBase || 0,
base: base,
notop: notop,
nobot: nobot
};
@ -2729,7 +2725,7 @@ Element.prototype.render = function() {
, attr
, ch
, content = this._pcontent
, ci = this._clines.ci[coords.cbase]
, ci = this._clines.ci[coords.base]
, battr
, dattr
, c
@ -2749,16 +2745,10 @@ Element.prototype.render = function() {
// If we're in a scrollable text box, check to
// see which attributes this line starts with.
if (ci > 0) {
attr = this._clines.attr[Math.min(coords.cbase, this._clines.length - 1)];
attr = this._clines.attr[Math.min(coords.base, this._clines.length - 1)];
}
if (this.border) xi++, xl--, yi++, yl--;
/*
if (this.border) {
if (coords.notop) yi--;
if (coords.nobot) yl++;
}
*/
// If we have padding/valign, that means the
// content-drawing loop will skip a few cells/lines.
@ -2869,12 +2859,6 @@ Element.prototype.render = function() {
}
if (this.border) xi--, xl++, yi--, yl++;
/*
if (this.border) {
//if (coords.notop) yi++;
if (coords.nobot) yl--;
}
*/
if (this.tpadding) {
xi -= this.padding.left, xl += this.padding.right;