more scrolling fixes.
This commit is contained in:
parent
dafad57d0d
commit
6eb28b6b4f
|
@ -1436,25 +1436,14 @@ Screen.prototype._focus = function(self, old) {
|
||||||
// If we're in a scrollable element,
|
// If we're in a scrollable element,
|
||||||
// automatically scroll to the focused element.
|
// automatically scroll to the focused element.
|
||||||
if (el) {
|
if (el) {
|
||||||
var ryi = self.top - el.top - el.itop
|
var visible = self.screen.height - el.top - el.itop - el.bottom - el.ibottom;
|
||||||
, ryl = self.top + self.height - el.top - el.ibottom
|
if (self.rtop < el.childBase) {
|
||||||
, visible = el.height - el.iheight;
|
|
||||||
|
|
||||||
if (ryi < el.childBase) {
|
|
||||||
el.scrollTo(ryi);
|
|
||||||
self.screen.render();
|
|
||||||
} else if (self.rtop + self.height > el.childBase + el.height - el.iheight) {
|
|
||||||
//} else if (self.rtop + self.height > el.childBase + el.height) {
|
|
||||||
el.scrollTo(self.rtop);
|
el.scrollTo(self.rtop);
|
||||||
//el.scrollTo(self.rtop + self.height - el.height);
|
self.screen.render();
|
||||||
|
} else if (self.rtop + self.height - self.ibottom > el.childBase + visible) {
|
||||||
|
el.scrollTo(self.rtop - (visible - self.height));
|
||||||
|
self.screen.render();
|
||||||
}
|
}
|
||||||
//} else if (ryi >= el.childBase + visible) {
|
|
||||||
// el.scrollTo(ryi + self.height);
|
|
||||||
// self.screen.render();
|
|
||||||
//} else if (ryl >= el.childBase + visible) {
|
|
||||||
// el.scrollTo(ryi + self.height);
|
|
||||||
// self.screen.render();
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old) {
|
if (old) {
|
||||||
|
@ -3848,7 +3837,7 @@ ScrollableBox.prototype.setScroll =
|
||||||
ScrollableBox.prototype.scrollTo = function(offset) {
|
ScrollableBox.prototype.scrollTo = function(offset) {
|
||||||
// XXX
|
// XXX
|
||||||
// At first, this appeared to account for the first new calculation of childBase:
|
// At first, this appeared to account for the first new calculation of childBase:
|
||||||
// this.scroll(0);
|
this.scroll(0);
|
||||||
return this.scroll(offset - (this.childBase + this.childOffset));
|
return this.scroll(offset - (this.childBase + this.childOffset));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue