fixed the js so that scaling to the smaller canvas worked better