scrollbar: Fix scroll to show scrollbar. (#681)

Fix #624 was broke scroll to show behaviors.
This commit is contained in:
Jason Lee 2025-03-04 15:37:13 +08:00 committed by GitHub
parent 581d92378c
commit 6c9a317b3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -202,7 +202,7 @@ impl Render for ScrollableStory {
.gap_4()
.child(self.render_buttons(cx))
.child(
div().w_full().flex_1().child(
div().w_full().flex_1().min_h_64().child(
div().relative().size_full().child(
v_flex()
.id("test-0")

View file

@ -132,8 +132,10 @@ impl ScrollbarState {
fn with_hovered_on_thumb(&self, axis: Option<ScrollbarAxis>) -> Self {
let mut state = *self;
state.hovered_on_thumb = axis;
if axis.is_some() {
state.last_scroll_time = Some(std::time::Instant::now());
if self.is_scrollbar_visible() {
if axis.is_some() {
state.last_scroll_time = Some(std::time::Instant::now());
}
}
state
}