mirror of
https://github.com/nasa/openmct.git
synced 2025-06-01 15:10:50 +00:00
[Browse] Menu arrow works
The menu arrow now displays a context menu when clicked. #33.
This commit is contained in:
parent
c08f972ab4
commit
2524c75505
@ -36,30 +36,18 @@ define(
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function MenuArrowController($scope) {
|
function MenuArrowController($scope) {
|
||||||
var //domainObject = $scope.domainObject,
|
var stop;
|
||||||
context;
|
|
||||||
|
|
||||||
function showMenu(event) {
|
function showMenu(event) {
|
||||||
console.log('showMenu() called');
|
var actionContext = {key: 'menu', domainObject: $scope.domainObject, event: event};
|
||||||
|
stop = $scope.domainObject.getCapability('action').perform(actionContext);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
// attempt to set the domain object
|
|
||||||
$scope.$watch('domainObject', function (c) {
|
|
||||||
domainObject = c;
|
|
||||||
console.log('watcher called');
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
showMenu: showMenu
|
showMenu: showMenu,
|
||||||
|
destroy: function () {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ define(
|
|||||||
function ContextMenuAction($compile, $document, $window, $rootScope, actionContext) {
|
function ContextMenuAction($compile, $document, $window, $rootScope, actionContext) {
|
||||||
|
|
||||||
function perform() {
|
function perform() {
|
||||||
console.log('in perform()');
|
|
||||||
var winDim = [$window.innerWidth, $window.innerHeight],
|
var winDim = [$window.innerWidth, $window.innerHeight],
|
||||||
eventCoors = [actionContext.event.pageX, actionContext.event.pageY],
|
eventCoors = [actionContext.event.pageX, actionContext.event.pageY],
|
||||||
menuDim = GestureConstants.MCT_MENU_DIMENSIONS,
|
menuDim = GestureConstants.MCT_MENU_DIMENSIONS,
|
||||||
@ -95,7 +94,8 @@ define(
|
|||||||
body.append(menu);
|
body.append(menu);
|
||||||
|
|
||||||
// Dismiss the menu when body is clicked elsewhere
|
// 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
|
// Don't launch browser's context menu
|
||||||
actionContext.event.preventDefault();
|
actionContext.event.preventDefault();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user