mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-10 07:05:35 +00:00
Linting fixes
This commit is contained in:
@@ -84,7 +84,6 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
|||||||
* @param {[type]} e The event object
|
* @param {[type]} e The event object
|
||||||
*/
|
*/
|
||||||
$scope.select = function(type, slot, e, id) {
|
$scope.select = function(type, slot, e, id) {
|
||||||
console.log('SELECT:', arguments);
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
id = id || angular.element(e.target).attr('cpid'); // Get component ID
|
id = id || angular.element(e.target).attr('cpid'); // Get component ID
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
angular.module('app').directive('contextMenu', ['$parse', function($parse) {
|
angular.module('app').directive('contextMenu', ['$parse', function($parse) {
|
||||||
return function(scope, element, attrs) {
|
return function(scope, element, attrs) {
|
||||||
var fn = $parse(attrs.contextMenu);
|
var fn = $parse(attrs.contextMenu);
|
||||||
console.log(attrs.contextMenu, fn);
|
|
||||||
element.bind('contextmenu', function(e) {
|
element.bind('contextmenu', function(e) {
|
||||||
scope.$apply(function() {
|
scope.$apply(function() {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
fn(scope, { $event:e });
|
fn(scope, { $event: e });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ angular.module('app').directive('powerBands', ['$window', function($window) {
|
|||||||
// Create chart
|
// Create chart
|
||||||
svg = d3.select(element[0]).append('svg'),
|
svg = d3.select(element[0]).append('svg'),
|
||||||
vis = svg.append('g').attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'),
|
vis = svg.append('g').attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'),
|
||||||
deployed = vis.append('g').attr('class','power-band'),
|
deployed = vis.append('g').attr('class', 'power-band'),
|
||||||
retracted = vis.append('g').attr('class','power-band');
|
retracted = vis.append('g').attr('class', 'power-band');
|
||||||
|
|
||||||
svg.on('contextmenu', function() {
|
svg.on('contextmenu', function() {
|
||||||
d3.event.preventDefault();
|
d3.event.preventDefault();
|
||||||
@@ -55,7 +55,7 @@ angular.module('app').directive('powerBands', ['$window', function($window) {
|
|||||||
deployedSum = 0,
|
deployedSum = 0,
|
||||||
retractedSum = 0,
|
retractedSum = 0,
|
||||||
retBandsSelected = false,
|
retBandsSelected = false,
|
||||||
depBandsSelected = false;
|
depBandsSelected = false,
|
||||||
maxPwr = Math.max(available, maxBand.retractedSum, maxBand.deployedSum);
|
maxPwr = Math.max(available, maxBand.retractedSum, maxBand.deployedSum);
|
||||||
|
|
||||||
// Update chart size
|
// Update chart size
|
||||||
@@ -73,27 +73,26 @@ angular.module('app').directive('powerBands', ['$window', function($window) {
|
|||||||
vis.selectAll('.watt.axis').call(wattAxis);
|
vis.selectAll('.watt.axis').call(wattAxis);
|
||||||
vis.selectAll('.pct.axis').attr('transform', 'translate(0,' + innerHeight + ')').call(pctAxis);
|
vis.selectAll('.pct.axis').attr('transform', 'translate(0,' + innerHeight + ')').call(pctAxis);
|
||||||
|
|
||||||
for (var i = 0, l = bands.length; i < l; i++) {
|
for (var b = 0, l = bands.length; b < l; b++) {
|
||||||
if (bands[i].retSelected) {
|
if (bands[b].retSelected) {
|
||||||
console.log(bands[i]);
|
retractedSum += bands[b].retracted;
|
||||||
retractedSum += bands[i].retracted;
|
|
||||||
retBandsSelected = true;
|
retBandsSelected = true;
|
||||||
}
|
}
|
||||||
if (bands[i].depSelected) {
|
if (bands[b].depSelected) {
|
||||||
deployedSum += bands[i].deployed + bands[i].retracted;
|
deployedSum += bands[b].deployed + bands[b].retracted;
|
||||||
depBandsSelected = true;
|
depBandsSelected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLabel(retLbl, w, retBandsSelected, retBandsSelected ? retractedSum : maxBand.retractedSum, available);
|
updateLabel(retLbl, w, retBandsSelected, retBandsSelected ? retractedSum : maxBand.retractedSum, available);
|
||||||
updateLabel(depLbl, w, depBandsSelected, depBandsSelected ? deployedSum : maxBand.deployedSum, available);
|
updateLabel(depLbl, w, depBandsSelected, depBandsSelected ? deployedSum : maxBand.deployedSum, available);
|
||||||
|
|
||||||
retracted.selectAll('rect').data(bands).enter().append('rect')
|
retracted.selectAll('rect').data(bands).enter().append('rect')
|
||||||
.attr('height', barHeight)
|
.attr('height', barHeight)
|
||||||
.attr('width', function(d) { return Math.max(wattScale(d.retracted) - 1, 0); })
|
.attr('width', function(d) { return Math.max(wattScale(d.retracted) - 1, 0); })
|
||||||
.attr('x', function(d) { return wattScale(d.retractedSum) - wattScale(d.retracted); })
|
.attr('x', function(d) { return wattScale(d.retractedSum) - wattScale(d.retracted); })
|
||||||
.attr('y', 1)
|
.attr('y', 1)
|
||||||
.on('click', function(d,i) {
|
.on('click', function(d) {
|
||||||
d.retSelected = !d.retSelected;
|
d.retSelected = !d.retSelected;
|
||||||
render();
|
render();
|
||||||
})
|
})
|
||||||
@@ -104,7 +103,7 @@ angular.module('app').directive('powerBands', ['$window', function($window) {
|
|||||||
.attr('y', 15)
|
.attr('y', 15)
|
||||||
.style('text-anchor', 'middle')
|
.style('text-anchor', 'middle')
|
||||||
.attr('class', 'primary-bg')
|
.attr('class', 'primary-bg')
|
||||||
.on('click', function(d,i) {
|
.on('click', function(d) {
|
||||||
d.retSelected = !d.retSelected;
|
d.retSelected = !d.retSelected;
|
||||||
render();
|
render();
|
||||||
})
|
})
|
||||||
@@ -115,18 +114,18 @@ angular.module('app').directive('powerBands', ['$window', function($window) {
|
|||||||
.attr('width', function(d) { return Math.max(wattScale(d.deployed + d.retracted) - 1, 0); })
|
.attr('width', function(d) { return Math.max(wattScale(d.deployed + d.retracted) - 1, 0); })
|
||||||
.attr('x', function(d) { return wattScale(d.deployedSum) - wattScale(d.retracted) - wattScale(d.deployed); })
|
.attr('x', function(d) { return wattScale(d.deployedSum) - wattScale(d.retracted) - wattScale(d.deployed); })
|
||||||
.attr('y', barHeight + 2)
|
.attr('y', barHeight + 2)
|
||||||
.on('click', function(d,i) {
|
.on('click', function(d) {
|
||||||
d.depSelected = !d.depSelected;
|
d.depSelected = !d.depSelected;
|
||||||
render();
|
render();
|
||||||
})
|
})
|
||||||
.attr('class', function(d) { return getClass(d.depSelected, d.deployedSum, available) });
|
.attr('class', function(d) { return getClass(d.depSelected, d.deployedSum, available); });
|
||||||
|
|
||||||
deployed.selectAll('text').data(bands).enter().append('text')
|
deployed.selectAll('text').data(bands).enter().append('text')
|
||||||
.attr('x', function(d) { return wattScale(d.deployedSum) - ((wattScale(d.retracted) + wattScale(d.deployed)) / 2); })
|
.attr('x', function(d) { return wattScale(d.deployedSum) - ((wattScale(d.retracted) + wattScale(d.deployed)) / 2); })
|
||||||
.attr('y', barHeight + 17)
|
.attr('y', barHeight + 17)
|
||||||
.style('text-anchor', 'middle')
|
.style('text-anchor', 'middle')
|
||||||
.attr('class', 'primary-bg')
|
.attr('class', 'primary-bg')
|
||||||
.on('click', function(d,i) {
|
.on('click', function(d) {
|
||||||
d.depSelected = !d.depSelected;
|
d.depSelected = !d.depSelected;
|
||||||
render();
|
render();
|
||||||
})
|
})
|
||||||
@@ -142,7 +141,7 @@ angular.module('app').directive('powerBands', ['$window', function($window) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getClass(selected, sum, available) {
|
function getClass(selected, sum, available) {
|
||||||
return selected? 'secondary' : (sum > available) ? 'warning' : 'primary';
|
return selected ? 'secondary' : (sum > available) ? 'warning' : 'primary';
|
||||||
}
|
}
|
||||||
|
|
||||||
function bandText(val, index) {
|
function bandText(val, index) {
|
||||||
|
|||||||
Reference in New Issue
Block a user