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

Method focusIssue

modules/core/ValidationSystem.js:335–355  ·  view source on GitHub ↗

* focusIssue * Adjusts the map to focus on the given issue. * (requires the issue to have a reasonable extent defined) * @param {ValidationIssue} The Issue to focus on

(issue)

Source from the content-addressed store, hash-verified

333 * @param {ValidationIssue} The Issue to focus on
334 */
335 focusIssue(issue) {
336 const context = this.context;
337 const map = context.systems.map;
338
339 const entityIDs = issue.entityIds ?? [];
340 const selectID = entityIDs[0];
341 if (!selectID) return; // no entities? shouldn't happen.
342
343 // Try to adjust the map view
344 if (issue.loc) {
345 map.centerZoomEase(issue.loc, 19);
346 } else if (entityIDs.length) {
347 map.fitEntitiesEase(entityIDs);
348 }
349
350 // Select the first entity in the issue.
351 window.setTimeout(() => {
352 context.enter('select-osm', { selection: { osm: [selectID] }} );
353 this.emit('focusedIssue', issue);
354 }, 250); // after ease
355 }
356
357
358 /**

Callers 2

commitWarningsFunction · 0.80
drawIssuesListFunction · 0.80

Calls 3

centerZoomEaseMethod · 0.80
fitEntitiesEaseMethod · 0.80
enterMethod · 0.45

Tested by

no test coverage detected