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

Way to change price line HitTestThreshold #1610

Open
Jokero opened this issue Jun 1, 2024 · 0 comments
Open

Way to change price line HitTestThreshold #1610

Jokero opened this issue Jun 1, 2024 · 0 comments
Labels
good first issue Good issue for first-time contributors. help wanted Asking for outside help and/or contributions to this particular issue or PR. polish Very minor behavior improvement that users will enjoy.

Comments

@Jokero
Copy link

Jokero commented Jun 1, 2024

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:

  1. open console
  2. reload page with chart
  3. hover over black price line
  4. notice that hoveredObjectId contains red price line id
image

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).

@SlicedSilver SlicedSilver added polish Very minor behavior improvement that users will enjoy. help wanted Asking for outside help and/or contributions to this particular issue or PR. good first issue Good issue for first-time contributors. labels Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issue for first-time contributors. help wanted Asking for outside help and/or contributions to this particular issue or PR. polish Very minor behavior improvement that users will enjoy.
Projects
None yet
Development

No branches or pull requests

2 participants