mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
18 lines
515 B
JavaScript
18 lines
515 B
JavaScript
import { geoRotate } from '../geo';
|
|
import { utilGetAllNodes } from '../util';
|
|
|
|
|
|
export function actionRotate(rotateIds, pivot, angle, projection) {
|
|
|
|
var action = function(graph) {
|
|
return graph.update(function(graph) {
|
|
utilGetAllNodes(rotateIds, graph).forEach(function(node) {
|
|
var point = geoRotate([projection(node.loc)], angle, pivot)[0];
|
|
graph = graph.replace(node.move(projection.invert(point)));
|
|
});
|
|
});
|
|
};
|
|
|
|
return action;
|
|
}
|