From 9a922c0731999232bb8e587b0331d8040916024f Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Thu, 22 Dec 2016 15:16:08 -0500 Subject: [PATCH] Make Reflect/Rotate unavailable for strictly linear features --- modules/operations/reflect.js | 9 +++++++-- modules/operations/rotate.js | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/operations/reflect.js b/modules/operations/reflect.js index 413d8226e..9a3ffad97 100644 --- a/modules/operations/reflect.js +++ b/modules/operations/reflect.js @@ -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()); + } }; diff --git a/modules/operations/rotate.js b/modules/operations/rotate.js index 78e42a9a8..aa7359f09 100644 --- a/modules/operations/rotate.js +++ b/modules/operations/rotate.js @@ -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()); + } };