[Browse] Right click works
Right clicking for a context menu now works again. #33.
This commit is contained in:
@@ -37,26 +37,20 @@ define(
|
||||
dismissExistingMenu;
|
||||
|
||||
/**
|
||||
* Add listeners to a representation such that it launches a
|
||||
* custom context menu for the domain object it contains.
|
||||
* Launches a custom context menu for the domain object it contains.
|
||||
*
|
||||
* @constructor
|
||||
* @param $compile Angular's $compile service
|
||||
* @param $document the current document
|
||||
* @param $window the active window
|
||||
* @param $rootScope Angular's root scope
|
||||
* @param element the jqLite-wrapped element which should exhibit
|
||||
* the context mennu
|
||||
* @param {DomainObject} domainObject the object on which actions
|
||||
* in the context menu will be performed
|
||||
* @param actionContexr the context in which the action
|
||||
* should be performed
|
||||
*/
|
||||
function ContextMenuAction($compile, $document, $window, $rootScope, actionContext) {
|
||||
//var turnOffMenu;
|
||||
|
||||
console.log('in ContextMenuAction');
|
||||
console.log('contextMenuAction event ', event);
|
||||
|
||||
//function showMenu(event) {
|
||||
function perform() {
|
||||
//console.log('in perform()');
|
||||
var winDim = [$window.innerWidth, $window.innerHeight],
|
||||
eventCoors = [actionContext.event.pageX, actionContext.event.pageY],
|
||||
menuDim = GestureConstants.MCT_MENU_DIMENSIONS,
|
||||
@@ -82,7 +76,7 @@ define(
|
||||
dismissExistingMenu = dismiss;
|
||||
|
||||
// Set up the scope, including menu positioning
|
||||
scope.domainObject = domainObject;
|
||||
scope.domainObject = actionContext.domainObject;
|
||||
scope.menuStyle = {};
|
||||
scope.menuStyle[goLeft ? "right" : "left"] =
|
||||
(goLeft ? (winDim[0] - eventCoors[0]) : eventCoors[0]) + 'px';
|
||||
@@ -94,13 +88,9 @@ define(
|
||||
"context-menu-holder": true
|
||||
};
|
||||
|
||||
console.log("ContextMenuAction scope ", scope);
|
||||
|
||||
// Create the context menu
|
||||
menu = $compile(MENU_TEMPLATE)(scope);
|
||||
|
||||
console.log("ContextMenuAction menu ", menu);
|
||||
|
||||
// Add the menu to the body
|
||||
body.append(menu);
|
||||
|
||||
@@ -109,7 +99,7 @@ define(
|
||||
|
||||
// Don't launch browser's context menu
|
||||
actionContext.event.preventDefault();
|
||||
//}
|
||||
}
|
||||
|
||||
return {
|
||||
/**
|
||||
@@ -122,7 +112,8 @@ define(
|
||||
if (dismissExistingMenu) {
|
||||
dismissExistingMenu();
|
||||
}
|
||||
}
|
||||
},
|
||||
perform: perform
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ define(
|
||||
console.log('event ', event);
|
||||
console.log('domainObject ', domainObject);
|
||||
console.log('domainObject action', domainObject.getCapability('action'));
|
||||
console.log('domainObject actions', domainObject.getCapability('action').getActions('contextMenu'));
|
||||
console.log('domainObject actions', domainObject.getCapability('action').getActions('menu'));
|
||||
|
||||
actionContext = {key: 'menu', domainObject: domainObject, event: event};
|
||||
stop = domainObject.getCapability('action').perform(actionContext);
|
||||
|
||||
Reference in New Issue
Block a user