apache / apache/echarts

[Bug] Pinch on maps has too high scale factor, thus feeling unnatural

Open
#18,113 2 comments 6 reactions 0 assignees View on GitHub
en enhancement mobile
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.4.1

### Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?c=map-usa

### Steps to Reproduce

Open https://echarts.apache.org/examples/en/editor.html?c=map-usa on a smartphone. Use your fingers to pinch into the map.

### Current Behavior

The zooming does not feel natural, because the scale factor is too high. E.g., when the fingers move by 1 cm, the map below the fingers moves by 3 cm.

### Expected Behavior

When moving the fingers, the location of the map below each finger should stay fixed while the fingers move.

### Environment

```markdown
- OS: Android 12
- Browser: Chromium, Brave
```

### Any additional comments?

* the [pinch recognizer of zrender](https://github.com/ecomfe/zrender/blob/9197e0573daaedb2344a69acc83b4dd03d070615/src/core/GestureMgr.ts#L90) calculates a pinchScale - this looks good
* the [RoamController._pinchHandler of echarts](https://github.com/apache/echarts/blob/3c27102b030eb26e5e6f31b5e3ff1f8089bcb181/src/component/helper/RoamController.ts#L280) ignores this value, only using its sign, and hard-codes the scale to 1.1
* if I comment out this hard-coded value of 1.1 and use the provided pinchScale, the issue is resolved and pinching feels natural again.

I couldn't find the initial commit that started providing this hard-coded value, but maybe @100pah, who did a lot of work on the RoamController, can comment on why the calculated pinchScale is ignored and hard-coded to 1.1...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.