[Browse] Splitting up Menu Gesture

Splitting up the context menu gesture's functionality into
separate context menu gesture and context menu actions.
The gesture watches for right-clicks, while the action
displays the menu. #33.
This commit is contained in:
Sarah Hale
2015-06-30 16:17:00 -07:00
parent 4840345524
commit 9ad1c25d53
6 changed files with 161 additions and 105 deletions

View File

@@ -36,7 +36,7 @@
{
"key": "MenuArrowController",
"implementation": "MenuArrowController",
"depends": [ "$rootScope", "$scope" ]
"depends": [ "$scope" ]
}
],
"controls": [

View File

@@ -22,5 +22,5 @@
<span ng-controller="MenuArrowController as menuArrow">
<a class='ui-symbol context-available'
ng-click='menuArrow.contextMenu()'>v</a>
ng-click='menuArrow.showMenu($event)'>v</a>
</span>

View File

@@ -35,20 +35,22 @@ define(
* menu.
* @constructor
*/
function MenuArrowController($rootScope, $scope) {
function MenuArrowController($scope) {
function contextMenu() {
function showMenu(event) {
console.log('contextMenu() called');
//console.log('editor? ', $scope.domainObject.hasCapability('editor'));
/*
if (true || $scope.domainObject.hasCapability('editor')) {
//$rootScope.$broadcast('contextmenu');
$scope.$emit('contextmenu');
$scope.$emit('contextmenu', event);
}
*/
$scope.domainObject.getCapability('action').perform({key: 'contextMenu', event: event});
}
return {
contextMenu: contextMenu
showMenu: showMenu
};
}