mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-07 03:41:33 +00:00
Add basic zoom-to-clicked-issue behavior
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user