mirror of https://github.com/axmolengine/axmol.git
Merge pull request #13826 from zilongshanren/enableSliderBodyTouch
Enable tapping Slider bar to scroll
This commit is contained in:
commit
2157059fef
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue