mirror of
https://github.com/nasa/openmct.git
synced 2025-01-31 16:36:13 +00:00
[Browse] Context menu gesture called
The context menu gesture is called when the user clicks the arrow next to the title of a domain object. This does not yet display the context menu. It also does not yet distinguish between edit and browse mode. #33.
This commit is contained in:
parent
397a545482
commit
57eefd7316
@ -60,7 +60,7 @@
|
||||
{
|
||||
"key": "TreeNodeController",
|
||||
"implementation": "controllers/TreeNodeController.js",
|
||||
"depends": [ "$scope", "$timeout" ]
|
||||
"depends": [ "$scope", "$timeout", "$rootScope" ]
|
||||
},
|
||||
{
|
||||
"key": "ActionGroupController",
|
||||
|
@ -27,7 +27,7 @@
|
||||
>
|
||||
<span
|
||||
class='ui-symbol view-control'
|
||||
ng-click="toggle.toggle(); treeNode.trackExpansion()"
|
||||
ng-click="toggle.toggle(); treeNode.trackExpansion() ; treeNode.contextMenu()"
|
||||
ng-if="model.composition !== undefined"
|
||||
>
|
||||
{{toggle.isActive() ? "v" : ">"}}
|
||||
|
@ -50,7 +50,7 @@ define(
|
||||
* expand-to-show-navigated-object behavior.)
|
||||
* @constructor
|
||||
*/
|
||||
function TreeNodeController($scope, $timeout) {
|
||||
function TreeNodeController($scope, $timeout, $rootScope) {
|
||||
var selectedObject = ($scope.ngModel || {}).selectedObject,
|
||||
isSelected = false,
|
||||
hasBeenExpanded = false;
|
||||
@ -138,6 +138,20 @@ define(
|
||||
selectedObject = object;
|
||||
checkSelection();
|
||||
}
|
||||
|
||||
// If we are in edit mode, then a left-click on the
|
||||
// down arrow next to a domain object's title should display
|
||||
// a context menu
|
||||
function contextMenu() {
|
||||
//console.log('contextMenu() called');
|
||||
|
||||
if ($scope.domainObject.hasCapability('editor') || true) {
|
||||
//console.log('contextMenu() believes in edit mode');
|
||||
|
||||
$rootScope.$broadcast('leftContextual');
|
||||
console.log('contextMenu() broadcasted from root');
|
||||
}
|
||||
}
|
||||
|
||||
// Listen for changes which will effect display parameters
|
||||
$scope.$watch("ngModel.selectedObject", setSelection);
|
||||
@ -166,7 +180,13 @@ define(
|
||||
*/
|
||||
isSelected: function () {
|
||||
return isSelected;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* This method should be called when the down arrow next
|
||||
* to a domain object's title is (left) clicked. If in edit
|
||||
* mode, this activates a context menu.
|
||||
*/
|
||||
contextMenu: contextMenu
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,10 @@ define(
|
||||
goLeft = eventCoors[0] + menuDim[0] > winDim[0],
|
||||
goUp = eventCoors[1] + menuDim[1] > winDim[1],
|
||||
menu;
|
||||
|
||||
|
||||
//console.log('in showMenu() in ContextMenuGesture');
|
||||
//console.log('domainObject is ', domainObject);
|
||||
|
||||
// Remove the context menu
|
||||
function dismiss() {
|
||||
menu.remove();
|
||||
@ -104,6 +107,7 @@ define(
|
||||
|
||||
// When context menu event occurs, show object actions instead
|
||||
element.on('contextmenu', showMenu);
|
||||
$rootScope.$on('leftContextual', showMenu);
|
||||
|
||||
return {
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user