Way to change price line `HitTestThreshold`
Is your feature request related to a problem? Please describe.
This constant defines the area used to check if a price line is hovered over or clicked. The current value (7) is relatively large and causes issues when chart contains several price lines. For example, hovering over one line might unexpectedly return hoveredObjectId with another price line id.
Demo https://codesandbox.io/p/sandbox/lightweight-charts-skeleton-forked-v6tqm6.
Steps to reproduce:
- open console
- reload page with chart
- hover over black price line
- notice that
hoveredObjectIdcontains red price line id
Maybe the idea of having large number for HitTestThreshold was to have better user experience in mobile browsers (so you don't need to tap precisely on the thin line). However, in a desktop browser, it looks more like a bug.
Describe the solution you'd like
The simplest solution is to allow to configure a value for the threshold that is currently hardcoded in HitTestThreshold constant.
For example, for a scenario where charts are used only in desktop browsers, I would disable the threshold at all (i.e. set it to zero).
Source: tradingview/lightweight-charts