Files
iD/modules/actions/move_node.js
2017-12-22 16:57:27 -05:00

19 lines
413 B
JavaScript

import { geoInterp } from '../geo';
export function actionMoveNode(nodeID, toLoc) {
var action = function(graph, t) {
if (t === null || !isFinite(t)) t = 1;
t = Math.min(Math.max(+t, 0), 1);
var node = graph.entity(nodeID);
return graph.replace(
node.move(geoInterp(node.loc, toLoc, t))
);
};
action.transitionable = true;
return action;
}