MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / up

Method up

Source/Input/TouchDispather.cpp:282–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282bool NodeTouchHandler::up(const SDL_Event& event) {
283 if (!_target->isTouchEnabled()) return false;
284 int64_t id = 0;
285 switch (event.type) {
286 case SDL_MOUSEBUTTONUP:
287 if ((Touch::getSource() & Touch::FromMouseAndTouch) && event.button.which == SDL_TOUCH_MOUSEID) return false;
288 if ((Touch::getSource() & Touch::FromMouse) == 0) return false;
289 id = INT64_MAX;
290 break;
291 case SDL_FINGERUP:
292 if ((Touch::getSource() & Touch::FromTouch) == 0) return false;
293 id = event.tfinger.fingerId;
294 break;
295 default:
296 return false;
297 }
298 Touch* touch = get(id);
299 if (touch) {
300 if (touch->isEnabled()) {
301 Vec2 pos = getPos(event);
302 touch->_preLocation = touch->_location;
303 touch->_location = pos;
304 touch->_worldPreLocation = touch->_worldLocation;
305 touch->_worldLocation = _target->convertToWorldSpace(pos);
306 if (touch->_flags.isOn(Touch::Selected)) {
307 _target->emit("TapEnded"_slice, touch);
308 _target->emit("Tapped"_slice, touch);
309 }
310 collect(id);
311 return true;
312 }
313 collect(id);
314 }
315 return false;
316}
317
318bool NodeTouchHandler::move(const SDL_Event& event) {
319 if (!_target->isTouchEnabled()) return false;

Callers

nothing calls this directly

Calls 6

isTouchEnabledMethod · 0.80
convertToWorldSpaceMethod · 0.80
isOnMethod · 0.80
getFunction · 0.50
isEnabledMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected