Add basic zoom-to-clicked-issue behavior

This commit is contained in:
Quincy Morgan
2019-01-23 15:25:55 -05:00
parent 4389bd8741
commit 7b288ef95d
3 changed files with 13 additions and 0 deletions

View File

@@ -101,6 +101,7 @@ export function uiEntityIssues(context) {
issue.select('.label')
.on('click', function() {
context.map().centerZoomEase(d.loc(), Math.max(context.map().zoom(), 18));
if (list.style('display') === 'none') {
list.style('display', 'block');
} else {

View File

@@ -130,6 +130,7 @@ export function uiIssues(context) {
.placement('bottom')
)
.on('click', function(d) {
context.map().centerZoomEase(d.loc(), Math.max(context.map().zoom(), 18));
if (d.entities) {
context.enter(modeSelect(
context,

View File

@@ -51,6 +51,17 @@ export function validationIssue(attrs) {
this.info = attrs.info; // an object containing arbitrary extra information
this.fixes = attrs.fixes; // expect an array of functions for possible fixes
this.loc = function() {
if (this.coordinates && Array.isArray(this.coordinates) && this.coordinates.length === 2) {
return this.coordinates;
}
if (this.entities.length > 0) {
if (this.entities[0].loc) {
return this.entities[0].loc;
}
}
};
if (this.fixes) {
for (var i=0; i<this.fixes.length; i++) {
// add a reference in the fix to the issue for use in fix actions