Do not attach dragNode behavior in browse mode

This commit is contained in:
popov
2017-01-10 10:41:58 +10:00
parent e56feb160f
commit 42a6530796
2 changed files with 6 additions and 7 deletions
+1 -4
View File
@@ -7,8 +7,6 @@ import {
behaviorSelect
} from '../behavior/index';
import { modeDragNode } from './index';
export function modeBrowse(context) {
var mode = {
@@ -22,8 +20,7 @@ export function modeBrowse(context) {
behaviorPaste(context),
behaviorHover(context).on('hover', context.ui().sidebar.hover),
behaviorSelect(context),
behaviorLasso(context),
modeDragNode(context).behavior
behaviorLasso(context)
];
+5 -3
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';
isCancelled = d3.event.sourceEvent.shiftKey ||
!(wasMidpoint || _.some(activeIDs, function (activeID) { return selectedIDs.indexOf(activeID) !== -1; })) ||
context.features().hasHiddenConnections(entity, context.graph());
if (isCancelled) return behavior.cancel();
wasMidpoint = entity.type === 'midpoint';
if (wasMidpoint) {
var midpoint = entity;
entity = osmNode();
@@ -97,8 +101,6 @@ export function modeDragNode(context) {
context.perform(actionNoop());
}
activeIDs = _.map(context.graph().parentWays(entity), 'id');
activeIDs.push(entity.id);
context.enter(mode);
}