Skip to content

Commit d02d4de

Browse files
committed
Change cursor when the mouse is on the resize handle
Signed-off-by: martinRenou <[email protected]>
1 parent 1258087 commit d02d4de

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

js/src/mpl_widget.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,8 @@ var MPLCanvasView = widgets.DOMWidgetView.extend({
477477

478478
if (name === 'button_press') {
479479
// If clicking on the resize handle
480-
if (canvas_pos.x >= that.top_canvas.width - that.resize_handle_size && canvas_pos.y >= that.top_canvas.height - that.resize_handle_size) {
480+
if (canvas_pos.x >= that.top_canvas.width - that.resize_handle_size &&
481+
canvas_pos.y >= that.top_canvas.height - that.resize_handle_size) {
481482
that.resizing = true;
482483
return;
483484
} else {
@@ -490,6 +491,16 @@ var MPLCanvasView = widgets.DOMWidgetView.extend({
490491
that.resizing = false;
491492
}
492493

494+
if (name === 'motion_notify') {
495+
// If the mouse is on the handle, change the cursor style
496+
if (canvas_pos.x >= that.top_canvas.width - that.resize_handle_size &&
497+
canvas_pos.y >= that.top_canvas.height - that.resize_handle_size) {
498+
that.top_canvas.style.cursor = 'nw-resize';
499+
} else {
500+
that.top_canvas.style.cursor = that.model.get('_cursor');
501+
}
502+
}
503+
493504
// Rate-limit the position text updates so that we don't overwhelm the
494505
// system.
495506
if (Date.now() > last_update + 16) {

0 commit comments

Comments
 (0)