moved object position check (edge of canvas) to separate method