Flash message if drag not allowed because of a hidden connection

(closes #4493)
This commit is contained in:
Bryan Housel
2017-12-06 00:11:42 -05:00
parent f247bd1e66
commit c6ab9e593d
3 changed files with 11 additions and 2 deletions
+2
View File
@@ -19,6 +19,8 @@ en:
tail: Click to add nodes to your area. Click the first node to finish the area.
draw_line:
tail: "Click to add more nodes to the line. Click on other lines to connect to them, and double-click to end the line."
drag_node:
connected_to_hidden: This can't be edited because it is connected to a hidden feature.
operations:
add:
annotation:
+3
View File
@@ -25,6 +25,9 @@
},
"draw_line": {
"tail": "Click to add more nodes to the line. Click on other lines to connect to them, and double-click to end the line."
},
"drag_node": {
"connected_to_hidden": "This can't be edited because it is connected to a hidden feature."
}
},
"operations": {
+6 -2
View File
@@ -28,6 +28,7 @@ import {
import { geoChooseEdge } from '../geo';
import { osmNode } from '../osm';
import { utilEntitySelector } from '../util';
import { uiFlash } from '../ui';
export function modeDragNode(context) {
@@ -106,11 +107,14 @@ export function modeDragNode(context) {
function start(entity) {
wasMidpoint = entity.type === 'midpoint';
var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
isCancelled = d3_event.sourceEvent.shiftKey || hasHidden;
isCancelled = d3_event.sourceEvent.shiftKey ||
context.features().hasHiddenConnections(entity, context.graph());
if (isCancelled) {
if (hasHidden) {
uiFlash().text(t('modes.drag_node.connected_to_hidden'))();
}
return behavior.cancel();
}