Skip to content

Commit

Permalink
allow setting the cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
kushalkolar committed Nov 27, 2023
1 parent 3fd0dc6 commit fa6b6fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/lib/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export class RemoteFrameBufferModel extends DOMWidgetModel {
css_width: '500px',
css_height: '300px',
resizable: true,
has_visible_views: false
has_visible_views: false,
cursor: 'default'
};
}
initialize() {
Expand Down Expand Up @@ -204,6 +205,10 @@ export class RemoteFrameBufferView extends DOMWidgetView {
this.el.appendChild(this.img);
this.model.collect_view_img_elements();

// Cursor
this.el.style.cursor = this.model.get('cursor');
this.model.on('change:cursor', function () { this.el.style.cursor = this.model.get('cursor'); }, this);

// Set of throttler functions to send events at a friendly pace
this._throttlers = {};

Expand Down
3 changes: 3 additions & 0 deletions jupyter_rfb/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class RemoteFrameBuffer(ipywidgets.DOMWidget):
* *max_buffered_frames*: the number of frames that is allowed to be "in-flight",
i.e. sent, but not yet confirmed by the client. Default 2. Higher values
may result in a higher FPS at the cost of introducing lag.
* *cursor*: the cursor style, ex: "crosshair", "grab". Valid cursors:
https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#keyword
"""

Expand Down Expand Up @@ -75,6 +77,7 @@ class RemoteFrameBuffer(ipywidgets.DOMWidget):
css_width = Unicode("500px").tag(sync=True)
css_height = Unicode("300px").tag(sync=True)
resizable = Bool(True).tag(sync=True)
cursor = Unicode("default").tag(sync=True)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down

0 comments on commit fa6b6fd

Please sign in to comment.