Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My problems: There is a scrollView with many buttons (items). Above it there are 2 function buttons (return, start).</p> <ol> <li><p>When I scroll down item buttons overlie function buttons. When I swallow all touches above my scrollview I will lose my function buttons. So I have to find another solution.</p></li> <li><p>When I start draging scroll view a item button is pressed. When I ended the button action will be execute. This is very annoying.</p></li> </ol> <p>But there is the solution. I have created new CCControlButton. It checks whether was clicked outside scrollview or was dragged. The button is used for items buttons.</p> <pre><code>bool ControlButtonForScrolling::checkIfTouchIsInsideScrollView(CCTouch *pTouch) { CCPoint touchLocation = pTouch-&gt;getLocation(); // Get the touch position touchLocation = _scrollView-&gt;getParent()-&gt;convertToNodeSpace(touchLocation); CCRect bBox=_scrollView-&gt;boundingBox(); bool result = bBox.containsPoint(touchLocation); return result; } bool ControlButtonForScrolling::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { bool isInside = this-&gt;checkIfTouchIsInsideScrollView(pTouch); if (isInside) { return CCControlButton::ccTouchBegan(pTouch, pEvent); } else { return false; } } void ControlButtonForScrolling::ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) { CCControlButton::ccTouchMoved(pTouch, pEvent); _scrollWasDragged = true; // information about dragging is stored to prevent sending action } void ControlButtonForScrolling::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) { // this method is a copy of CCControlButton::ccTouchEnded except lines with _scrollWasDragged m_eState = CCControlStateNormal; m_isPushed = false; setHighlighted(false); if (!_scrollWasDragged) { if (isTouchInside(pTouch)) { sendActionsForControlEvents(CCControlEventTouchUpInside); } else { sendActionsForControlEvents(CCControlEventTouchUpOutside); } } _scrollWasDragged = false; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload