Atomic observation of phase transition in layered SnS2 driven by in situ heating and electron beam irradiation