-
-
Notifications
You must be signed in to change notification settings - Fork 783
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
Fix: use correct location for mouse events of line layer with line-offset (#1108) #1110
Conversation
Can you create a test that fails before this fix and passes afterwards? |
Bundle size report: Size Change: +5 B
ℹ️ View Details
|
4d5905e
to
e6fe1c0
Compare
@HarelM, this pull request should be improved now. I'm not sure how to post the benchmark scores though... Update: I found out how to run the benchmark: #666 (comment). |
Also the first checkbox is not ticked... |
If the code is different then this is not a backport. |
Changelog file entry is missing, can you please add? |
Changelog category
bug
Changelog
Use correct location for mouse events of line layer with line-offset (#1108).
Technical description
The
offsetLine
function uses aring
array that contains instances of the classPoint
from@mapbox/point-geometry
. Methods of thePoint
class that are prefixed with_
adjust the instance of thePoint
class in place, i.e. no new instance is created and the current instance is mutated as a side effect and returned. This goes wrong when thezero
variable is reused.In the solution of this pull request the
zero
variable is removed and new instances of thePoint
class are created when needed.Backport from Mapbox project?
This fixes #1108 using a similar solution as in jack9ye/mapbox-gl-js@ad2df2d, which is referred to in mapbox/mapbox-gl-js#9419. The code is different, but the solution is very similar.
I guess that does not count as a backport, but I'm not totally sure. Please confirm.
Update: I checked what Mapbox GL JS version jack9ye uses for his proposed solution and unfortunately that is v2.2.0. However, all the code that is visible in jack9ye/mapbox-gl-js@ad2df2d has not changed since v1.14.0-dev. Furthermore, the solution of this pull request will typically create 2 new
Point
objects per ring and the solution of jack9ye/mapbox-gl-js@ad2df2d will create 3.Tasks
maplibre-gl-js
changelog.