Cocostudio Bug (1)

Source: Internet
Author: User

Today, a female colleague asked me a question, two Cocostudio UI is addchild to a layer at the same time, the UI settings in the upper level are visible to false, the visible setting of the low-level UI settings is set to True, Then the click events on the low-level UI are not clickable,

I remember that the touch event in the UIButton class is called the Ontouchbegan method in Uiwidget, and here is the process of clicking the event:

BOOL Widget::ontouchbegan (Touch *touch, Event *unusedevent)
{
_hitted = false;
if (isVisible () && isenabled () && isancestorsenabled () && isancestorsvisible (This))
{
_touchbeganposition = Touch->getlocation ();
if (HitTest (_touchbeganposition) && isclippingparentcontainspoint (_touchbeganposition))
{
_hitted = true;
}
}
if (!_hitted)
{
return false;
}
Sethighlighted (TRUE);

/*
* Propagate Touch events to its parents
*/
if (_propagatetouchevents)
{
This->propagatetouchevent (Toucheventtype::began, this, touch);
}

Pushdownevent ();
return true;
}

If the visible is false, the touch event cannot be triggered, but the visible variable of the child node is not false, so the touch events of the child nodes can also be triggered, thus masking the touch events of the low-level UI. This is the Cocostudio source developers do not think too thoughtful problem.

Reprint please indicate the source, from the blog Park Hemjohn

Cocostudio Bug (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.