[Browse] Fixed multiple clicks

Fixed having multiple calls to ContextMenuGesture. .
This commit is contained in:
Sarah Hale 2015-07-02 10:54:43 -07:00
parent 3edd967e27
commit b965c48ff2
3 changed files with 7 additions and 16 deletions
platform
commonUI/browse/src
representation/src

@ -29,9 +29,6 @@ define(
function () { function () {
"use strict"; "use strict";
var ROOT_ID = "ROOT",
DEFAULT_PATH = "mine";
/** /**
* A left-click on the menu arrow should display a * A left-click on the menu arrow should display a
* context menu. This controller launches the context * context menu. This controller launches the context
@ -43,14 +40,12 @@ define(
context; context;
function showMenu(event) { function showMenu(event) {
/*
console.log('showMenu() called'); console.log('showMenu() called');
console.log('$scope ', $scope); console.log('$scope ', $scope);
console.log('$scope.domainObject ', $scope.domainObject); console.log('$scope.domainObject ', $scope.domainObject);
console.log('domainObject ', domainObject); console.log('domainObject ', domainObject);
console.log('event ', event); console.log('event ', event);
*/
context = {key: 'menu', event: event, domainObject: domainObject}; context = {key: 'menu', event: event, domainObject: domainObject};
domainObject.getCapability('action').perform(context); domainObject.getCapability('action').perform(context);
@ -59,7 +54,7 @@ define(
// attempt to set the domain object // attempt to set the domain object
$scope.$watch('domainObject', function (c) { $scope.$watch('domainObject', function (c) {
domainObject = c; domainObject = c;
//console.log('watcher called'); console.log('watcher called');
}); });
return { return {

@ -50,17 +50,15 @@ define(
* @param {DomainObject} domainObject the object on which actions * @param {DomainObject} domainObject the object on which actions
* in the context menu will be performed * in the context menu will be performed
*/ */
function ContextMenuAction($compile, $document, $window, $rootScope, element, domainObject, event) { function ContextMenuAction($compile, $document, $window, $rootScope, actionContext) {
//var turnOffMenu; //var turnOffMenu;
/*
console.log('in ContextMenuAction'); console.log('in ContextMenuAction');
console.log('contextMenuAction event ', event); console.log('contextMenuAction event ', event);
*/
//function showMenu(event) { //function showMenu(event) {
var winDim = [$window.innerWidth, $window.innerHeight], var winDim = [$window.innerWidth, $window.innerHeight],
eventCoors = [event.pageX, event.pageY], eventCoors = [actionContext.event.pageX, actionContext.event.pageY],
menuDim = GestureConstants.MCT_MENU_DIMENSIONS, menuDim = GestureConstants.MCT_MENU_DIMENSIONS,
body = $document.find('body'), body = $document.find('body'),
scope = $rootScope.$new(), scope = $rootScope.$new(),
@ -96,12 +94,12 @@ define(
"context-menu-holder": true "context-menu-holder": true
}; };
//console.log("ContextMenuAction scope ", scope); console.log("ContextMenuAction scope ", scope);
// Create the context menu // Create the context menu
menu = $compile(MENU_TEMPLATE)(scope); menu = $compile(MENU_TEMPLATE)(scope);
//console.log("ContextMenuAction menu ", menu); console.log("ContextMenuAction menu ", menu);
// Add the menu to the body // Add the menu to the body
body.append(menu); body.append(menu);
@ -110,7 +108,7 @@ define(
body.on('click', dismiss); body.on('click', dismiss);
// Don't launch browser's context menu // Don't launch browser's context menu
event.preventDefault(); actionContext.event.preventDefault();
//} //}
return { return {

@ -45,13 +45,11 @@ define(
// When context menu event occurs, show object actions instead // When context menu event occurs, show object actions instead
element.on('contextmenu', function (event) { element.on('contextmenu', function (event) {
/*
console.log('in ContextMenuGesture'); console.log('in ContextMenuGesture');
console.log('event ', event); console.log('event ', event);
console.log('domainObject ', domainObject); console.log('domainObject ', domainObject);
console.log('domainObject action', domainObject.getCapability('action')); console.log('domainObject action', domainObject.getCapability('action'));
console.log('domainObject actions', domainObject.getCapability('action').getActions('contextMenu')); console.log('domainObject actions', domainObject.getCapability('action').getActions('contextMenu'));
*/
actionContext = {key: 'contextMenu', domainObject: domainObject, event: event}; actionContext = {key: 'contextMenu', domainObject: domainObject, event: event};
stop = domainObject.getCapability('action').perform(actionContext); stop = domainObject.getCapability('action').perform(actionContext);
@ -64,7 +62,7 @@ define(
* @memberof ContextMenuGesture * @memberof ContextMenuGesture
*/ */
destroy: function () { destroy: function () {
//element.off('contextmenu', stop.destroy); element.off('contextmenu', stop);
} }
}; };
} }