Allow to drag a node when a parent relation is selected

This commit is contained in:
popov
2017-01-27 10:08:13 +10:00
committed by Bryan Housel
parent df63b680e5
commit a2f9f51ee6
+11 -7
View File
@@ -79,12 +79,16 @@ export function modeDragNode(context) {
function start(entity) {
activeIDs = _.map(context.graph().parentWays(entity), 'id');
activeIDs.push(entity.id);
wasMidpoint = entity.type === 'midpoint';
wasMidpoint = entity.type === 'midpoint';
var editableIDs = [ entity.id ];
context.graph().parentWays(entity).forEach(function (parentWay) {
editableIDs.push(parentWay.id);
editableIDs.concat(_.map(context.graph().parentRelations(parentWay), 'id'));
});
isCancelled = d3.event.sourceEvent.shiftKey ||
!(wasMidpoint || _.some(activeIDs, function (activeID) { return selectedIDs.indexOf(activeID) !== -1; })) ||
!(wasMidpoint || _.some(editableIDs, function (editableID) { return selectedIDs.indexOf(editableID) !== -1; })) ||
context.features().hasHiddenConnections(entity, context.graph());
if (isCancelled) return behavior.cancel();
@@ -97,13 +101,13 @@ export function modeDragNode(context) {
var vertex = context.surface().selectAll('.' + entity.id);
behavior.target(vertex.node(), entity);
activeIDs = _.map(context.graph().parentWays(entity), 'id');
activeIDs.push(entity.id);
} else {
context.perform(actionNoop());
}
activeIDs = _.map(context.graph().parentWays(entity), 'id');
activeIDs.push(entity.id);
setActiveElements();
context.enter(mode);
}