Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions js/src/mpl_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ var MPLCanvasModel = widgets.DOMWidgetModel.extend({

handle_resize: function(msg) {
var size = msg['size'];

this.resize_canvas(size[0], size[1]);
this.offscreen_context.drawImage(this.image, 0, 0);

this._for_each_view(function(view) {
view.resize_canvas(size[0], size[1]);
});
if (!this.resize_requested) {
this._for_each_view(function(view) {
view.resize_canvas(size[0], size[1]);
});
}

this.send_message('refresh');

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

resize: function(width, height) {
this._for_each_view(function(view) {
// Do an initial resize of each view, stretching the old canvas.
view.resize_canvas(width, height);
});

if (this.resize_requested) {
// If a resize was already requested, save the requested size for later
this.requested_size = [width, height];
Expand Down Expand Up @@ -487,6 +493,11 @@ var MPLCanvasView = widgets.DOMWidgetView.extend({
}
}

if (that.resizing) {
// Ignore other mouse events while resizing.
return;
}

if (name === 'motion_notify') {
// If the mouse is on the handle, change the cursor style
if (canvas_pos.x >= that.top_canvas.width - that.resize_handle_size &&
Expand Down