snap to min/max