File tree 1 file changed +17
-2
lines changed
lib/matplotlib/backends/web_backend
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -149,10 +149,9 @@ mpl.figure.prototype._init_canvas = function() {
149
149
150
150
function mouse_event_fn ( event ) {
151
151
if ( pass_mouse_events )
152
- {
153
152
return fig . mouse_event ( event , event [ 'data' ] ) ;
154
- }
155
153
}
154
+
156
155
rubberband . mousedown ( 'button_press' , mouse_event_fn ) ;
157
156
rubberband . mouseup ( 'button_release' , mouse_event_fn ) ;
158
157
// Throttle sequential mouse events to 1 every 20ms.
@@ -505,3 +504,19 @@ mpl.figure.prototype.toolbar_button_onclick = function(name) {
505
504
mpl . figure . prototype . toolbar_button_onmouseover = function ( tooltip ) {
506
505
this . message . textContent = tooltip ;
507
506
} ;
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
+ }
You can’t perform that action at this time.
0 commit comments