Skip to content

Commit

Permalink
fix: fly to multiple entities added by a layer on reearth/core (#540)
Browse files Browse the repository at this point in the history
feat: support flyTo layer
  • Loading branch information
keiya01 authored Mar 14, 2023
1 parent 31ba319 commit 95b3d3a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/core/engines/Cesium/useEngineRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ export default function useEngineRef(
}
}

const targets: Cesium.Entity[] = [];
for (const entity of viewer.entities.values) {
if (getTag(entity)?.layerId === layerOrFeatureId) {
targets.push(entity);
}
}
if (targets.length) {
viewer.flyTo(targets, options);
return;
}

const entityFromLayerId = findEntity(viewer, layerOrFeatureId);
if (entityFromLayerId && !(entityFromLayerId instanceof Cesium.Cesium3DTileFeature)) {
viewer.flyTo(entityFromLayerId, options);
Expand Down

0 comments on commit 95b3d3a

Please sign in to comment.