From e74ac2377a27f394d3559347248b5b909994299a Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 17 Sep 2015 16:31:17 +0800 Subject: [PATCH] Fix _hittedByCamera may be null in Widget::isClippingParentContainsPoint Merged from https://github.com/cocos2d/cocos2d-x/pull/13884 --- cocos/ui/UIWidget.cpp | 6 ++++-- .../frameworks/runtime-src/proj.ios_mac/mac/Info.plist | 2 +- tools/simulator/frameworks/runtime-src/proj.win32/game.rc | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index f276cdb07e..b7c623f01a 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -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; } diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist b/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist index e52344dca3..3fca271a0a 100644 --- a/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist +++ b/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist @@ -41,7 +41,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.8 + 3.8.1 CFBundleSignature ???? CFBundleVersion diff --git a/tools/simulator/frameworks/runtime-src/proj.win32/game.rc b/tools/simulator/frameworks/runtime-src/proj.win32/game.rc index 4733633d7b..6040595fb1 100755 --- a/tools/simulator/frameworks/runtime-src/proj.win32/game.rc +++ b/tools/simulator/frameworks/runtime-src/proj.win32/game.rc @@ -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