tradingview / lightweight-charts

Performant financial charts built with HTML5 canvas
https://www.tradingview.com/lightweight-charts/
Apache License 2.0
9.65k stars 1.65k forks source link

PriceLine event in not working on mobile #1353

Open fhassis opened 1 year ago

fhassis commented 1 year ago

I tried the implementation of issue #1214 on mobile browsers, but this solution is not working. However, it does work on desktop browsers.

Lightweight Charts™ Version: 4.0.1

Steps/code to reproduce: After setting some PriceLine in the chart with id field filled properly, subscribe either with subscribeClick or subscribeCrosshairMove:

chart.subscribeCrosshairMove((param) => {
    if (param.hoveredObjectId) {
            console.log(param.hoveredObjectId);
    }
});

Actual behavior: When clicking in a PriceLine or hovering over one in mobile devices, the hoveredObjectId field of MouseEventParams event is always undefined.

In desktop browers, this attribute is filled correctly as expected.

Expected behavior: hoveredObjectId field of MouseEventParams event containing the id value of the clicked or hovered PriceLine also on mobile devices.

Screenshots:

CodeSandbox/JSFiddle/etc link:

marconi1992 commented 11 months ago

I think the problem is that there is no way to trigger the hover event in touch screens to set the object id 🤔