Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Horizontal wheel scrolling #14363

Copy link
Copy link
@kernc

Description

@kernc
Issue body actions

Problem description

I want tools xwheel_zoom,xwheel_pan active at the same time: xwheel_zoom upon vertical (regular) scrolling and xwheel_pan upon horizontal scrolling.

TradingView scrolls this way, for example. Most touchpads support horizontal scrolling, and there are mice available with 2+ scroll wheels ...

It would be a small productivity boost not to need to switch active_scroll tool manually.

Feature description

from bokeh.plotting import figure, show

p = figure(title="Want: xzoom on v-scroll, xpan on h-scroll",
           tools='xwheel_zoom,xwheel_pan',
           active_scroll='xwheel_zoom,h-xwheel_pan')  # <-- proposed new syntax 😅
p.scatter([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=20)
show(p)

Potential alternatives

The alternative would be to use modifiers= (untested), but would be neat if horizontal scrolling worked out of the box.
(EDIT: Can't even quite get a .modifiers example to work. 🤔)

Additional information

The code presently considers WheelEvent.deltaY only:

delta: getDeltaY(event),

export function getDeltaY(event: WheelEvent) {
let deltaY = -event.deltaY
if (event.target instanceof HTMLElement) {
switch (event.deltaMode) {
case event.DOM_DELTA_LINE:
deltaY *= lineHeight(event.target)
break
case event.DOM_DELTA_PAGE:
deltaY *= pageHeight(event.target)
break
}
}
return deltaY

Instead it could use, and scroll in the direction of, whichever delta (deltaY, deltaX) was greater, or both proportionally.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.