Slider slider = (Slider)TerraSliderSkin.this.getComponent();
if (slider.getOrientation() == Orientation.HORIZONTAL) {
int sliderWidth = slider.getWidth();
int thumbWidth = thumb.getWidth();
Point sliderLocation = thumb.mapPointToAncestor(slider, x, y);
int sliderX = sliderLocation.x;
int minX = dragOffset.x;
if (sliderX < minX) {
sliderX = minX;
}
int maxX = (sliderWidth - thumbWidth) + dragOffset.x;
if (sliderX > maxX) {
sliderX = maxX;
}
float ratio = (float)(sliderX - dragOffset.x) / (sliderWidth - thumbWidth);
int start = slider.getStart();
int end = slider.getEnd();
int value = (int)(start + (end - start) * ratio);
slider.setValue(value);
} else {
int sliderHeight = slider.getHeight();
int thumbHeight = thumb.getHeight();
Point sliderLocation = thumb.mapPointToAncestor(slider, x, y);
int sliderY = sliderLocation.y;
int minY = dragOffset.y;
if (sliderY < minY) {
sliderY = minY;