mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-18 09:06:11 +00:00
Merge pull request #5468 from quincylvania/connect-annotation-undo-messages
Expanded undo messages for node-dragging scenarios
This commit is contained in:
@@ -118,10 +118,18 @@ en:
|
||||
annotation: Removed a member from a relation.
|
||||
connect:
|
||||
annotation:
|
||||
point: Connected a way to a point.
|
||||
vertex: Connected a way to another.
|
||||
line: Connected a way to a line.
|
||||
area: Connected a way to an area.
|
||||
from_vertex:
|
||||
to_point: Connected a way to a point.
|
||||
to_vertex: Connected a way to another.
|
||||
to_line: Connected a way to a line.
|
||||
to_area: Connected a way to an area.
|
||||
to_adjacent_vertex: Merged adjacent points in a way.
|
||||
to_sibling_vertex: Connected a way to itself.
|
||||
from_point:
|
||||
to_point: Merged a point with another.
|
||||
to_vertex: Merged a point with a point in a way.
|
||||
to_line: Moved a point to a line.
|
||||
to_area: Moved a point to an area.
|
||||
relation: These features can't be connected because they have conflicting relation roles.
|
||||
restriction: "These features can't be connected because it would damage a \"{relation}\" relation."
|
||||
disconnect:
|
||||
|
||||
18
dist/locales/en.json
vendored
18
dist/locales/en.json
vendored
@@ -154,10 +154,20 @@
|
||||
},
|
||||
"connect": {
|
||||
"annotation": {
|
||||
"point": "Connected a way to a point.",
|
||||
"vertex": "Connected a way to another.",
|
||||
"line": "Connected a way to a line.",
|
||||
"area": "Connected a way to an area."
|
||||
"from_vertex": {
|
||||
"to_point": "Connected a way to a point.",
|
||||
"to_vertex": "Connected a way to another.",
|
||||
"to_line": "Connected a way to a line.",
|
||||
"to_area": "Connected a way to an area.",
|
||||
"to_adjacent_vertex": "Merged adjacent points in a way.",
|
||||
"to_sibling_vertex": "Connected a way to itself."
|
||||
},
|
||||
"from_point": {
|
||||
"to_point": "Merged a point with another.",
|
||||
"to_vertex": "Merged a point with a point in a way.",
|
||||
"to_line": "Moved a point to a line.",
|
||||
"to_area": "Moved a point to an area."
|
||||
}
|
||||
},
|
||||
"relation": "These features can't be connected because they have conflicting relation roles.",
|
||||
"restriction": "These features can't be connected because it would damage a \"{relation}\" relation."
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import _find from 'lodash-es/find';
|
||||
import _intersection from 'lodash-es/intersection';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
@@ -75,8 +76,23 @@ export function modeDragNode(context) {
|
||||
}
|
||||
|
||||
|
||||
function connectAnnotation(entity) {
|
||||
return t('operations.connect.annotation.' + entity.geometry(context.graph()));
|
||||
function connectAnnotation(nodeEntity, targetEntity) {
|
||||
var nodeGeometry = nodeEntity.geometry(context.graph());
|
||||
var targetGeometry = targetEntity.geometry(context.graph());
|
||||
if (nodeGeometry === 'vertex' && targetGeometry === 'vertex') {
|
||||
var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
|
||||
var targetParentWayIDs = context.graph().parentWays(targetEntity);
|
||||
var sharedParentWays = _intersection(nodeParentWayIDs, targetParentWayIDs);
|
||||
// if both vertices are part of the same way
|
||||
if (sharedParentWays.length !== 0) {
|
||||
// if the nodes are next to each other, they are merged
|
||||
if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
|
||||
return t('operations.connect.annotation.from_vertex.to_adjacent_vertex');
|
||||
}
|
||||
return t('operations.connect.annotation.from_vertex.to_sibling_vertex');
|
||||
}
|
||||
}
|
||||
return t('operations.connect.annotation.from_' + nodeGeometry + '.to_' + targetGeometry);
|
||||
}
|
||||
|
||||
|
||||
@@ -359,13 +375,13 @@ export function modeDragNode(context) {
|
||||
loc: choice.loc,
|
||||
edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
|
||||
}, entity),
|
||||
connectAnnotation(target)
|
||||
connectAnnotation(entity, target)
|
||||
);
|
||||
|
||||
} else if (target && target.type === 'node') {
|
||||
context.replace(
|
||||
actionConnect([target.id, entity.id]),
|
||||
connectAnnotation(target)
|
||||
connectAnnotation(entity, target)
|
||||
);
|
||||
|
||||
} else if (_wasMidpoint) {
|
||||
|
||||
Reference in New Issue
Block a user