@@ -90,13 +90,14 @@ var MPLCanvasModel = widgets.DOMWidgetModel.extend({
90
90
91
91
handle_resize : function ( msg ) {
92
92
var size = msg [ 'size' ] ;
93
-
94
93
this . resize_canvas ( size [ 0 ] , size [ 1 ] ) ;
95
94
this . offscreen_context . drawImage ( this . image , 0 , 0 ) ;
96
95
97
- this . _for_each_view ( function ( view ) {
98
- view . resize_canvas ( size [ 0 ] , size [ 1 ] ) ;
99
- } ) ;
96
+ if ( ! this . resize_requested ) {
97
+ this . _for_each_view ( function ( view ) {
98
+ view . resize_canvas ( size [ 0 ] , size [ 1 ] ) ;
99
+ } ) ;
100
+ }
100
101
101
102
this . send_message ( 'refresh' ) ;
102
103
@@ -109,6 +110,11 @@ var MPLCanvasModel = widgets.DOMWidgetModel.extend({
109
110
} ,
110
111
111
112
resize : function ( width , height ) {
113
+ this . _for_each_view ( function ( view ) {
114
+ // Do an initial resize of each view, stretching the old canvas.
115
+ view . resize_canvas ( width , height ) ;
116
+ } ) ;
117
+
112
118
if ( this . resize_requested ) {
113
119
// If a resize was already requested, save the requested size for later
114
120
this . requested_size = [ width , height ] ;
@@ -487,6 +493,11 @@ var MPLCanvasView = widgets.DOMWidgetView.extend({
487
493
}
488
494
}
489
495
496
+ if ( that . resizing ) {
497
+ // Ignore other mouse events while resizing.
498
+ return ;
499
+ }
500
+
490
501
if ( name === 'motion_notify' ) {
491
502
// If the mouse is on the handle, change the cursor style
492
503
if ( canvas_pos . x >= that . top_canvas . width - that . resize_handle_size &&
0 commit comments