From 2539e4008f0cf3994045aa35b0dadd3d18b0e46d Mon Sep 17 00:00:00 2001 From: Andrew Henry Date: Wed, 28 Oct 2015 12:53:50 -0700 Subject: [PATCH] Improved handling of virtual panels --- platform/representation/src/gestures/DropGesture.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index 7a488b682e..918d5bf9a8 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -69,6 +69,13 @@ define( ); } } + + function shouldCreateVirtualPanel(domainObject){ + // + return domainObject.useCapability('view').filter(function (view){ + return view.key==='plot' && domainObject.getModel().type!== 'telemetry.panel' + }).length > 0; + } function dragOver(e) { //Refresh domain object on each dragOver to catch external @@ -89,7 +96,7 @@ define( })[0]; //TODO: Fix this. Define an action for creating new // virtual panel - if (action || selectedObject.getModel().type === 'generator') { + if (action || shouldCreateVirtualPanel(domainObject)) { event.dataTransfer.dropEffect = 'move'; // Indicate that we will accept the drag @@ -136,7 +143,7 @@ define( // destination domain object's composition, and persist // the change. if (id) { - if (domainObjectType === 'generator'){ + if (shouldCreateVirtualPanel(domainObject)){ virtualObj = new EditableDomainObject(createVirtualPanel(domainObject, id)); navigationService.setNavigation(virtualObj); broadcastDrop(id, event);