Added aspect ratio handling and resolution setup for canvas element