bound to resize event
made centering functional