add boudary check and change preview position right