wuba / wuba/react-native-echarts
Disable moveOnMouseMove when 1s long press
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 967
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
I would like to set moveOnMouseMove to false when 1s long press(mousedown), so I tried to use dispatchAction. And when mouseup, moveOnMouseMove set to true. But this method doesn't work. I also try to use setOption, but the chart will reload that not stay the current position. So I want to know how to achieve disable moveOnMouseMove while trigger click event.
let pressTimer = 0;
chartObj.getZr().on('mousedown', (params: any) => {
console.log('mousedown: ', params);
pressTimer = setTimeout(() => {
setMoveOnMouseMove(false);
chartObj.dispatchAction({
type: 'dataZoom',
moveOnMouseMove: false
});
}, 1000);
return false;
});
chartObj.getZr().on('mouseup', () => {
console.log('mouseup');
chartObj.dispatchAction({
type: 'dataZoom',
moveOnMouseMove: true
});
clearTimeout(pressTimer);
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names chartObj.getZr() mousedown and mouseup handlers plus dispatchAction; start by tracing those entry points in the TypeScript chart integration. Reproduce the one-second long-press case, then verify that moveOnMouseMove is disabled during the hold, restored on mouseup, and the chart keeps its current position.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- frontend, mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100