mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-21 11:16:36 +02:00
Don't zoom to the end vertex when continuing a disconnected highway if it is already visible
Add separate fixes for continuing a disconnected highway from the start and end vertices Highlight the vertex that will be continued
This commit is contained in:
+5
-3
@@ -1249,8 +1249,10 @@ en:
|
||||
connect_almost_junction:
|
||||
title: Connect the features
|
||||
undo_redo: Connected very close features.
|
||||
continue_feature:
|
||||
title: Continue this feature
|
||||
continue_from_start:
|
||||
title: Continue drawing from start
|
||||
continue_from_end:
|
||||
title: Continue drawing from end
|
||||
delete_feature:
|
||||
title: Delete this feature
|
||||
connect_endpoints:
|
||||
@@ -1642,4 +1644,4 @@ en:
|
||||
wikidata:
|
||||
identifier: "Identifier"
|
||||
label: "Label"
|
||||
description: "Description"
|
||||
description: "Description"
|
||||
|
||||
Vendored
+5
-2
@@ -1532,8 +1532,11 @@
|
||||
"title": "Connect the features",
|
||||
"undo_redo": "Connected very close features."
|
||||
},
|
||||
"continue_feature": {
|
||||
"title": "Continue this feature"
|
||||
"continue_from_start": {
|
||||
"title": "Continue drawing from start"
|
||||
},
|
||||
"continue_from_end": {
|
||||
"title": "Continue drawing from end"
|
||||
},
|
||||
"delete_feature": {
|
||||
"title": "Delete this feature"
|
||||
|
||||
@@ -229,6 +229,9 @@ export function validationIssueFix(attrs) {
|
||||
this.title = attrs.title;
|
||||
this.onClick = attrs.onClick;
|
||||
|
||||
// IDs of fix-specific entities. Used for hover-higlighting.
|
||||
this.entityIds = attrs.entityIds || [];
|
||||
|
||||
// the issue this fix is for
|
||||
this.issue = null;
|
||||
}
|
||||
|
||||
@@ -147,6 +147,16 @@ export function uiEntityIssues(context) {
|
||||
})
|
||||
.on('click', function(d) {
|
||||
d.onClick();
|
||||
})
|
||||
.on('mouseover.highlight', function(d) {
|
||||
d.entityIds.forEach(function(entityId) {
|
||||
utilHighlightEntity(entityId, true, context);
|
||||
});
|
||||
})
|
||||
.on('mouseout.highlight', function(d) {
|
||||
d.entityIds.forEach(function(entityId) {
|
||||
utilHighlightEntity(entityId, false, context);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -45,28 +45,22 @@ export function validationDisconnectedWay() {
|
||||
entities: [entity],
|
||||
fixes: [
|
||||
new validationIssueFix({
|
||||
title: t('issues.fix.continue_feature.title'),
|
||||
title: t('issues.fix.continue_from_start.title'),
|
||||
onClick: function() {
|
||||
var way = this.issue.entities[0];
|
||||
var childNodes = context.graph().childNodes(way);
|
||||
var endNodes = [childNodes[0], childNodes[childNodes.length-1]];
|
||||
var exclusiveEndNodes = endNodes.filter(function(vertex) {
|
||||
return graph.parentWays(vertex).length === 1;
|
||||
});
|
||||
var vertex;
|
||||
if (exclusiveEndNodes.length === 1) {
|
||||
// prefer an endpoint with no connecting ways
|
||||
vertex = exclusiveEndNodes[0];
|
||||
} else {
|
||||
// prefer the terminating node
|
||||
vertex = endNodes[1];
|
||||
}
|
||||
// make sure the vertex is actually visible
|
||||
context.map().zoomToEase(vertex);
|
||||
context.enter(
|
||||
modeDrawLine(context, way.id, context.graph(), way.affix(vertex.id), true)
|
||||
);
|
||||
}
|
||||
var vertex = context.entity(way.nodes[0]);
|
||||
continueDrawing(way, vertex, context);
|
||||
},
|
||||
entityIds: [entity.nodes[0]]
|
||||
}),
|
||||
new validationIssueFix({
|
||||
title: t('issues.fix.continue_from_end.title'),
|
||||
onClick: function() {
|
||||
var way = this.issue.entities[0];
|
||||
var vertex = context.entity(way.nodes[way.nodes.length-1]);
|
||||
continueDrawing(way, vertex, context);
|
||||
},
|
||||
entityIds: [entity.nodes[entity.nodes.length-1]]
|
||||
}),
|
||||
new validationIssueFix({
|
||||
title: t('issues.fix.delete_feature.title'),
|
||||
@@ -82,6 +76,19 @@ export function validationDisconnectedWay() {
|
||||
return issues;
|
||||
};
|
||||
|
||||
function continueDrawing(way, vertex, context) {
|
||||
|
||||
if (!context.map().editable() ||
|
||||
!context.map().extent().contains(vertex.loc)) {
|
||||
// make sure the vertex is actually visible and editable
|
||||
context.map().zoomToEase(vertex);
|
||||
}
|
||||
|
||||
context.enter(
|
||||
modeDrawLine(context, way.id, context.graph(), way.affix(vertex.id), true)
|
||||
);
|
||||
}
|
||||
|
||||
validation.type = type;
|
||||
|
||||
return validation;
|
||||
|
||||
Reference in New Issue
Block a user