[Browse] Some progress

Still doesn't work.
This commit is contained in:
Sarah Hale
2015-07-01 14:32:49 -07:00
parent 9ad1c25d53
commit e9989ae00d
6 changed files with 95 additions and 75 deletions

View File

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

View File

@ -25,9 +25,6 @@
<span ng-if="parameters.mode" class='action'>{{parameters.mode}}</span> <span ng-if="parameters.mode" class='action'>{{parameters.mode}}</span>
<span class='type-name'>{{type.getName()}}</span> <span class='type-name'>{{type.getName()}}</span>
<span class='title-label'>{{model.name}}</span> <span class='title-label'>{{model.name}}</span>
<!--a id='actions-menu'
class='ui-symbol context-available'
ng-click='ObjectHeaderController.contextMenu()'>v</a-->
<mct-representation key="'menu-arrow'"></mct-representation> <mct-representation key="'menu-arrow'"></mct-representation>
</span> </span>
</div> </div>

View File

@ -22,23 +22,26 @@
/*global define*/ /*global define*/
/** /**
* Module defining ObjectHeaderController. Created by shale on 06/30/2015. * Module defining MenuArrowController. Created by shale on 06/30/2015.
*/ */
define( define(
[], [],
function () { function () {
"use strict"; "use strict";
var ROOT_ID = "ROOT",
DEFAULT_PATH = "mine";
/** /**
* A left-click on the menu arrow should display a * A left-click on the menu arrow should display a
* context menu. This controller launches the context * context menu. This controller launches the context
* menu. * menu.
* @constructor * @constructor
*/ */
function MenuArrowController($scope) { function MenuArrowController($scope, $route, domainObject) {
function showMenu(event) { function showMenu(event) {
console.log('contextMenu() called'); console.log('showMenu() called');
//console.log('editor? ', $scope.domainObject.hasCapability('editor')); //console.log('editor? ', $scope.domainObject.hasCapability('editor'));
/* /*
if (true || $scope.domainObject.hasCapability('editor')) { if (true || $scope.domainObject.hasCapability('editor')) {
@ -46,7 +49,12 @@ define(
} }
*/ */
$scope.domainObject.getCapability('action').perform({key: 'contextMenu', event: event}); //console.log('domainObject ', domainObject);
//console.log('$scope.domainObject ', $scope.domainObject);
console.log('event ', event);
//$scope.domainObject.getCapability('action').perform({key: 'contextMenu', event: event});
domainObject.getCapability('action').perform({key: 'contextMenu', event: event});
} }
return { return {

View File

@ -26,7 +26,7 @@
{ {
"key": "menu", "key": "menu",
"implementation": "gestures/ContextMenuGesture.js", "implementation": "gestures/ContextMenuGesture.js",
"depends": [ "$compile", "$document", "$window", "$rootScope" ] "depends": []
} }
], ],
"components": [ "components": [

View File

@ -50,10 +50,12 @@ define(
* @param {DomainObject} domainObject the object on which actions * @param {DomainObject} domainObject the object on which actions
* in the context menu will be performed * in the context menu will be performed
*/ */
function ContextMenuAction($compile, $document, $window, $rootScope, element, domainObject) { function ContextMenuAction($compile, $document, $window, $rootScope, element, domainObject, event) {
var turnOffMenu; //var turnOffMenu;
console.log('in ContextMenuAction');
console.log('contextMenuAction event ', event);
function showMenu(event) { //function showMenu(event) {
var winDim = [$window.innerWidth, $window.innerHeight], var winDim = [$window.innerWidth, $window.innerHeight],
eventCoors = [event.pageX, event.pageY], eventCoors = [event.pageX, event.pageY],
menuDim = GestureConstants.MCT_MENU_DIMENSIONS, menuDim = GestureConstants.MCT_MENU_DIMENSIONS,
@ -63,8 +65,6 @@ define(
goUp = eventCoors[1] + menuDim[1] > winDim[1], goUp = eventCoors[1] + menuDim[1] > winDim[1],
menu; menu;
console.log('in showMenu() in ContextMenuAction');
// Remove the context menu // Remove the context menu
function dismiss() { function dismiss() {
menu.remove(); menu.remove();
@ -108,24 +108,19 @@ define(
// Don't launch browser's context menu // Don't launch browser's context menu
event.preventDefault(); event.preventDefault();
} //}
return { return {
/** /**
* Detach any event handlers associated with this gesture, * Dismiss any visible menu.
* and dismiss any visible menu.
* @method * @method
* @memberof ContextMenuGesture * @memberof ContextMenuAction
*/ */
destroy: function () { destroy: function () {
// Scope has been destroyed, so remove all listeners. // Scope has been destroyed, so remove all listeners.
if (dismissExistingMenu) { if (dismissExistingMenu) {
dismissExistingMenu(); dismissExistingMenu();
} }
element.off('contextmenu', showMenu);
if (turnOffMenu) {
turnOffMenu();
}
} }
}; };
} }

View File

@ -40,11 +40,31 @@ define(
* in the context menu will be performed * in the context menu will be performed
*/ */
function ContextMenuGesture(element, domainObject) { function ContextMenuGesture(element, domainObject) {
var actionContext,
stop;
// When context menu event occurs, show object actions instead // When context menu event occurs, show object actions instead
element.on('contextmenu', function () { element.on('contextmenu', function (event) {
domainObject.getCapability('action').perform({key: "contextMenu", event: $event}); console.log('in ContextMenuGesture');
console.log('domainObject ', domainObject);
console.log('domainObject action', domainObject.getCapability('action'));
console.log('domainObject actions', domainObject.getCapability('action').getActions('contextMenu'));
actionContext = {key: 'contextMenu', /*element: element,*/ domainObject: domainObject, event: event};
stop = domainObject.getCapability('action').perform(actionContext);
}); });
return {
/**
* Detach any event handlers associated with this gesture.
* @method
* @memberof ContextMenuGesture
*/
destroy: function () {
//element.off('contextmenu', stop.destroy);
}
};
} }
return ContextMenuGesture; return ContextMenuGesture;