* 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)
| 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 | /** |
no test coverage detected