Fixed bug where removing too many dies would create "negative drafts" which doesn't make sense and was detrimental to the calculations
This commit is contained in:
parent
333372348c
commit
42961eb08e
32
analyser.js
32
analyser.js
@ -9,7 +9,7 @@ var dataElong = [];
|
||||
var dataAngle = [];
|
||||
var dataDelta = [];
|
||||
|
||||
///// START OF MATHS FUNCTIONS /////
|
||||
///// MATHS FUNCTIONS /////
|
||||
|
||||
// This function gets the reduction of area with two provided sizes, and returns it
|
||||
function getReduction(startSize, finalSize) {
|
||||
@ -45,7 +45,7 @@ function getRoDiameter(startSize, finishSize){
|
||||
|
||||
///// END OF MATHS SECTION /////
|
||||
|
||||
///// START OF DISPLAY SECTION /////
|
||||
///// DISPLAY SECTION /////
|
||||
|
||||
function addReduction() {
|
||||
numDies ++; // Increment our die count
|
||||
@ -72,23 +72,27 @@ function addReduction() {
|
||||
}
|
||||
|
||||
function removeReduction() { // function to remove the last row
|
||||
numDies --;
|
||||
document.getElementById("data").deleteRow(-1); // delete the last row in the table
|
||||
|
||||
// Remove the last item in each array to remove the tick from the graph
|
||||
dieCount.splice(-1);
|
||||
dataROA.splice(-1);
|
||||
dataElong.splice(-1);
|
||||
dataDelta.splice(-1);
|
||||
if (numDies > 1) {
|
||||
numDies--;
|
||||
document.getElementById("data").deleteRow(-1); // delete the last row in the table
|
||||
|
||||
if (outputVisible == 1) { // Check if out output is visible and update immediately when adding dies
|
||||
doMath();
|
||||
// Remove the last item in each array to remove the tick from the graph
|
||||
dieCount.splice(-1);
|
||||
dataROA.splice(-1);
|
||||
dataElong.splice(-1);
|
||||
dataDelta.splice(-1);
|
||||
|
||||
if (outputVisible == 1) { // Check if out output is visible and update immediately when adding dies
|
||||
doMath();
|
||||
}
|
||||
} else {
|
||||
numDies = 1;
|
||||
}
|
||||
}
|
||||
|
||||
///// END OF DISPLAY SECTION /////
|
||||
|
||||
///// START OF ALGORITHMS SECTION /////
|
||||
///// ALGORITHMS SECTION /////
|
||||
|
||||
function doMath() {
|
||||
outputVisible = 1; // set visible status to enabled
|
||||
@ -526,7 +530,7 @@ function clearScreen() {
|
||||
}
|
||||
|
||||
|
||||
///// END OF ALGORITHMS SECTION /////
|
||||
///// END ALGORITHMS SECTION /////
|
||||
|
||||
///// EXTRA SECTION /////
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user