automatic resizing on window resize (trying to improve how it looks like on visualizing.org)