Merge pull request #13826 from zilongshanren/enableSliderBodyTouch

Enable tapping Slider bar to scroll
This commit is contained in:
子龙山人 2015-09-15 16:55:00 +08:00
commit 2157059fef
1 changed files with 5 additions and 1 deletions

View File

@ -431,7 +431,11 @@ bool Slider::hitTest(const cocos2d::Vec2 &pt, const Camera *camera, Vec3 *p) con
Rect rect;
rect.size = _slidBallNormalRenderer->getContentSize();
auto w2l = _slidBallNormalRenderer->getWorldToNodeTransform();
return isScreenPointInRect(pt, camera, w2l, rect, nullptr);
Rect sliderBarRect;
sliderBarRect.size = this->_barRenderer->getContentSize();
auto barW2l = this->_barRenderer->getWorldToNodeTransform();
return isScreenPointInRect(pt, camera, w2l, rect, nullptr) || isScreenPointInRect(pt, camera, barW2l, sliderBarRect, nullptr);
}
bool Slider::onTouchBegan(Touch *touch, Event *unusedEvent)