calculate canvas position