diff --git a/platform/commonUI/general/bundle.json b/platform/commonUI/general/bundle.json index 2093a988cd..e5da0b81ef 100644 --- a/platform/commonUI/general/bundle.json +++ b/platform/commonUI/general/bundle.json @@ -60,7 +60,7 @@ { "key": "TreeNodeController", "implementation": "controllers/TreeNodeController.js", - "depends": [ "$scope", "$timeout" ] + "depends": [ "$scope", "$timeout", "$rootScope" ] }, { "key": "ActionGroupController", diff --git a/platform/commonUI/general/res/templates/tree-node.html b/platform/commonUI/general/res/templates/tree-node.html index f584befb1a..e61cd405cd 100644 --- a/platform/commonUI/general/res/templates/tree-node.html +++ b/platform/commonUI/general/res/templates/tree-node.html @@ -27,7 +27,7 @@ > <span class='ui-symbol view-control' - ng-click="toggle.toggle(); treeNode.trackExpansion()" + ng-click="toggle.toggle(); treeNode.trackExpansion() ; treeNode.contextMenu()" ng-if="model.composition !== undefined" > {{toggle.isActive() ? "v" : ">"}} diff --git a/platform/commonUI/general/src/controllers/TreeNodeController.js b/platform/commonUI/general/src/controllers/TreeNodeController.js index cfb70357bb..a51d85448e 100644 --- a/platform/commonUI/general/src/controllers/TreeNodeController.js +++ b/platform/commonUI/general/src/controllers/TreeNodeController.js @@ -50,7 +50,7 @@ define( * expand-to-show-navigated-object behavior.) * @constructor */ - function TreeNodeController($scope, $timeout) { + function TreeNodeController($scope, $timeout, $rootScope) { var selectedObject = ($scope.ngModel || {}).selectedObject, isSelected = false, hasBeenExpanded = false; @@ -138,6 +138,20 @@ define( selectedObject = object; checkSelection(); } + + // If we are in edit mode, then a left-click on the + // down arrow next to a domain object's title should display + // a context menu + function contextMenu() { + //console.log('contextMenu() called'); + + if ($scope.domainObject.hasCapability('editor') || true) { + //console.log('contextMenu() believes in edit mode'); + + $rootScope.$broadcast('leftContextual'); + console.log('contextMenu() broadcasted from root'); + } + } // Listen for changes which will effect display parameters $scope.$watch("ngModel.selectedObject", setSelection); @@ -166,7 +180,13 @@ define( */ isSelected: function () { return isSelected; - } + }, + /** + * This method should be called when the down arrow next + * to a domain object's title is (left) clicked. If in edit + * mode, this activates a context menu. + */ + contextMenu: contextMenu }; } diff --git a/platform/representation/src/gestures/ContextMenuGesture.js b/platform/representation/src/gestures/ContextMenuGesture.js index 83ea1ddc23..28e0f1ad30 100644 --- a/platform/representation/src/gestures/ContextMenuGesture.js +++ b/platform/representation/src/gestures/ContextMenuGesture.js @@ -60,7 +60,10 @@ define( goLeft = eventCoors[0] + menuDim[0] > winDim[0], goUp = eventCoors[1] + menuDim[1] > winDim[1], menu; - + + //console.log('in showMenu() in ContextMenuGesture'); + //console.log('domainObject is ', domainObject); + // Remove the context menu function dismiss() { menu.remove(); @@ -104,6 +107,7 @@ define( // When context menu event occurs, show object actions instead element.on('contextmenu', showMenu); + $rootScope.$on('leftContextual', showMenu); return { /**