bool CATextSelViewEx::ccTouchBegan(CATouch *pTouch, CAEvent *pEvent) { CCPoint cTouchPoint = this->convertTouchToNodeSpace(pTouch); CCRect newRectL = m_pCursorMarkL->getFrame(); newRectL.InflateRect(8); CCRect newRectR = m_pCursorMarkR->getFrame(); newRectR.InflateRect(8); m_iSelViewTouchPos = 0; if (newRectL.containsPoint(cTouchPoint)) { m_iSelViewTouchPos = 1; } else if (newRectR.containsPoint(cTouchPoint)) { m_iSelViewTouchPos = 2; } else if (m_pControlView) { if (touchSelectText(pTouch)) { CATextToolBarView *pToolBar = CATextToolBarView::create(); pToolBar->addButton(UTF8("\u526a\u5207"), m_pControlView, callfunc_selector(CATextView::ccCutToClipboard)); pToolBar->addButton(UTF8("\u590d\u5236"), m_pControlView, callfunc_selector(CATextView::ccCopyToClipboard)); pToolBar->addButton(UTF8("\u7c98\u8d34"), m_pControlView, callfunc_selector(CATextView::ccPasteFromClipboard)); pToolBar->show(m_pControlView); return false; } } return true; }
bool CATextSelectView::ccTouchBegan(CATouch *pTouch, CAEvent *pEvent) { CCPoint cTouchPoint = this->convertTouchToNodeSpace(pTouch); CCRect newRectL = m_pCursorMarkL->getFrame(); newRectL.InflateRect(8); CCRect newRectR = m_pCursorMarkR->getFrame(); newRectR.InflateRect(8); m_iSelViewTouchPos = 0; if (newRectL.containsPoint(cTouchPoint)) { m_iSelViewTouchPos = 1; return true; } if (newRectR.containsPoint(cTouchPoint)) { m_iSelViewTouchPos = 2; return true; } CCPoint point = this->convertTouchToNodeSpace(pTouch); CCRect ccTextRect = m_pTextViewMask->getFrame(); if (ccTextRect.containsPoint(point)) { CATextToolBarView *pToolBar = CATextToolBarView::create(); pToolBar->addButton(UTF8("\u526a\u5207"), this, callfunc_selector(CATextSelectView::ccCutToClipboard)); pToolBar->addButton(UTF8("\u590d\u5236"), this, callfunc_selector(CATextSelectView::ccCopyToClipboard)); pToolBar->addButton(UTF8("\u7c98\u8d34"), this, callfunc_selector(CATextSelectView::ccPasteFromClipboard)); pToolBar->show(); } else { if (resignFirstResponder()) { hideTextSelView(); } else { becomeFirstResponder(); } } return true; }
bool CATextArrowView::ccTouchBegan(CATouch *pTouch, CAEvent *pEvent) { CCPoint point = this->convertTouchToNodeSpace(pTouch); CCRect newRectR = m_pArrowView->getFrame(); newRectR.InflateRect(5); if (!newRectR.containsPoint(point)) { hideTextArrView(); return false; } m_isBtnPress = true; return true; }