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

[Feat]getPickingInfo don't support async call

Open zairl23 opened this issue 3 years ago • 1 comments

Target Use Case

When click a Tile3D layer, i want how the building info in a popup ui component by calling loadFeatureAttributes(info.object, info.index) which is a async function , but getPickingInfo of layer don't suppport async call

Proposal

Layer's getPickingInfo support async call.

zairl23 avatar Aug 06 '22 13:08 zairl23

getPickingInfo needs to be synchronous so that onHover/onClick etc are called promptly. If you need to perform some async action you can do so in your own app, something like

getPickingInfo({info}) {
  info.getFeatureAttributes = async () => {
    // wrap the async operation with internal information
  };
}

And in your application

onClick: async (info) => {
  const attributes = await info.getFeatureAttributes();
  ...
}

Pessimistress avatar Aug 10 '22 17:08 Pessimistress

@Pessimistress thank you

zairl23 avatar Sep 13 '22 13:09 zairl23