protected double getKnobPercent ( ) { // If we have no range if ( maxValue <= minValue ) { return 0 ; } // Calculate the relative progress double percent = ( curValue - minValue ) / ( maxValue - minValue ) ; return Math . max ( 0.0 , Math . min ( 1.0 , percent ) ) ; }
Get the percentage of the knob s position relative to the size of the line . The return value will be between 0 . 0 and 1 . 0 .