Skip to content

Commit 1b03d71

Browse files
authored
Release v1.1.0
2 parents a0fe743 + 4e70c59 commit 1b03d71

File tree

6 files changed

+21
-6
lines changed

6 files changed

+21
-6
lines changed

.bumper.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.bumper]
2-
current_version = "1.0.1"
2+
current_version = "1.1.0"
33

44
[[tool.bumper.files]]
55
file = "./pyproject.toml"

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Changelog
22
Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (`<major>`.`<minor>`.`<patch>`)
33

4+
## [v1.1.0]
5+
### Changed
6+
* #9 Dragging is now inhibited while another widget has the canvas locked (e.g. zooming/panning)
7+
48
## [v1.0.1]
59
### Fixed
610
* #8 Fix snapping error when plotting timedelta-based axis data
711

8-
912
## [v1.0.0]
1013
Initial release - yay!

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# matplotlib-window
2-
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/matplotlib-window/1.0.1?logo=python&logoColor=FFD43B)](https://pypi.org/project/matplotlib-window/)
2+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/matplotlib-window/1.1.0?logo=python&logoColor=FFD43B)](https://pypi.org/project/matplotlib-window/)
33
[![PyPI](https://img.shields.io/pypi/v/matplotlib-window?logo=Python&logoColor=FFD43B)](https://pypi.org/project/matplotlib-window/)
44
[![PyPI - License](https://img.shields.io/pypi/l/matplotlib-window?color=magenta)](https://github.com/sco1/matplotlib-window/blob/main/LICENSE)
55
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/sco1/matplotlib-window/main.svg)](https://results.pre-commit.ci/latest/github/sco1/matplotlib-window/main)

matplotlib_window/base.py

+12
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ def on_click(self, event: Event) -> t.Any:
125125
if event.inaxes != self.parent_axes:
126126
return
127127

128+
# Return early if we aren't able to obtain a widgetlock
129+
# Obtaining a lock allows us to prevent dragging when zoom/pan is active
130+
if not self.parent_canvas.widgetlock.available(self):
131+
return
132+
128133
if not self.should_move(event):
129134
return
130135

@@ -137,6 +142,9 @@ def on_click(self, event: Event) -> t.Any:
137142
self.mouse_motion = self.parent_canvas.mpl_connect("motion_notify_event", self.on_motion)
138143
self.click_release = self.parent_canvas.mpl_connect("button_release_event", self.on_release)
139144

145+
# Obtaining a lock allows us to prevent dragging when zoom/pan is active
146+
self.parent_canvas.widgetlock(self)
147+
140148
def on_release(self, event: Event) -> t.Any:
141149
"""
142150
Mouse button release callback.
@@ -154,6 +162,10 @@ def disconnect(self) -> None:
154162
self.clicked = False
155163
self.parent_canvas.mpl_disconnect(self.mouse_motion)
156164
self.parent_canvas.mpl_disconnect(self.click_release)
165+
166+
# Release any widgetlock when drag is finished
167+
self.parent_canvas.widgetlock.release(self)
168+
157169
self._redraw()
158170

159171
def validate_snap_to(self, snap_to: Line2D | None) -> Line2D | None:

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "matplotlib-window"
3-
version = "1.0.1"
3+
version = "1.1.0"
44
description = "Draggable data windowing for matplotlib plots"
55
authors = [
66
{name = "sco1", email = "[email protected]"}

uv.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)