Skip to content

Add support for modifiers and allow to auto-activate WheelZoomTool#13815

Merged
mattpap merged 7 commits intobranch-3.5from
mattpap/10439_WheelZoomTool_auto_active
Apr 10, 2024
Merged

Add support for modifiers and allow to auto-activate WheelZoomTool#13815
mattpap merged 7 commits intobranch-3.5from
mattpap/10439_WheelZoomTool_auto_active

Conversation

@mattpap
Copy link
Contributor

@mattpap mattpap commented Apr 8, 2024

Originally I started working on scroll support in BoxAnnotation per issue #13646, but I realized that I need to resolve the more generic issue of conditional handling of scroll events first, so that bokehjs doesn't interfere by with page scrolling, while allowing some way of easy access to scrolling functionality (like wheel zoom or wheel pan tools provide).

Thus this PR:

  • redesigns how tool event handlers are invoked and allows to indicated from such handlers if an event was handled or not (this has the added benefit of not using expensive signaling infrastructure to dispatch UI events to tool handlers)
  • adds support for modifiers to WheelZoomTool and WheelPanTool
  • adds support to Toolbar for auto-activation of such tools when modifiers are set
  • adds support for a visual indicator that a modifier is required to perform tool's function (e.g. an alert or a plot overlay)

This example shows WheelZoomTool configured with modifiers = dict(ctrl=True), first being scrolled without the modifier and then with:

Screencast.from.09.04.2024.02.22.41.webm

fixes #10439

@jbednar
Copy link
Contributor

jbednar commented Apr 8, 2024

Cool! Can you describe the details of how it "redesigns how tool event handlers are invoked"?

@mattpap
Copy link
Contributor Author

mattpap commented Apr 8, 2024

Cool! Can you describe the details of how it "redesigns how tool event handlers are invoked"?

The previous approach using signals didn't allow for returning a value from handlers (like WheelZoomTool._scroll), so this PR changes that, replacing signals with direct function calls.

@mattpap mattpap force-pushed the mattpap/10439_WheelZoomTool_auto_active branch from f20a3f7 to d5ccbf9 Compare April 10, 2024 08:44
@codecov
Copy link

codecov bot commented Apr 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.64%. Comparing base (e61219b) to head (d5ccbf9).
Report is 1 commits behind head on branch-3.5.

Additional details and impacted files
@@              Coverage Diff               @@
##           branch-3.5   #13815      +/-   ##
==============================================
+ Coverage       91.57%   92.64%   +1.06%     
==============================================
  Files             326      326              
  Lines           20737    20751      +14     
==============================================
+ Hits            18990    19224     +234     
+ Misses           1747     1527     -220     

@mattpap mattpap merged commit 10ff334 into branch-3.5 Apr 10, 2024
@mattpap mattpap deleted the mattpap/10439_WheelZoomTool_auto_active branch April 10, 2024 09:28
Chiemezuo pushed a commit to Chiemezuo/bokeh that referenced this pull request Aug 27, 2024
…okeh#13815)

* Allow to indicate if an event was handled by a tool

* Allow to configure key modifiers in Wheel*Tool

* Allow to auto-activate Wheel*Tool if modifiers are set

* Add rudimentary support for plot notifications

* Add unit and integration tests

* Add release notes

* Add concise modifier syntax and improve docstrings
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Activate wheel zoom by default with BokehJS

3 participants