MCPcopy Create free account
hub / github.com/axmolengine/axmol / onTouchEnded

Method onTouchEnded

tests/cpp-tests/Source/TextInputTest/TextInputTest.cpp:115–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115void KeyboardNotificationLayer::onTouchEnded(Touch* touch, Event* event)
116{
117 if (!_trackNode)
118 {
119 return;
120 }
121
122 auto endPos = touch->getLocation();
123
124 float delta = 5.0f;
125 if (std::abs(endPos.x - _beginPos.x) > delta || std::abs(endPos.y - _beginPos.y) > delta)
126 {
127 // not click
128 _beginPos.x = _beginPos.y = -1;
129 return;
130 }
131
132 // decide the trackNode is clicked.
133 Rect rect;
134 rect.size = _trackNode->getContentSize();
135 auto clicked =
136 isScreenPointInRect(endPos, Camera::getVisitingCamera(), _trackNode->getWorldToNodeTransform(), rect, nullptr);
137 this->onClickTrackNode(clicked, endPos);
138 AXLOGD("----------------------------------");
139}
140
141//////////////////////////////////////////////////////////////////////////
142// implement TextFieldTTFDefaultTest

Callers

nothing calls this directly

Calls 6

isScreenPointInRectFunction · 0.85
onClickTrackNodeMethod · 0.80
absFunction · 0.50
getLocationMethod · 0.45
getContentSizeMethod · 0.45

Tested by

no test coverage detected