Make Reflect/Rotate unavailable for strictly linear features

This commit is contained in:
Bryan Housel
2016-12-22 15:16:08 -05:00
parent 37534aed0e
commit 9a922c0731
2 changed files with 14 additions and 4 deletions
+7 -2
View File
@@ -31,8 +31,13 @@ export function operationReflect(selectedIDs, context, axis) {
operation.available = function() {
return selectedIDs.length > 1 ||
context.entity(selectedIDs[0]).type !== 'node';
return _.some(selectedIDs, hasArea);
function hasArea(id) {
var entity = context.entity(id);
return (entity.type === 'way' && entity.isClosed()) ||
(entity.type ==='relation' && entity.isMultipolygon());
}
};
+7 -2
View File
@@ -18,8 +18,13 @@ export function operationRotate(selectedIDs, context) {
operation.available = function() {
return selectedIDs.length > 1 ||
context.entity(selectedIDs[0]).type !== 'node';
return _.some(selectedIDs, hasArea);
function hasArea(id) {
var entity = context.entity(id);
return (entity.type === 'way' && entity.isClosed()) ||
(entity.type ==='relation' && entity.isMultipolygon());
}
};