recompute aspect ratio in javascript. Still hard coded the target ratio