Dynamic adjust object size when window size has been changed