fixed calculation of canvas position