fix: events were not removed when the scrollbar cleared (#216)

This commit is contained in:
luoxiaozero 2024-07-15 21:17:49 +08:00 committed by GitHub
parent 96f74a122e
commit 0f09a7eaa0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -277,6 +277,29 @@ pub fn Scrollbar(
thumb_status.set_value(Some(ThumbStatus::Enter));
};
on_cleanup(move || {
x_trumb_mousemove_handle.update_value(|handle| {
if let Some(handle) = handle.take() {
handle.remove();
}
});
x_trumb_mouseup_handle.update_value(|handle| {
if let Some(handle) = handle.take() {
handle.remove();
}
});
y_trumb_mousemove_handle.update_value(|handle| {
if let Some(handle) = handle.take() {
handle.remove();
}
});
y_trumb_mouseup_handle.update_value(|handle| {
if let Some(handle) = handle.take() {
handle.remove();
}
});
});
view! {
<div
class=class_list!["thaw-scrollbar", class.map(| c | move || c.get())]