private void drawKnob ( ) { // Abort if not attached if ( ! isAttached ( ) ) { return ; } // Move the knob to the correct position Element knobElement = knobImage . getElement ( ) ; int lineWidth = lineElement . getOffsetWidth ( ) ; int knobWidth = knobElement . getOffsetWidth ( ) ; int knobLeftOffset = ( int ) ( lineLeftOffset + ( getKnobPercent ( ) * lineWidth ) - ( knobWidth / 2 ) ) ; knobLeftOffset = Math . min ( knobLeftOffset , lineLeftOffset + lineWidth - ( knobWidth / 2 ) - 1 ) ; DOM . setStyleAttribute ( knobElement , "left" , knobLeftOffset + "px" ) ; }
Draw the knob where it is supposed to be relative to the line .