Merge pull request #66 from knocte/fix_customscrollable_sample

sample: fix CustomScrollable sample to prevent too high Upper values
This commit is contained in:
Bertrand Lorentz 2013-08-31 09:00:17 -07:00
commit 0188d30f7f

View file

@ -184,6 +184,9 @@ class CustomScrollableWidget<T> : CustomBase, IScrollableImplementor {
if (hadjustment.Value + hadjustment.PageSize > hadjustment.Upper) {
hadjustment.Value = hadjustment.Upper - hadjustment.PageSize;
}
if (hadjustment.Upper > 0 && hadjustment.Upper < hadjustment.PageSize) {
hadjustment.Upper = hadjustment.PageSize;
}
hadjustment.Change ();
}
@ -193,6 +196,9 @@ class CustomScrollableWidget<T> : CustomBase, IScrollableImplementor {
if (vadjustment.Value + vadjustment.PageSize > vadjustment.Upper) {
vadjustment.Value = vadjustment.Upper - vadjustment.PageSize;
}
if (vadjustment.Upper > 0 && vadjustment.Upper < vadjustment.PageSize) {
vadjustment.Upper = vadjustment.PageSize;
}
vadjustment.Change ();
}
}