Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Improve signature of set_span_cursor
  • Loading branch information
dstansby authored and hasanrashid committed Oct 2, 2025
commit 59f54c0d9fd1f39722750113707089167575a2e4
8 changes: 4 additions & 4 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2650,7 +2650,7 @@ def _handles_artists(self):
else:
return ()

def _set_span_cursor(self, enabled):
def _set_span_cursor(self, *, enabled):
"""Update the canvas cursor based on direction of the selector."""
if enabled:
cursor = (backend_tools.Cursors.RESIZE_HORIZONTAL
Expand All @@ -2669,7 +2669,7 @@ def connect_default_events(self):

def _press(self, event):
"""Button press event handler."""
self._set_span_cursor(True)
self._set_span_cursor(enabled=True)
if self._interactive and self._selection_artist.get_visible():
self._set_active_handle(event)
else:
Expand Down Expand Up @@ -2719,7 +2719,7 @@ def direction(self, direction):

def _release(self, event):
"""Button release event handler."""
self._set_span_cursor(False)
self._set_span_cursor(enabled=False)

if not self._interactive:
self._selection_artist.set_visible(False)
Expand Down Expand Up @@ -2761,7 +2761,7 @@ def _hover(self, event):
return

_, e_dist = self._edge_handles.closest(event.x, event.y)
self._set_span_cursor(e_dist <= self.grab_range)
self._set_span_cursor(enabled=e_dist <= self.grab_range)

def _onmove(self, event):
"""Motion notify event handler."""
Expand Down
1 change: 1 addition & 0 deletions lib/matplotlib/widgets.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ class SpanSelector(_SelectorWidget):
_props: dict[str, Any] | None = ...,
_init: bool = ...,
) -> None: ...
def _set_span_cursor(self, *, enabled: bool) -> None: ...
def connect_default_events(self) -> None: ...
@property
def direction(self) -> Literal["horizontal", "vertical"]: ...
Expand Down