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

Method fitEntities

modules/core/MapSystem.js:702–717  ·  view source on GitHub ↗

* fitEntities * Adjust the map to fit to see the given entity or entities * @param entities Entity or Array of entities to fit in the map view * @param duration? Duration of the transition in milliseconds, defaults to 0ms (asap) * @return this

(entities, duration = 0)

Source from the content-addressed store, hash-verified

700 * @return this
701 */
702 fitEntities(entities, duration = 0) {
703 let extent;
704
705 const editor = this.context.systems.editor;
706 const graph = editor.staging.graph;
707
708 if (Array.isArray(entities)) {
709 extent = utilTotalExtent(entities, graph);
710 } else {
711 extent = entities.extent(graph);
712 }
713 if (!isFinite(extent.area())) return this;
714
715 const z2 = numClamp(this.trimmedExtentZoom(extent), 0, 20);
716 return this.setMapParams(extent.center(), z2, undefined, duration);
717 }
718
719
720 /**

Callers 2

gotEntityMethod · 0.95
fitEntitiesEaseMethod · 0.95

Calls 6

trimmedExtentZoomMethod · 0.95
setMapParamsMethod · 0.95
utilTotalExtentFunction · 0.90
centerMethod · 0.80
extentMethod · 0.45
areaMethod · 0.45

Tested by

no test coverage detected