takaebato opened a new pull request, #21588:
URL: https://github.com/apache/echarts/pull/21588
<!-- Please fill in the following information to help us review your PR more
efficiently. -->
## Brief Information
This pull request is in the type of:
- [ ] bug fixing
- [x] new feature
- [ ] others
### What does this PR do?
<!-- USE ONE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
Lets an inside dataZoom pin its pan / zoom to a single wheel axis via two
new options (`moveOnMouseWheelAxis`,
`zoomOnMouseWheelAxis`), so horizontal mouse wheels and tilt wheels can
finally drive it.
### Fixed issues
- Related to #18365 (horizontal mouse wheel support). Same problem,
different API — see Misc for details.
## Details
### Before: What was the problem?
<!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
1. No horizontal wheel support. zrender's polyfill collapses `deltaX` and
`deltaY` into a single `wheelDelta`,
so tilt wheels and other horizontal inputs never reached the x-axis
independently.
2. No axis restriction. When two inside dataZooms share a coord sys (one on
each cartesian axis), any wheel direction
pans / zooms both — there was no way to split them.
<!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
### After: How does it behave after the fixing?
<!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED.
-->
1. `RoamController`'s `'zoom'` and `'scrollMove'` events now carry per-axis
fields (`scaleX` / `scaleY`,
`scrollDeltaX` / `scrollDeltaY`) alongside the existing `scale` /
`scrollDelta` scalars. Per-axis values are
polyfilled from the native `WheelEvent` when `deltaX` / `deltaY` are
available; pre-2013 IE falls back to
caller-supplied defaults. Touch pinch mirrors the scalar into both
per-axis fields since it has no distinct
direction.
2. Two new options on `dataZoom.inside`:
- `moveOnMouseWheelAxis?: 'horizontal' | 'vertical'` — pin the pan to a
single wheel axis.
- `zoomOnMouseWheelAxis?: 'horizontal' | 'vertical'` — pin the zoom to a
single wheel axis.
3. With both options unset, existing behavior is preserved.
<!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
## Document Info
One of the following should be checked.
- [ ] This PR doesn't relate to document changes
- [x] The document should be updated later
- [ ] The document changes have been made in apache/echarts-doc#xxx
## Misc
### Security Checking
- [ ] This PR uses security-sensitive Web APIs.
<!-- PLEASE CHECK IT AGAINST:
<https://github.com/apache/echarts/wiki/Security-Checklist-for-Code-Contributors>
-->
### ZRender Changes
- [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
### Related test cases or examples to use the new APIs
`test/dataZoom-inside-wheel-axis.html` (added in this PR) — 11 manual panels
covering the default fallback,
`moveOnMouseWheelAxis` / `zoomOnMouseWheelAxis` with various axis configs,
zoom / pan composition, shift-based
horizontal scroll, and polar coordinate systems.
### Merging options
- [ ] Please squash the commits into a single one when merging.
### Other information
**Relation to #18365.** Same underlying problem (horizontal wheel input is
lost because zrender's `wheelDelta`
collapses both axes into a single scalar), different API. Rather than
extending `moveOnMouseWheel` /
`zoomOnMouseWheel` with composite values like `'x+shift'` / `'y+none'`, this
PR splits the concern in two:
- `moveOnMouseWheelAxis` / `zoomOnMouseWheelAxis` — **which wheel axis**
drives the dataZoom.
- `moveOnMouseWheel` / `zoomOnMouseWheel` — **under which modifier state**
the action fires.
Keeping the two orthogonal means axis restriction composes cleanly with any
existing modifier mode, without a
combinatorial explosion of composite strings. The `'none'` modifier value
also mentioned in that issue is out of
scope here and can follow separately.
**Touch pinch.** Axis restriction applies only to wheel-driven pan / zoom.
Touch pinch keeps zooming on every dataZoom
regardless of the axis restriction setting — a touch pinch is a 2D gesture
with no distinct horizontal / vertical
component.
**Future work.** A follow-up is planned to tackle the magnitude side. The
`FIXME` in `RoamController` sits on a
3-tier heuristic that ignores `deltaMode`, still carries the IE-era `/ 120`
division, and feels a bit fast on some
setups. The plan is to derive the magnitude from the native `WheelEvent`
directly, retire the `FIXME`, and add a
`wheelSensitivity` option.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]