Fix _hittedByCamera may be null in Widget::isClippingParentContainsPoint

Merged from https://github.com/cocos2d/cocos2d-x/pull/13884
This commit is contained in:
pandamicro 2015-09-17 16:31:17 +08:00
parent c870d1daf1
commit e74ac2377a
3 changed files with 6 additions and 4 deletions

View File

@ -767,8 +767,8 @@ bool Widget::onTouchBegan(Touch *touch, Event *unusedEvent)
auto camera = Camera::getVisitingCamera();
if(hitTest(_touchBeganPosition, camera, nullptr))
{
_hittedByCamera = camera;
if (isClippingParentContainsPoint(_touchBeganPosition)) {
_hittedByCamera = camera;
_hitted = true;
}
}
@ -971,7 +971,9 @@ bool Widget::isClippingParentContainsPoint(const Vec2 &pt)
if (clippingParent)
{
bool bRet = false;
if (clippingParent->hitTest(pt, _hittedByCamera, nullptr))
auto camera = Camera::getVisitingCamera();
// Camera isn't null means in touch begin process, otherwise use _hittedByCamera instead.
if (clippingParent->hitTest(pt, (camera ? camera : _hittedByCamera), nullptr))
{
bRet = true;
}

View File

@ -41,7 +41,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.8</string>
<string>3.8.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -64,7 +64,7 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "About Simulator"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CTEXT "Version 3.8 (20150227)",IDC_ABOUT_VERSION,35,70,173,17
CTEXT "Version 3.8.1 (20150917)",IDC_ABOUT_VERSION,35,70,173,17
CTEXT "Cocos Simulator",IDC_ABOUT_TITLE,35,49,173,17
CTEXT "Copyright (C) 2015. All rights reserved.",IDC_STATIC,35,94,173,17
ICON "GLFW_ICON",IDC_STATIC,111,15,20,20