onHover for member of CompositeLayer is not called? #5497
-
I'm writing a CompositeLayer that returns a single LineLayer from its function handleOnHover(info, event) {
// ...
// indicate that hovering is handled and should not bubble up to Deck
return true;
}
class MyLayer extends CompositeLayer {
renderLayers() {
return [
new LineLayer(this.getSubLayerProps({
id: 'line',
data: //...
pickable: true,
onHover: handleOnHover
});
];
}
} Unfortunately If I instead pass a What I want to do with this: I want to highlight a subset of the lines based on which line is being hovered - in my data there are certain lines that are related and I want to highlight all related ones when hovering over one of them. I have the necessary data structures to determine these related lines and it feels like this should be something that is an implementation detail of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, this is intentional. The sub layers are considered internal to a composite layer's implementation and are by default not exposed to the end user. For example, if you create a TileLayer that renders a GeoJsonLayer that renders scatterplot and polygon layers, when you specify When you implement your own layer class, a picking event is handled via the |
Beta Was this translation helpful? Give feedback.
Yes, this is intentional. The sub layers are considered internal to a composite layer's implementation and are by default not exposed to the end user. For example, if you create a TileLayer that renders a GeoJsonLayer that renders scatterplot and polygon layers, when you specify
onHover
on the TileLayer, it is called only once per mouse move, instead of 3 times bubbling up from the lowest level.When you implement your own layer class, a picking event is handled via the
getPickingInfo
method, as explained here: https://deck.gl/docs/developer-guide/custom-layers/picking#event-propagation This method on the CompositeLayer receives an additionalsourceLayer
argument that indicates where the …