private double validateY ( double y ) { SliderArea sliderArea = zoomSlider . getSliderArea ( ) ; y -= zoomSlider . getVerticalMargin ( ) + sliderArea . getVerticalMargin ( ) + 5 ; double startY = 0 ; double endY = sliderArea . getHeight ( ) - zoomSlider . getSliderUnit ( ) . getBounds ( ) . getHeight ( ) ; if ( y > endY ) { y = endY ; } else if ( y < startY ) { y = startY ; } return y ; }
Checks if the given y is within the slider area s range . If not the initial y is corrected to either the top y or bottom y .