Skip to content

Commit cba065a

Browse files
committed
Updates to resizing handle
1 parent 76b3c32 commit cba065a

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

js/src/mpl_widget.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,14 @@ var MPLCanvasModel = widgets.DOMWidgetModel.extend({
9090

9191
handle_resize: function(msg) {
9292
var size = msg['size'];
93-
9493
this.resize_canvas(size[0], size[1]);
9594
this.offscreen_context.drawImage(this.image, 0, 0);
9695

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+
}
100101

101102
this.send_message('refresh');
102103

@@ -109,6 +110,11 @@ var MPLCanvasModel = widgets.DOMWidgetModel.extend({
109110
},
110111

111112
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+
112118
if (this.resize_requested) {
113119
// If a resize was already requested, save the requested size for later
114120
this.requested_size = [width, height];
@@ -487,6 +493,11 @@ var MPLCanvasView = widgets.DOMWidgetView.extend({
487493
}
488494
}
489495

496+
if (that.resizing) {
497+
// Ignore other mouse events while resizing.
498+
return;
499+
}
500+
490501
if (name === 'motion_notify') {
491502
// If the mouse is on the handle, change the cursor style
492503
if (canvas_pos.x >= that.top_canvas.width - that.resize_handle_size &&

0 commit comments

Comments
 (0)