MCPcopy Create free account
hub / github.com/facebook/Rapid / gotEntity

Method gotEntity

modules/core/MapSystem.js:737–754  ·  view source on GitHub ↗
(entity)

Source from the content-addressed store, hash-verified

735 }
736
737 const gotEntity = (entity) => {
738 const selectedIDs = context.selectedIDs();
739 if (context.mode?.id !== 'select-osm' || !selectedIDs.includes(entityID)) {
740 scene.enableLayers('osm');
741 context.enter('select-osm', { selection: { osm: [entity.id] }} );
742 }
743
744 const currGraph = editor.staging.graph; // may have changed by the time we get in here
745 const entityExtent = entity.extent(currGraph);
746 const entityZoom = Math.min(this.trimmedExtentZoom(entityExtent), 20); // the zoom that best shows the entity
747 const isOffscreen = (entityExtent.percentContainedIn(viewport.visibleExtent()) < 0.8);
748 const isTooSmall = (viewport.transform.zoom < entityZoom - 2);
749
750 // Can't reasonably see it, or we're forcing the fit.
751 if (fitEntity || isOffscreen || isTooSmall) {
752 this.fitEntities(entity);
753 }
754 };
755
756 const currGraph = editor.staging.graph;
757 let entity = currGraph.hasEntity(entityID);

Callers

nothing calls this directly

Calls 6

trimmedExtentZoomMethod · 0.95
fitEntitiesMethod · 0.95
enableLayersMethod · 0.80
selectedIDsMethod · 0.45
enterMethod · 0.45
extentMethod · 0.45

Tested by

no test coverage detected