mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
19 lines
419 B
JavaScript
19 lines
419 B
JavaScript
import { geoVecInterp } 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(geoVecInterp(node.loc, toLoc, t))
|
|
);
|
|
};
|
|
|
|
action.transitionable = true;
|
|
|
|
return action;
|
|
}
|