Keep leftover shares inside scroll viewports
This commit is contained in:
1 parent
b842e4f474
commit
4328eac756
2 files changed
+67
-4
No files matched your search
@@ -17,9 +17,9 @@ impl Widget for Scroll {
|
||||
let answer_len = painter
|
||||
.widget_at(&self.inner, whole, [Place::Fill(Part::All); 2])
|
||||
.len(self.axis);
|
||||
let content = answer_len.apply_leftover();
|
||||
let fixed = Len::from_parts(answer_len.rel, answer_len.px).to_px(container_len);
|
||||
self.container_len = container_len;
|
||||
self.content_len = content.to_px(container_len);
|
||||
self.content_len = fixed.max(container_len);
|
||||
|
||||
if self.snap_end {
|
||||
self.amt = self.content_len - self.container_len;
|
||||
@@ -32,9 +32,9 @@ impl Widget for Scroll {
|
||||
// the drawing holds for that length alone. One scrolled part way sits
|
||||
// where it is until the box shrinks past what is left of it. Kept to
|
||||
// the end, it moves with every length.
|
||||
let fixed_len = content.rel == Rel::ZERO;
|
||||
let fixed_len = answer_len.rel == Rel::ZERO && answer_len.leftover == Weight::ZERO;
|
||||
if fixed_len && self.content_len <= self.container_len && align == AxisAlign::NEG {
|
||||
painter.holds(self.axis, self.content_len..=Px::MAX);
|
||||
painter.holds(self.axis, fixed..=Px::MAX);
|
||||
} else if fixed_len && !self.snap_end {
|
||||
let left = self.content_len - self.amt;
|
||||
painter.holds(self.axis, Px::MIN..=left);
|
||||
|
||||
Reference in new issue
Block a user