Files
iD/modules/actions/rotate.js
Bryan Housel 37534aed0e More cleanup of operations and post-paste behavior
* Support move, rotate, reflect, delete post paste on multiselection
* Improve text and error msgs for singular vs multi selections
* Move `disabled` checks from actions to operations
* Reproject center of rotation (closes #3667)
* Cleanup tests
2016-12-21 23:58:13 -05:00

17 lines
514 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;
}