Skip to content

Allow to auto activate wheel zoom tool on focus#14112

Merged
mattpap merged 13 commits into
branch-3.7from
mattpap/11136_Plot_focus
Mar 3, 2025
Merged

Allow to auto activate wheel zoom tool on focus#14112
mattpap merged 13 commits into
branch-3.7from
mattpap/11136_Plot_focus

Conversation

@mattpap
Copy link
Copy Markdown
Contributor

@mattpap mattpap commented Oct 20, 2024

This PR adds support for focus management to plots. In particular this allows to support:

  • automatic activation of wheel zoom tool on focus
Screencast.from.2024-10-21.00-13-19.webm

fixes #14384
addresses #11136, #13093

@mattpap mattpap added status: WIP grant: CZI R6 Funded by CZI Round 6 grant labels Oct 20, 2024
@mattpap mattpap added this to the 3.7 milestone Oct 20, 2024
@mattpap mattpap changed the title Add support for focus management to plots Allow to auto activate wheel zoom tool on focus Oct 26, 2024
@mattpap mattpap force-pushed the mattpap/11136_Plot_focus branch from 75cf6b8 to 6f2b2d7 Compare October 27, 2024 21:39
@mattpap mattpap force-pushed the mattpap/11136_Plot_focus branch from 6f2b2d7 to d4604f7 Compare November 12, 2024 22:22
@mattpap mattpap force-pushed the mattpap/11136_Plot_focus branch from d4604f7 to bd579f0 Compare December 16, 2024 23:14
@mattpap mattpap requested review from bryevdv and gabalafou December 16, 2024 23:15
Copy link
Copy Markdown
Member

@bryevdv bryevdv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I think @hoxbro is more into the BokehJS codebase then I am lately (please correct me if I'm wrong @hoxbro), in which case I'd suggest he also have a quick look

@bryevdv bryevdv requested a review from hoxbro December 18, 2024 22:44
Copy link
Copy Markdown
Contributor

@hoxbro hoxbro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some questions.

How does this change behave in Jupyter Notebook, where scrolling is prevalent?

Comment thread bokehjs/src/lib/models/annotations/toolbar_panel.ts Outdated
Comment thread bokehjs/src/lib/models/plots/plot_canvas.ts Outdated
Comment thread bokehjs/src/lib/models/canvas/canvas.ts
@mattpap
Copy link
Copy Markdown
Contributor Author

mattpap commented Dec 19, 2024

How does this change behave in Jupyter Notebook, where scrolling is prevalent?

Nothing changes as long as plots aren't focused. If you focus a plot by tapping or panning over it, then mouse wheel capture will be automatically enabled and thus any relevant tools (like WheelZoomTool). When the plot blurs (loses focus), then tools deactivate and scrolling go backs to default browser behavior.

@mattpap mattpap force-pushed the mattpap/11136_Plot_focus branch 2 times, most recently from baef698 to 098a561 Compare February 11, 2025 23:51
@mattpap mattpap force-pushed the mattpap/11136_Plot_focus branch from 098a561 to d5909e4 Compare February 13, 2025 00:48
Copy link
Copy Markdown
Contributor

@gabalafou gabalafou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mostly looks good to me. Not sure if anything needs to be changed, but I left a few comments in the code.

Comment thread bokehjs/src/lib/core/dom.ts
Comment thread bokehjs/src/lib/core/dom.ts
Comment thread bokehjs/src/lib/core/ui_events.ts
Comment thread bokehjs/src/lib/models/tools/toolbar.ts Outdated
Comment thread bokehjs/test/unit/models/tools/gestures/wheel_zoom_tool.ts Outdated
Comment thread bokehjs/src/lib/models/plots/plot_canvas.ts
@mattpap mattpap force-pushed the mattpap/11136_Plot_focus branch from d5909e4 to 0758e88 Compare March 3, 2025 18:36
@mattpap mattpap force-pushed the mattpap/11136_Plot_focus branch from 611dd39 to db8b043 Compare March 3, 2025 19:12
@github-actions
Copy link
Copy Markdown

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 Jun 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

grant: CZI R6 Funded by CZI Round 6 grant status: accepted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for auto-activation of WheelZoomTool when plot is focused

4 participants