leeoniya / uPlot

📈 A small, fast chart for time series, lines, areas, ohlc & bars
MIT License
8.48k stars 370 forks source link

Click event on chart is 'destroying' existing selection #936

Open lucianbaciu opened 1 month ago

lucianbaciu commented 1 month ago

The bug is easy to be reproduced. In order to do so, use a simple example, like Grid Over Series (https://leeoniya.github.io/uPlot/demos/grid-over-series.html), and add one line of code at the end:

u.setSelect({left: 50, width: 400, height: 500}, false);

and:

 cursor: {
    drag: {
        setScale: false,
    },
},

in the settings.

image

A simple click outside of the selection (on chart), will make the selection to completely dissapear.

When having complex time rangers with selection and interaction, this becomes a big issue.

The issue was not happening into 1.6.22, but it does in 1.6.30

It may have to deal with the

   interface Drag {
/** post-drag "click" event proxy, default is to prevent these click events */
            click?: (self: uPlot, e: MouseEvent) => void;