react-native-echarts icon indicating copy to clipboard operation
react-native-echarts copied to clipboard

Disable moveOnMouseMove when 1s long press

Open simonho1025 opened this issue 8 months ago • 2 comments

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);
});

simonho1025 avatar Jun 07 '24 08:06 simonho1025