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
30
analyser.js
30
analyser.js
@ -9,7 +9,7 @@ var dataElong = [];
|
|||||||
var dataAngle = [];
|
var dataAngle = [];
|
||||||
var dataDelta = [];
|
var dataDelta = [];
|
||||||
|
|
||||||
///// START OF MATHS FUNCTIONS /////
|
///// MATHS FUNCTIONS /////
|
||||||
|
|
||||||
// This function gets the reduction of area with two provided sizes, and returns it
|
// This function gets the reduction of area with two provided sizes, and returns it
|
||||||
function getReduction(startSize, finalSize) {
|
function getReduction(startSize, finalSize) {
|
||||||
@ -45,7 +45,7 @@ function getRoDiameter(startSize, finishSize){
|
|||||||
|
|
||||||
///// END OF MATHS SECTION /////
|
///// END OF MATHS SECTION /////
|
||||||
|
|
||||||
///// START OF DISPLAY SECTION /////
|
///// DISPLAY SECTION /////
|
||||||
|
|
||||||
function addReduction() {
|
function addReduction() {
|
||||||
numDies ++; // Increment our die count
|
numDies ++; // Increment our die count
|
||||||
@ -72,23 +72,27 @@ function addReduction() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeReduction() { // function to remove the last row
|
function removeReduction() { // function to remove the last row
|
||||||
numDies --;
|
if (numDies > 1) {
|
||||||
document.getElementById("data").deleteRow(-1); // delete the last row in the table
|
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
|
// Remove the last item in each array to remove the tick from the graph
|
||||||
dieCount.splice(-1);
|
dieCount.splice(-1);
|
||||||
dataROA.splice(-1);
|
dataROA.splice(-1);
|
||||||
dataElong.splice(-1);
|
dataElong.splice(-1);
|
||||||
dataDelta.splice(-1);
|
dataDelta.splice(-1);
|
||||||
|
|
||||||
if (outputVisible == 1) { // Check if out output is visible and update immediately when adding dies
|
if (outputVisible == 1) { // Check if out output is visible and update immediately when adding dies
|
||||||
doMath();
|
doMath();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
numDies = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///// END OF DISPLAY SECTION /////
|
///// END OF DISPLAY SECTION /////
|
||||||
|
|
||||||
///// START OF ALGORITHMS SECTION /////
|
///// ALGORITHMS SECTION /////
|
||||||
|
|
||||||
function doMath() {
|
function doMath() {
|
||||||
outputVisible = 1; // set visible status to enabled
|
outputVisible = 1; // set visible status to enabled
|
||||||
@ -526,7 +530,7 @@ function clearScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///// END OF ALGORITHMS SECTION /////
|
///// END ALGORITHMS SECTION /////
|
||||||
|
|
||||||
///// EXTRA SECTION /////
|
///// EXTRA SECTION /////
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user