void ScrollView::handleReleaseLogic(Touch *touch) { // Gather the last touch information when released { Vec2 touchPositionInNodeSpace = this->convertToNodeSpace(touch->getLocation()); Vec2 previousTouchPositionInNodeSpace = this->convertToNodeSpace(touch->getPreviousLocation()); Vec2 delta = touchPositionInNodeSpace - previousTouchPositionInNodeSpace; gatherTouchMove(delta); } _bePressed = false; bool bounceBackStarted = startBounceBackIfNeeded(); if(!bounceBackStarted && _inertiaScrollEnabled) { Vec2 touchMoveVelocity = calculateTouchMoveVelocity(); if(touchMoveVelocity != Vec2::ZERO) { startInertiaScroll(touchMoveVelocity); } } if(_verticalScrollBar != nullptr) { _verticalScrollBar->onTouchEnded(); } if(_horizontalScrollBar != nullptr) { _horizontalScrollBar->onTouchEnded(); } }
void ScrollView::handleReleaseLogic(Touch *touch) { // Gather the last touch information when released { Vec3 currPt, prevPt; if(calculateCurrAndPrevTouchPoints(touch, &currPt, &prevPt)) { Vec3 delta3 = currPt - prevPt; Vec2 delta(delta3.x, delta3.y); gatherTouchMove(delta); } } _bePressed = false; bool bounceBackStarted = startBounceBackIfNeeded(); if(!bounceBackStarted && _inertiaScrollEnabled) { Vec2 touchMoveVelocity = calculateTouchMoveVelocity(); if(touchMoveVelocity != Vec2::ZERO) { startInertiaScroll(touchMoveVelocity); } } if(_verticalScrollBar != nullptr) { _verticalScrollBar->onTouchEnded(); } if(_horizontalScrollBar != nullptr) { _horizontalScrollBar->onTouchEnded(); } }
void ScrollView::handleMoveLogic(Touch *touch) { Vec2 touchPositionInNodeSpace = this->convertToNodeSpace(touch->getLocation()); Vec2 previousTouchPositionInNodeSpace = this->convertToNodeSpace(touch->getPreviousLocation()); Vec2 delta = touchPositionInNodeSpace - previousTouchPositionInNodeSpace; scrollChildren(delta); // Gather touch move information for speed calculation gatherTouchMove(delta); }
void ScrollView::handleMoveLogic(Touch *touch) { Vec3 currPt, prevPt; if(!calculateCurrAndPrevTouchPoints(touch, &currPt, &prevPt)) { return; } Vec3 delta3 = currPt - prevPt; Vec2 delta(delta3.x, delta3.y); scrollChildren(delta); // Gather touch move information for speed calculation gatherTouchMove(delta); }