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

Mouse events are not at the correct location for line layer with a line-offset #1108

Closed
jkoelewijn opened this issue Mar 18, 2022 · 0 comments · Fixed by #1110
Closed

Mouse events are not at the correct location for line layer with a line-offset #1108

jkoelewijn opened this issue Mar 18, 2022 · 0 comments · Fixed by #1110

Comments

@jkoelewijn
Copy link
Contributor

maplibre-gl-js version: at least 2.1.7, probably all versions

browser: at least Chrome, Firefox and Edge

Steps to Trigger Behavior

  1. Create a line layer with a nonzero line-offset
  2. Listen for mouseenter and mouseleave events for that layer
  3. Observe that the events are triggered at the wrong location, especially at the end of the line

Link to Demonstration

https://jsbin.com/kokutixesa/3/edit?html,output

Expected Behavior

In the demonstration link, when hovering the mouse over the green thick line, the green thick line becomes red with a dash pattern.

Actual Behavior

In the demonstration link, the mouseenter and mouseleave events of the layer with the green thick line act like the green thick line starts at the right of the green thick line and ends at the left of the black line.

Similar Mapbox GL JS issue

mapbox/mapbox-gl-js#9419

jkoelewijn added a commit to jkoelewijn/maplibre-gl-js that referenced this issue Mar 19, 2022
jkoelewijn added a commit to jkoelewijn/maplibre-gl-js that referenced this issue Mar 20, 2022
@jkoelewijn jkoelewijn changed the title Mouse events are not at the correct location for LineStrings with a line-offset Mouse events are not at the correct location for line layer with a line-offset Mar 20, 2022
jkoelewijn added a commit to jkoelewijn/maplibre-gl-js that referenced this issue Mar 21, 2022
HarelM pushed a commit that referenced this issue Mar 21, 2022
…fset (#1108) (#1110)

Fixes #1108 

* Fix: use correct location for mouse events of LineString with line-offset (#1108)

* Move offsetLine to query_utils in preparation of unit test

* Add unit tests for offsetLine

* Prevent division by zero in offsetLine

* Add typings to offsetLine and rename for loop variables

* Add line to changelog file about the bugfix of #1108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant