Skip to content

Commit 1dda5cc

Browse files
committed
throttle thumb move to 100 fps
1 parent 13a6603 commit 1dda5cc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

NetworkDynamicsInspector/src/widgets.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ function Bonito.jsrender(session::Session, slider::ContinuousSlider)
218218
return pos;
219219
}
220220
221-
//const move_thumb_throttled = Bonito.throttle_function(thumb_event, 100);
222221
const controller = new AbortController();
223222
document.addEventListener('mousedown', function (e) {
224223
if (e.target === thumb_r){
@@ -247,11 +246,12 @@ function Bonito.jsrender(session::Session, slider::ContinuousSlider)
247246
isDragging_r = false;
248247
isDragging_l = false;
249248
}, { signal: controller.signal });
249+
const thumb_event_throttled = Bonito.throttle_function(thumb_event, 10);
250250
document.addEventListener('mousemove', function (e) {
251251
if (isDragging_r) {
252-
thumb_event(e, 'r');
252+
thumb_event_throttled(e, 'r');
253253
} else if (isDragging_l) {
254-
thumb_event(e, 'l');
254+
thumb_event_throttled(e, 'l');
255255
}
256256
}, { signal: controller.signal });
257257
set_thumb_val($(slider.value_l).value, 'l');

0 commit comments

Comments
 (0)