dinodeSimon commented on issue #18949:
URL: https://github.com/apache/echarts/issues/18949#issuecomment-6717387108

   I think part of what makes pinch zoom feel too responsive is how a pinch 
step is chosen. Seen on 6.1.0.
   
   **Cause**
   
   `RoamController`'s pinch handler picks a fixed step from the direction only:
   
   ```ts
   // src/component/helper/RoamController.ts
   const scale = e.pinchScale > 1 ? 1.1 : 1 / 1.1;
   ```
   
   zrender sets `pinchScale = dist(now) / dist(previous)` 
(`src/core/GestureMgr.ts`). So:
   
   1. A two-finger move where the fingers did not move apart at all 
(`pinchScale === 1`) is treated as a zoom-out step.
   2. Every move event is a full 10% step, however small the real change in 
finger distance. That is why it races on devices that send many move events.
   
   We saw Chrome (driven through DevTools) deliver a `touchmove` with both 
fingers where they were: the same move twice. Each one zooms out by 10%. 
Spreading two fingers then zooms in on one event and straight back out on the 
next, so a pinch on a `dataZoom` of type `inside` can end where it started.
   
   **Minimal reproduction** (plain ECharts, nothing else):
   
   ```html
   <div id="c" style="width:400px;height:300px"></div>
   <script 
src="https://cdnjs.cloudflare.com/ajax/libs/echarts/6.1.0/echarts.min.js";></script>
   <script>
     const chart = echarts.init(document.getElementById('c'));
     const days = Array.from({ length: 90 }, (_, i) => 'd' + i);
     chart.setOption({
       xAxis: { type: 'category', data: days },
       yAxis: { type: 'value' },
       dataZoom: [{ type: 'inside' }],
       series: [{ type: 'line', data: days.map((_, i) => i) }]
     });
     chart.on('dataZoom', () => 
console.log(chart.getOption().dataZoom[0].start, 
chart.getOption().dataZoom[0].end));
   </script>
   ```
   
   Through the DevTools protocol (`Input.dispatchTouchEvent`), send a 
`touchStart` with two points 40px apart in the middle of the grid. Then send a 
`touchMove` with the same two points, or each spreading move twice. The logged 
range widens on every unchanged move, and a spreading pinch made of repeated 
moves ends no narrower than it started.
   
   **Possible fix**
   
   In `_pinchHandler`:
   - ignore a pinch event whose `pinchScale` is 1 (or within a small epsilon of 
it);
   - use the real ratio as the scale, for example `scale = e.pinchScale` 
(perhaps clamped per event), instead of a fixed 1.1 step.
   
   That would make a pinch follow the fingers, which would also help this 
issue. Happy to open a PR for it if that is welcome.
   


-- 
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]

Reply via email to