deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

IconLayer's PickInfo does not include object when data iterable is a Map

Open testower opened this issue 3 years ago • 1 comments

Description

When using IconLayer's onClick or onHover properties, the PickInfo argument of the callback should include the object from the data. When the data property is an array this works fine, but when the data property is a Map the object is missing.

Flavors

  • [X] React
  • [ ] Python/Jupyter notebook
  • [ ] MapboxLayer
  • [ ] GoogleMapsOverlay
  • [ ] CartoLayer
  • [ ] DeckLayer/DeckRenderer for ArcGIS

Expected Behavior

The PickInfo argument should include the data object when using any Iterable for the data property, not just when it is an array.

Steps to Reproduce

Reproduced in the following code sandbox: https://codesandbox.io/s/competent-smoke-enxlcx?file=/src/App.tsx

Hover over the two different icons to see the PickInfo logged to the console for both scenarios.

Environment

  • Framework version: 8.3.10

Logs

No response

testower avatar Sep 13 '22 15:09 testower

This is expected. The picked index is used to retrieve object as data[index]. If your data is not an array then it's not going to be populated. You can still get the object yourself with something like Array.from(data)[info.index]. Indexing into arbitrary iterables is unlikely to be supported out of the box because it will have a significant impact on the picking performance.

Pessimistress avatar Sep 20 '22 08:09 Pessimistress

Ok thanks for the explanation.

testower avatar Sep 23 '22 11:09 testower