js/units.js
/**
 * Finds an existing scale given a label that has
 * metric units.
 **/
Finds an existing scale given a label that has
metric units.
Finds an existing scale given a label that has metric units .
function findLabelScale(label) {
	let startIndex = label.lastIndexOf("(");
	let endIndex = label.lastIndexOf(")");
	let scaleText = label.substring(startIndex+1,startIndex+2);
	if(endIndex < startIndex+3) return [1.0,scaleText]; 
	let unitsText = label.substring(startIndex+2,endIndex);
	for(let i = 0; i < SCALE_UNITS.length; i++) {
		if(scaleText == SCALE_UNITS[i][1])
			return [SCALE_UNITS[i][0], unitsText];
	}
	return [1.0,scaleText+unitsText]; 
}
function findLabelScale ( label ) { let startIndex = label . lastIndexOf ( "(" ) ; let endIndex = label . lastIndexOf ( ")" ) ; let scaleText = label . substring ( startIndex + 1 , startIndex + 2 ) ; if ( endIndex < startIndex + 3 ) return [ 1.0 , scaleText ] ; let unitsText = label . substring ( startIndex + 2 , endIndex ) ; for ( let i = 0 ; i < SCALE_UNITS . length ; i ++ ) { if ( scaleText == SCALE_UNITS [ i ] [ 1 ] ) return [ SCALE_UNITS [ i ] [ 0 ] , unitsText ] ; } return [ 1.0 , scaleText + unitsText ] ; }
Finds an existing scale given a label that has
 metric units.
Finds an existing scale given a label that has metric units .
//only 1 character //look for a matching scale text //time values (s) will end up here