Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 088bedb

Browse files
author
Eugene Yurtsev
committed
minor style changes
1 parent 4ea19ce commit 088bedb

File tree

1 file changed

+17
-2
lines changed
  • lib/matplotlib/backends/web_backend

1 file changed

+17
-2
lines changed

lib/matplotlib/backends/web_backend/mpl.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,9 @@ mpl.figure.prototype._init_canvas = function() {
149149

150150
function mouse_event_fn(event) {
151151
if (pass_mouse_events)
152-
{
153152
return fig.mouse_event(event, event['data']);
154-
}
155153
}
154+
156155
rubberband.mousedown('button_press', mouse_event_fn);
157156
rubberband.mouseup('button_release', mouse_event_fn);
158157
// Throttle sequential mouse events to 1 every 20ms.
@@ -505,3 +504,19 @@ mpl.figure.prototype.toolbar_button_onclick = function(name) {
505504
mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {
506505
this.message.textContent = tooltip;
507506
};
507+
508+
mpl.debounce_event = function(func, time){
509+
var timer;
510+
return function(event){
511+
clearTimeout(timer);
512+
timer = setTimeout(function(){ func(event); }, time);
513+
};
514+
}
515+
516+
mpl.debounce_resize = function(func, time){
517+
var timer;
518+
return function(event, ui){
519+
clearTimeout(timer);
520+
timer = setTimeout(function(){ func(event, ui); }, time);
521+
};
522+
}

0 commit comments

Comments
 (0)