diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index bcd49713fe..00faa83710 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -20,6 +20,19 @@ define( */ function DropGesture($q, element, domainObject) { + function broadcastDrop(id, event) { + // Find the relevant scope... + var scope = element && element.scope && element.scope(); + if (scope && scope.$broadcast) { + // ...and broadcast the event. This allows specific + // views to have post-drop behavior which depends on + // drop position. + scope.$broadcast( + GestureConstants.MCT_DROP_EVENT, + { id: id, dropEvent: event } + ); + } + } function doPersist() { var persistence = domainObject.getCapability("persistence"); @@ -60,6 +73,11 @@ define( } } )).then(function (result) { + // Broadcast the drop event if it was successful + if (result) { + broadcastDrop(id, event); + } + // If mutation was successful, persist the change return result && doPersist(); }); diff --git a/platform/representation/src/gestures/GestureConstants.js b/platform/representation/src/gestures/GestureConstants.js index ae35fa439f..126a7b3981 100644 --- a/platform/representation/src/gestures/GestureConstants.js +++ b/platform/representation/src/gestures/GestureConstants.js @@ -14,5 +14,9 @@ define({ * An estimate for the dimensions of a context menu, used for * positioning. */ - MCT_MENU_DIMENSIONS: [ 170, 200 ] + MCT_MENU_DIMENSIONS: [ 170, 200 ], + /** + * Identifier for drop events. + */ + MCT_DROP_EVENT: 'mctDrop' }); \ No newline at end of file