@@ -109,9 +109,6 @@ mpl.figure.prototype._init_canvas = function() {
109109 var fig = this ;
110110
111111 var canvas_div = $ ( '<div/>' ) ;
112- canvas_div . resizable ( { resize : mpl . debounce_resize (
113- function ( event , ui ) { fig . request_resize ( ui . size . width , ui . size . height ) ; }
114- , 50 ) } ) ;
115112
116113 canvas_div . attr ( 'style' , 'position: relative; clear: both; outline: 0' ) ;
117114
@@ -134,9 +131,27 @@ mpl.figure.prototype._init_canvas = function() {
134131
135132 var rubberband = $ ( '<canvas/>' ) ;
136133 rubberband . attr ( 'style' , "position: absolute; left: 0; top: 0; z-index: 1;" )
134+
135+ var pass_mouse_events = true ;
136+
137+ canvas_div . resizable ( {
138+ start : function ( event , ui ) {
139+ pass_mouse_events = false ;
140+ } ,
141+ resize : function ( event , ui ) {
142+ fig . request_resize ( ui . size . width , ui . size . height ) ;
143+ } ,
144+ stop : function ( event , ui ) {
145+ pass_mouse_events = true ;
146+ fig . request_resize ( ui . size . width , ui . size . height ) ;
147+ } ,
148+ } ) ;
149+
137150 function mouse_event_fn ( event ) {
138- return fig . mouse_event ( event , event [ 'data' ] ) ;
151+ if ( pass_mouse_events )
152+ return fig . mouse_event ( event , event [ 'data' ] ) ;
139153 }
154+
140155 rubberband . mousedown ( 'button_press' , mouse_event_fn ) ;
141156 rubberband . mouseup ( 'button_release' , mouse_event_fn ) ;
142157 // Throttle sequential mouse events to 1 every 20ms.
@@ -489,19 +504,3 @@ mpl.figure.prototype.toolbar_button_onclick = function(name) {
489504mpl . figure . prototype . toolbar_button_onmouseover = function ( tooltip ) {
490505 this . message . textContent = tooltip ;
491506} ;
492-
493- mpl . debounce_event = function ( func , time ) {
494- var timer ;
495- return function ( event ) {
496- clearTimeout ( timer ) ;
497- timer = setTimeout ( function ( ) { func ( event ) ; } , time ) ;
498- } ;
499- }
500-
501- mpl . debounce_resize = function ( func , time ) {
502- var timer ;
503- return function ( event , ui ) {
504- clearTimeout ( timer ) ;
505- timer = setTimeout ( function ( ) { func ( event , ui ) ; } , time ) ;
506- } ;
507- }
0 commit comments