From bde045d30cf7b6511ee1cbba5534697eea71e375 Mon Sep 17 00:00:00 2001 From: tyr Date: Fri, 10 Jan 2014 23:38:29 +0100 Subject: [PATCH] allow the rotate operation also for closed multipolygon members closes #1718 --- js/id/operations/rotate.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/js/id/operations/rotate.js b/js/id/operations/rotate.js index f654ebbe9..e762a8875 100644 --- a/js/id/operations/rotate.js +++ b/js/id/operations/rotate.js @@ -6,9 +6,18 @@ iD.operations.Rotate = function(selectedIDs, context) { }; operation.available = function() { - return selectedIDs.length === 1 && - context.entity(entityId).type === 'way' && - context.geometry(entityId) === 'area'; + var graph = context.graph(), + entity = graph.entity(entityId); + + if (selectedIDs.length !== 1 || + entity.type !== 'way') + return false; + if (context.geometry(entityId) === 'area') + return true; + if (entity.isClosed() && + graph.parentRelations(entity).some(function(r) { return r.isMultipolygon(); })) + return true; + return false; }; operation.disabled = function() {