kopia lustrzana https://github.com/backface/turtlestitch
Accounts for the scrollbars in ScrollFrameMorphs.
This ensures that the stopping point of the scrollbar is beyond the length of the contents that it is scrolling, and that when scrolling is calculated, it will now account for the presence of a scrollbar. This allows you to scroll a little extra so you can always see all content. Fixes #2468 Fixes #638 Fixes #804pull/89/head
rodzic
140107516b
commit
b7bf8bab1a
|
@ -10578,8 +10578,7 @@ ScrollFrameMorph.prototype.adjustScrollBars = function () {
|
||||||
vHeight = this.height() - this.scrollBarSize;
|
vHeight = this.height() - this.scrollBarSize;
|
||||||
|
|
||||||
this.changed();
|
this.changed();
|
||||||
if (this.contents.width() > this.width() +
|
if (this.contents.width() > this.width()) {
|
||||||
MorphicPreferences.scrollBarSize) {
|
|
||||||
this.hBar.show();
|
this.hBar.show();
|
||||||
if (this.hBar.width() !== hWidth) {
|
if (this.hBar.width() !== hWidth) {
|
||||||
this.hBar.setWidth(hWidth);
|
this.hBar.setWidth(hWidth);
|
||||||
|
@ -10592,7 +10591,7 @@ ScrollFrameMorph.prototype.adjustScrollBars = function () {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
this.hBar.start = 0;
|
this.hBar.start = 0;
|
||||||
this.hBar.stop = this.contents.width() - this.width();
|
this.hBar.stop = this.contents.width() - this.width() + this.scrollBarSize;
|
||||||
this.hBar.size =
|
this.hBar.size =
|
||||||
this.width() / this.contents.width() * this.hBar.stop;
|
this.width() / this.contents.width() * this.hBar.stop;
|
||||||
this.hBar.value = this.left() - this.contents.left();
|
this.hBar.value = this.left() - this.contents.left();
|
||||||
|
@ -10601,8 +10600,7 @@ ScrollFrameMorph.prototype.adjustScrollBars = function () {
|
||||||
this.hBar.hide();
|
this.hBar.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.contents.height() > this.height() +
|
if (this.contents.height() > this.height()) {
|
||||||
this.scrollBarSize) {
|
|
||||||
this.vBar.show();
|
this.vBar.show();
|
||||||
if (this.vBar.height() !== vHeight) {
|
if (this.vBar.height() !== vHeight) {
|
||||||
this.vBar.setHeight(vHeight);
|
this.vBar.setHeight(vHeight);
|
||||||
|
@ -10615,7 +10613,7 @@ ScrollFrameMorph.prototype.adjustScrollBars = function () {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
this.vBar.start = 0;
|
this.vBar.start = 0;
|
||||||
this.vBar.stop = this.contents.height() - this.height();
|
this.vBar.stop = this.contents.height() - this.height() + this.scrollBarSize;
|
||||||
this.vBar.size =
|
this.vBar.size =
|
||||||
this.height() / this.contents.height() * this.vBar.stop;
|
this.height() / this.contents.height() * this.vBar.stop;
|
||||||
this.vBar.value = this.top() - this.contents.top();
|
this.vBar.value = this.top() - this.contents.top();
|
||||||
|
@ -10667,6 +10665,10 @@ ScrollFrameMorph.prototype.scrollX = function (steps) {
|
||||||
r = this.right(),
|
r = this.right(),
|
||||||
newX;
|
newX;
|
||||||
|
|
||||||
|
if (this.vBar.isVisible) {
|
||||||
|
r -= this.vBar.width();
|
||||||
|
}
|
||||||
|
|
||||||
newX = cl + steps;
|
newX = cl + steps;
|
||||||
if (newX + cw < r) {
|
if (newX + cw < r) {
|
||||||
newX = r - cw;
|
newX = r - cw;
|
||||||
|
@ -10686,6 +10688,10 @@ ScrollFrameMorph.prototype.scrollY = function (steps) {
|
||||||
b = this.bottom(),
|
b = this.bottom(),
|
||||||
newY;
|
newY;
|
||||||
|
|
||||||
|
if (this.hBar.isVisible) {
|
||||||
|
b -= this.hBar.height();
|
||||||
|
}
|
||||||
|
|
||||||
newY = ct + steps;
|
newY = ct + steps;
|
||||||
if (newY + ch < b) {
|
if (newY + ch < b) {
|
||||||
newY = b - ch;
|
newY = b - ch;
|
||||||
|
|
Ładowanie…
Reference in New Issue