(entity)
| 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); |
nothing calls this directly
no test coverage detected