-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 depth picking from GeoJSON layer for binary features #7817
Fix depth picking from GeoJSON layer for binary features #7817
Conversation
579ed5d
to
7d36e64
Compare
modules/core/src/lib/layer.ts
Outdated
values[i + 2] === objectColor[2] | ||
) { | ||
this._disablePickingIndex(index); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This break will prevent disabling picking colors correctly for multi polygons or multi line strings -- every match needs to disabled, not just the first one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, sorry about that. Could you kill the line and make sure this PR fixes the original issue before we merge? I think the only thing missing is unit tests, but I can add that in a follow up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed + verified that it works as I'd expect now!
Co-authored-by: Xiaoji Chen <Pessimistress@users.noreply.github.com>
Depth picking from binary features does not work when the features are not all the same type (i.e. not all polygons). This is because the global feature index -- the index in the GeoJSON equivalent -- does not necessarily match the index of the feature/datum in each of the point/polygon/line sublayers.
This PR adds a
_getSublayerPickingIndex
method to allow composite layers to translate picked ids from a global id into the correct one (or multiple, to correctly handle MultiPolygon/MultiLineString cases where a single global id has multiple local ids) to be used for clearing the picking buffer.It doesn't feel like the cleanest approach, but I do like that it keeps the knowledge about indices in the layer that would know (the composite parent). Happy to attempt it some other way if anyone has a proposed better approach; though this does seem to work reliably.