void UIRoot::_updateTouches() { for (TouchDataMap::iterator it = m_touches.begin(); it != m_touches.end(); ++it) { TouchData &td = it->second; UIElement *p = 0; if (m_root && m_root->isVisible() && m_root->isEnabled()) { p = m_root->pick(td.touch.position); } if (td.capture && td.capture != p) { p = 0; } if (p != td.hover) { if (td.hover) { td.hover->onTouchLeave(&td.touch); td.hover->drop(); } if ((td.hover = p)) { p->grab(); p->onTouchEnter(&td.touch); } } } }