i would like to know if it is possible to know on which side of the slider the thumb is moving. I have to implement a zoom function based on a slider and i can zoom in, but not zoom out.
if (!zoomSlider.getValueIsAdjusting()) {
double minY = model.getMinY();
double maxY = model.getMaxY();
double distanceY = maxY - minY;
double posY = minY + distanceY / 2.0;
if(?) {
distanceY /= zoomSlider.getValue();
} else {
distanceY *= zoomSlider.getValue();
}
minY = posY - distanceY / 2.0;
maxY = posY + distanceY / 2.0;
changeMaxY(maxY);
changeMinY(minY);
}
Thank you.
Keep track of the “previous” slider value so you can compare it to the “current” slider value. When the value increases your multiply, when it decreases you divide.