Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.1.0 #13

Merged
merged 2 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .bumper.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.bumper]
current_version = "1.0.1"
current_version = "1.1.0"

[[tool.bumper.files]]
file = "./pyproject.toml"
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Changelog
Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (`<major>`.`<minor>`.`<patch>`)

## [v1.1.0]
### Changed
* #9 Dragging is now inhibited while another widget has the canvas locked (e.g. zooming/panning)

## [v1.0.1]
### Fixed
* #8 Fix snapping error when plotting timedelta-based axis data


## [v1.0.0]
Initial release - yay!
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# matplotlib-window
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/matplotlib-window/1.0.1?logo=python&logoColor=FFD43B)](https://pypi.org/project/matplotlib-window/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/matplotlib-window/1.1.0?logo=python&logoColor=FFD43B)](https://pypi.org/project/matplotlib-window/)
[![PyPI](https://img.shields.io/pypi/v/matplotlib-window?logo=Python&logoColor=FFD43B)](https://pypi.org/project/matplotlib-window/)
[![PyPI - License](https://img.shields.io/pypi/l/matplotlib-window?color=magenta)](https://github.com/sco1/matplotlib-window/blob/main/LICENSE)
[![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)
Expand Down
12 changes: 12 additions & 0 deletions matplotlib_window/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ def on_click(self, event: Event) -> t.Any:
if event.inaxes != self.parent_axes:
return

# Return early if we aren't able to obtain a widgetlock
# Obtaining a lock allows us to prevent dragging when zoom/pan is active
if not self.parent_canvas.widgetlock.available(self):
return

if not self.should_move(event):
return

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

# Obtaining a lock allows us to prevent dragging when zoom/pan is active
self.parent_canvas.widgetlock(self)

def on_release(self, event: Event) -> t.Any:
"""
Mouse button release callback.
Expand All @@ -154,6 +162,10 @@ def disconnect(self) -> None:
self.clicked = False
self.parent_canvas.mpl_disconnect(self.mouse_motion)
self.parent_canvas.mpl_disconnect(self.click_release)

# Release any widgetlock when drag is finished
self.parent_canvas.widgetlock.release(self)

self._redraw()

def validate_snap_to(self, snap_to: Line2D | None) -> Line2D | None:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "matplotlib-window"
version = "1.0.1"
version = "1.1.0"
description = "Draggable data windowing for matplotlib plots"
authors = [
{name = "sco1", email = "[email protected]"}
Expand Down
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading