resium
resium copied to clipboard
Difference between the onClick in the viewer and the onClick in each entities?
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)}