mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 06:43:24 +00:00
Linting fixes
This commit is contained in:
@@ -38,7 +38,7 @@ angular.module('app', ['ui.router', 'ct.ui.router.extras.sticky', 'ui.sortable',
|
||||
|
||||
$rootScope.cName = function (c) {
|
||||
return c.c? c.c.name? c.c.name : GroupMap[c.c.grp] : null;
|
||||
}
|
||||
};
|
||||
|
||||
// Formatters
|
||||
$rootScope.fCrd = d3.format(',.0f');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('app').controller('OutfitController', ['$window','$rootScope','$scope', '$state', '$stateParams', 'ShipsDB', 'Ship', 'Components', 'Serializer', 'Persist', 'lodash', function ($window, $rootScope, $scope, $state, $p, Ships, Ship, Components, Serializer, Persist, _) {
|
||||
angular.module('app').controller('OutfitController', ['$window','$rootScope','$scope', '$state', '$stateParams', 'ShipsDB', 'Ship', 'Components', 'Serializer', 'Persist', function ($window, $rootScope, $scope, $state, $p, Ships, Ship, Components, Serializer, Persist) {
|
||||
var data = Ships[$p.shipId]; // Retrieve the basic ship properties, slots and defaults
|
||||
var ship = new Ship($p.shipId, data.properties, data.slots); // Create a new Ship instance
|
||||
var win = angular.element($window); // Angularized window object for event triggering
|
||||
|
||||
@@ -6,15 +6,14 @@ angular.module('app').directive('powerBands', ['$window', function ($window) {
|
||||
available: '='
|
||||
},
|
||||
link: function(scope, element) {
|
||||
var color = d3.scale.ordinal().range([ '#7b6888', '#6b486b', '#3182bd', '#a05d56', '#d0743c']),
|
||||
margin = {top: 20, right: 130, bottom: 20, left: 40},
|
||||
var margin = {top: 20, right: 130, bottom: 20, left: 40},
|
||||
barHeight = 20,
|
||||
innerHeight = (barHeight * 2) + 3,
|
||||
height = innerHeight + margin.top + margin.bottom + 1,
|
||||
wattScale = d3.scale.linear(),
|
||||
pctScale = d3.scale.linear().domain([0, 1]),
|
||||
wattFmt = d3.format('.2f');
|
||||
pctFmt = d3.format('.1%');
|
||||
wattFmt = d3.format('.2f'),
|
||||
pctFmt = d3.format('.1%'),
|
||||
wattAxis = d3.svg.axis().scale(wattScale).outerTickSize(0).orient('top').tickFormat(d3.format('.2r')),
|
||||
pctAxis = d3.svg.axis().scale(pctScale).outerTickSize(0).orient('bottom').tickFormat(d3.format('%')),
|
||||
// Create chart
|
||||
@@ -29,8 +28,8 @@ angular.module('app').directive('powerBands', ['$window', function ($window) {
|
||||
vis.append("text").attr('x', -35).attr('y', 15).attr('class','primary').text('RET');
|
||||
vis.append("text").attr('x', -35).attr('y', barHeight + 17).attr('class','primary').text('DEP');
|
||||
|
||||
var retLbl = vis.append("text").attr('y', 15)
|
||||
var depLbl = vis.append("text").attr('y', barHeight + 17).attr('class','primary');
|
||||
var retLbl = vis.append("text").attr('y', 15);
|
||||
var depLbl = vis.append("text").attr('y', barHeight + 17);
|
||||
|
||||
// Watch for changes to data and events
|
||||
scope.$watchCollection('available', render);
|
||||
@@ -41,7 +40,7 @@ angular.module('app').directive('powerBands', ['$window', function ($window) {
|
||||
available = scope.available,
|
||||
width = element[0].offsetWidth,
|
||||
w = width - margin.left - margin.right,
|
||||
maxBand = bands[bands.length - 1];
|
||||
maxBand = bands[bands.length - 1],
|
||||
maxPwr = Math.max(available, maxBand.deployedSum);
|
||||
|
||||
// Update chart size
|
||||
@@ -81,7 +80,7 @@ angular.module('app').directive('powerBands', ['$window', function ($window) {
|
||||
.attr('y', 15)
|
||||
.style('text-anchor', 'middle')
|
||||
.attr('class','primary-bg')
|
||||
.text(function(d,i) { return bandText(d.retracted, i, available); });
|
||||
.text(function(d,i) { return bandText(d.retracted, i); });
|
||||
|
||||
deployed.selectAll("rect").data(bands).enter().append("rect")
|
||||
.attr("height", barHeight)
|
||||
@@ -95,11 +94,11 @@ angular.module('app').directive('powerBands', ['$window', function ($window) {
|
||||
.attr('y', barHeight + 17)
|
||||
.style('text-anchor', 'middle')
|
||||
.attr('class','primary-bg')
|
||||
.text(function(d,i) { return bandText(d.deployed + d.retracted, i, available); });
|
||||
.text(function(d,i) { return bandText(d.deployed + d.retracted, i); });
|
||||
|
||||
}
|
||||
|
||||
function bandText(val, index, available) {
|
||||
function bandText(val, index) {
|
||||
if (val > 0) {
|
||||
if( wattScale(val) > 100) {
|
||||
return (index + 1) + ' (' + wattFmt(val) + ' MW)';
|
||||
|
||||
@@ -184,14 +184,14 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Ship.prototype.setCostIncluded = function (item, included) {
|
||||
if (item.incCost != included && item.c) {
|
||||
this.totalCost += included? item.c.cost : -item.c.cost;
|
||||
}
|
||||
item.incCost = included;
|
||||
}
|
||||
};
|
||||
|
||||
Ship.prototype.setSlotEnabled = function (slot, enabled) {
|
||||
if (slot.enabled != enabled && slot.c) { // Enabled state is changing
|
||||
@@ -200,7 +200,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
this.updatePower();
|
||||
}
|
||||
slot.enabled = enabled;
|
||||
}
|
||||
};
|
||||
|
||||
Ship.prototype.getSlotStatus = function (slot, deployed) {
|
||||
if(!slot.c) { // Empty Slot
|
||||
@@ -216,7 +216,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
return 0; // No Status (Not possible)
|
||||
}
|
||||
return this.priorityBands[slot.priority].retractedSum > this.powerAvailable? 2 : 3; // Offline : Online
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the ship's cumulative and aggregated stats based on the component change.
|
||||
|
||||
Reference in New Issue
Block a user