Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable moveOnMouseMove when 1s long press #181

Open
simonho1025 opened this issue Jun 7, 2024 · 2 comments
Open

Disable moveOnMouseMove when 1s long press #181

simonho1025 opened this issue Jun 7, 2024 · 2 comments

Comments

@simonho1025
Copy link

simonho1025 commented Jun 7, 2024

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);
});
@zhiqingchen
Copy link
Member

@simonho1025
Copy link
Author

simonho1025 commented Jun 11, 2024

for custom event handle

https://wuba.github.io/react-native-echarts/docs/advanced-guides/use-rngh

but may I know how to change moveOnMouseMove value after long press?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants