resium icon indicating copy to clipboard operation
resium copied to clipboard

Difference between the onClick in the viewer and the onClick in each entities?

Open federicomarcantognini opened this issue 1 year ago • 0 comments

I would like to get the metadata from the clicked instance, I can achieve that by either onClick as a prop on the entity and in the viewer. What is the difference and what's faster?

in the viewer: <Viewer onClick={(e, target) => { if (target?.id instanceof Entity) { // target.id is an Entity! } else if (target?.primitive instanceof Primitive) { // target.id is a Primitive! } else if (target instanceof Cesium3DTileFeature) { // target is a Cesium3DTileFeature! } }} />

in the Entity: onClick={(moment, entity) => onClick(entity.id._name, moment)}

federicomarcantognini avatar Sep 26 '23 12:09 federicomarcantognini