简体   繁体   中英

onHover not working with scenegraph in deck.gl

my code - layer

new ScenegraphLayer({
  id:"22",
  scenegraph: "glb/22.glb",
  data: dataArray.glb22,
  getPosition: d => [d.geometry.coordinates[0],
                     d.geometry.coordinates[1], 0] ,
  sizeMinPixels: 1,
  sizeMaxPixels: 10,
  getOrientation: [0, 180, 90],
  getTranslation: [0, 0, 0],
  sizeUnits: 'meters',
  onHover: this._onHover
});

onHover Code is

_onHover({x, y, object}) {
  console.log("TTTTTTTTTTTTTTTTT");
}

but not working. this code working in geojsonLayer.

how to fix my code? I want onHover working in scenegraph-layer. thanks.

I think you just forgot to add pickable ability. onHover required pickable properties to be true. You can read more about that here .

Here there is an online example of ScenegraphLayer from official documentantion and here you can see the source code. Pay attention to row 116 :

const layer =
    data &&
    new ScenegraphLayer({
      id: 'scenegraph-layer',
      data,
      pickable: true,
      ...
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM