Code cleanups, changes to replaceMovedVertex in moveAction

Trying to eliminate the minimum 10m distance for replacing the original
junction vertex - this is a small threshold.  When _not_ replacing this
vertex, the unzorro code will wreck havok on a traffic circle.
(If there is no suitable vertex to use, it will snap to a point between
the nearest vertices, see #4146)
This commit is contained in:
Bryan Housel
2018-01-28 23:56:03 -05:00
parent 4e9f1bbc4f
commit 9b200cf514
3 changed files with 91 additions and 70 deletions
+3 -12
View File
@@ -8,12 +8,8 @@ import { t } from '../util/locale';
import { actionMove } from '../actions';
import { behaviorEdit } from '../behavior';
import { geoViewportEdge } from '../geo';
import {
modeBrowse,
modeSelect
} from './index';
import { geoViewportEdge, geoVecSubtract } from '../geo';
import { modeBrowse, modeSelect } from './index';
import {
operationCircularize,
@@ -51,11 +47,6 @@ export function modeMove(context, entityIDs, baseGraph) {
var _nudgeInterval;
function vecSub(a, b) {
return [a[0] - b[0], a[1] - b[1]];
}
function doMove(nudge) {
nudge = nudge || [0, 0];
@@ -70,7 +61,7 @@ export function modeMove(context, entityIDs, baseGraph) {
var currMouse = context.mouse();
var origMouse = context.projection(_origin);
var delta = vecSub(vecSub(currMouse, origMouse), nudge);
var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
fn(actionMove(entityIDs, delta, context.projection, _cache), annotation);
_prevGraph = context.graph();