Right-click to clear slots feature

This commit is contained in:
Colin McLeod
2015-06-14 17:26:04 -07:00
parent 1a14674352
commit 8b0f58cb69
3 changed files with 18 additions and 5 deletions

View File

@@ -83,9 +83,10 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
* @param {[type]} slot The slot object belonging to the ship instance
* @param {[type]} e The event object
*/
$scope.select = function(type, slot, e) {
$scope.select = function(type, slot, e, id) {
console.log('SELECT:', arguments);
e.stopPropagation();
var id = angular.element(e.target).attr('cpid'); // Get component ID
id = id || angular.element(e.target).attr('cpid'); // Get component ID
if (id) {
if (id == 'empty') {

View File

@@ -0,0 +1,12 @@
angular.module('app').directive('contextMenu', ['$parse', function($parse) {
return function(scope, element, attrs) {
var fn = $parse(attrs.contextMenu);
console.log(attrs.contextMenu, fn);
element.bind('contextmenu', function(e) {
scope.$apply(function() {
e.preventDefault();
fn(scope, { $event:e });
});
});
};
}]);