| 280 | } |
| 281 | |
| 282 | bool 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 | |
| 318 | bool NodeTouchHandler::move(const SDL_Event& event) { |
| 319 | if (!_target->isTouchEnabled()) return false; |
nothing calls this directly
no test coverage detected