fix: Scrollbar nested update value (#238)

This commit is contained in:
luoxiaozero 2024-08-23 23:17:47 +08:00 committed by GitHub
parent 74bf7fa29a
commit 97212d7fda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -198,14 +198,14 @@ pub fn Scrollbar(
handle.remove();
}
});
thumb_status.update_value(|thumb_status| {
if let Some(status) = thumb_status.take() {
if status == ThumbStatus::DelayLeave {
is_show_x_thumb.set(false);
is_show_y_thumb.set(false);
}
if let Some(Some(status)) =
thumb_status.try_update_value(|thumb_status| thumb_status.take())
{
if status == ThumbStatus::DelayLeave {
is_show_x_thumb.set(false);
is_show_y_thumb.set(false);
}
});
}
});
x_trumb_mouseup_handle.set_value(Some(handle));
memo_x_left.set_value(container_scroll_left.get());
@ -251,14 +251,14 @@ pub fn Scrollbar(
handle.remove();
}
});
thumb_status.update_value(|thumb_status| {
if let Some(status) = thumb_status.take() {
if status == ThumbStatus::DelayLeave {
is_show_x_thumb.set(false);
is_show_y_thumb.set(false);
}
if let Some(Some(status)) =
thumb_status.try_update_value(|thumb_status| thumb_status.take())
{
if status == ThumbStatus::DelayLeave {
is_show_x_thumb.set(false);
is_show_y_thumb.set(false);
}
});
}
});
y_trumb_mouseup_handle.set_value(Some(handle));
memo_y_top.set_value(container_scroll_top.get());