A man from Swindon who broke into a family’s garden was caught masturbating with a bath mat.