Calculate the UI position by windows size