Skip to content

Commit 0f09a7e

Browse files
authored
fix: events were not removed when the scrollbar cleared (#216)
1 parent 96f74a1 commit 0f09a7e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

thaw/src/scrollbar/mod.rs

+23
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,29 @@ pub fn Scrollbar(
277277
thumb_status.set_value(Some(ThumbStatus::Enter));
278278
};
279279

280+
on_cleanup(move || {
281+
x_trumb_mousemove_handle.update_value(|handle| {
282+
if let Some(handle) = handle.take() {
283+
handle.remove();
284+
}
285+
});
286+
x_trumb_mouseup_handle.update_value(|handle| {
287+
if let Some(handle) = handle.take() {
288+
handle.remove();
289+
}
290+
});
291+
y_trumb_mousemove_handle.update_value(|handle| {
292+
if let Some(handle) = handle.take() {
293+
handle.remove();
294+
}
295+
});
296+
y_trumb_mouseup_handle.update_value(|handle| {
297+
if let Some(handle) = handle.take() {
298+
handle.remove();
299+
}
300+
});
301+
});
302+
280303
view! {
281304
<div
282305
class=class_list!["thaw-scrollbar", class.map(| c | move || c.get())]

0 commit comments

Comments
 (0)