mirror of
https://github.com/nasa/openmct.git
synced 2025-05-09 12:03:21 +00:00
[Browse] Gesture calling action
The context menu gesture (attempts) to call the context menu action. The menu arrow still fails to call. #33.
This commit is contained in:
parent
e9989ae00d
commit
bb80b2175c
@ -36,7 +36,7 @@
|
|||||||
{
|
{
|
||||||
"key": "MenuArrowController",
|
"key": "MenuArrowController",
|
||||||
"implementation": "MenuArrowController",
|
"implementation": "MenuArrowController",
|
||||||
"depends": [ "$scope", "$route", "objectService" ]
|
"depends": [ "$scope" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"controls": [
|
"controls": [
|
||||||
|
@ -38,25 +38,30 @@ define(
|
|||||||
* menu.
|
* menu.
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function MenuArrowController($scope, $route, domainObject) {
|
function MenuArrowController($scope) {
|
||||||
|
var domainObject = $scope.domainObject,
|
||||||
|
context;
|
||||||
|
|
||||||
function showMenu(event) {
|
function showMenu(event) {
|
||||||
console.log('showMenu() called');
|
|
||||||
//console.log('editor? ', $scope.domainObject.hasCapability('editor'));
|
|
||||||
/*
|
/*
|
||||||
if (true || $scope.domainObject.hasCapability('editor')) {
|
console.log('showMenu() called');
|
||||||
$scope.$emit('contextmenu', event);
|
|
||||||
}
|
console.log('$scope ', $scope);
|
||||||
|
console.log('$scope.domainObject ', $scope.domainObject);
|
||||||
|
console.log('domainObject ', domainObject);
|
||||||
|
console.log('event ', event);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//console.log('domainObject ', domainObject);
|
context = {key: 'contextMenu', event: event, domainObject: domainObject};
|
||||||
//console.log('$scope.domainObject ', $scope.domainObject);
|
domainObject.getCapability('action').perform(context);
|
||||||
console.log('event ', event);
|
|
||||||
|
|
||||||
//$scope.domainObject.getCapability('action').perform({key: 'contextMenu', event: event});
|
|
||||||
domainObject.getCapability('action').perform({key: 'contextMenu', event: event});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// attempt to set the domain object
|
||||||
|
$scope.$watch('domainObject', function (c) {
|
||||||
|
domainObject = c;
|
||||||
|
console.log('watcher called');
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
showMenu: showMenu
|
showMenu: showMenu
|
||||||
};
|
};
|
||||||
|
@ -52,8 +52,11 @@ define(
|
|||||||
*/
|
*/
|
||||||
function ContextMenuAction($compile, $document, $window, $rootScope, element, domainObject, event) {
|
function ContextMenuAction($compile, $document, $window, $rootScope, element, domainObject, event) {
|
||||||
//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],
|
||||||
@ -93,12 +96,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);
|
||||||
|
@ -45,13 +45,15 @@ 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('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', /*element: element,*/ domainObject: domainObject, event: event};
|
|
||||||
stop = domainObject.getCapability('action').perform(actionContext);
|
stop = domainObject.getCapability('action').perform(actionContext);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user