scaleX is wantedX / currentX
scaleY is wantedY / currentY
If you don't care about the size ratio of your sprite, just setScale(scaleX, scaleY)
If you want it to keep the same ratio, use the minimum scale for x and y, setScale(min(scaleX, scaleY), min(scaleX, scaleY))