From 2524c75505f9e1521b5e6911dac728b089f67e21 Mon Sep 17 00:00:00 2001 From: Sarah Hale Date: Thu, 2 Jul 2015 12:36:35 -0700 Subject: [PATCH] [Browse] Menu arrow works The menu arrow now displays a context menu when clicked. #33. --- .../browse/src/MenuArrowController.js | 26 +++++-------------- .../src/actions/ContextMenuAction.js | 4 +-- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/platform/commonUI/browse/src/MenuArrowController.js b/platform/commonUI/browse/src/MenuArrowController.js index 818af4fc49..309280f5fe 100644 --- a/platform/commonUI/browse/src/MenuArrowController.js +++ b/platform/commonUI/browse/src/MenuArrowController.js @@ -36,30 +36,18 @@ define( * @constructor */ function MenuArrowController($scope) { - var //domainObject = $scope.domainObject, - context; + var stop; function showMenu(event) { - console.log('showMenu() called'); - - console.log('$scope ', $scope); - console.log('$scope.domainObject ', $scope.domainObject); - //console.log('domainObject ', domainObject); - console.log('event ', event); - - context = {key: 'menu', event: event, domainObject: $scope.domainObject}; - $scope.domainObject.getCapability('action').perform(context); + var actionContext = {key: 'menu', domainObject: $scope.domainObject, event: event}; + stop = $scope.domainObject.getCapability('action').perform(actionContext); } - /* - // attempt to set the domain object - $scope.$watch('domainObject', function (c) { - domainObject = c; - console.log('watcher called'); - }); - */ return { - showMenu: showMenu + showMenu: showMenu, + destroy: function () { + stop(); + } }; } diff --git a/platform/representation/src/actions/ContextMenuAction.js b/platform/representation/src/actions/ContextMenuAction.js index 4881349952..ff31b9f088 100644 --- a/platform/representation/src/actions/ContextMenuAction.js +++ b/platform/representation/src/actions/ContextMenuAction.js @@ -50,7 +50,6 @@ define( function ContextMenuAction($compile, $document, $window, $rootScope, actionContext) { function perform() { - console.log('in perform()'); var winDim = [$window.innerWidth, $window.innerHeight], eventCoors = [actionContext.event.pageX, actionContext.event.pageY], menuDim = GestureConstants.MCT_MENU_DIMENSIONS, @@ -95,7 +94,8 @@ define( body.append(menu); // Dismiss the menu when body is clicked elsewhere - body.on('click', dismiss); + // ('mousedown' because 'click' breaks left-click context menus) + body.on('mousedown', dismiss); // Don't launch browser's context menu actionContext.event.preventDefault();