Skip to content

Commit

Permalink
Release v1.1.0
Browse files Browse the repository at this point in the history
sco1 authored Dec 31, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents a0fe743 + 4e70c59 commit 1b03d71
Showing 6 changed files with 21 additions and 6 deletions.
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"
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)
12 changes: 12 additions & 0 deletions matplotlib_window/base.py
Original file line number Diff line number Diff line change
@@ -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

@@ -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.
@@ -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:
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 = "sco1.git@gmail.com"}
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.

0 comments on commit 1b03d71

Please sign in to comment.