| 427 | } |
| 428 | |
| 429 | void ScrollView::deaccelerateScrolling(float /*dt*/) |
| 430 | { |
| 431 | if (_dragging) |
| 432 | { |
| 433 | this->unschedule(AX_SCHEDULE_SELECTOR(ScrollView::deaccelerateScrolling)); |
| 434 | return; |
| 435 | } |
| 436 | |
| 437 | float newX, newY; |
| 438 | Vec2 maxInset, minInset; |
| 439 | |
| 440 | _container->setPosition(_container->getPosition() + _scrollDistance); |
| 441 | |
| 442 | if (_bounceable) |
| 443 | { |
| 444 | maxInset = _maxInset; |
| 445 | minInset = _minInset; |
| 446 | } |
| 447 | else |
| 448 | { |
| 449 | maxInset = this->maxContainerOffset(); |
| 450 | minInset = this->minContainerOffset(); |
| 451 | } |
| 452 | |
| 453 | newX = _container->getPosition().x; |
| 454 | newY = _container->getPosition().y; |
| 455 | |
| 456 | _scrollDistance = _scrollDistance * SCROLL_DEACCEL_RATE; |
| 457 | this->setContentOffset(Vec2(newX, newY)); |
| 458 | |
| 459 | if ((fabsf(_scrollDistance.x) <= SCROLL_DEACCEL_DIST && fabsf(_scrollDistance.y) <= SCROLL_DEACCEL_DIST) || |
| 460 | ((_direction == Direction::BOTH || _direction == Direction::VERTICAL) && |
| 461 | (newY >= maxInset.y || newY <= minInset.y)) || |
| 462 | ((_direction == Direction::BOTH || _direction == Direction::HORIZONTAL) && |
| 463 | (newX >= maxInset.x || newX <= minInset.x))) |
| 464 | { |
| 465 | this->unschedule(AX_SCHEDULE_SELECTOR(ScrollView::deaccelerateScrolling)); |
| 466 | this->relocateContainer(true); |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | void ScrollView::stoppedAnimatedScroll(Node* /*node*/) |
| 471 | { |
nothing calls this directly
no test coverage detected