mirror of
https://github.com/edubart/otclient.git
synced 2025-05-01 10:09:21 +02:00
Improve mouse move event propagation
This commit is contained in:
parent
7922f8238e
commit
da564e86cf
@ -142,6 +142,12 @@ void UIManager::inputEvent(const InputEvent& event)
|
||||
break;
|
||||
}
|
||||
|
||||
if(m_pressedWidget) {
|
||||
if(m_pressedWidget->onMouseMove(event.mousePos, event.mouseMoved)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_mouseReceiver->propagateOnMouseMove(event.mousePos, event.mouseMoved, widgetList);
|
||||
for(const UIWidgetPtr& widget : widgetList) {
|
||||
if(widget->onMouseMove(event.mousePos, event.mouseMoved))
|
||||
|
@ -1712,12 +1712,15 @@ bool UIWidget::propagateOnMouseEvent(const Point& mousePos, UIWidgetList& widget
|
||||
|
||||
bool UIWidget::propagateOnMouseMove(const Point& mousePos, const Point& mouseMoved, UIWidgetList& widgetList)
|
||||
{
|
||||
for(auto it = m_children.begin(); it != m_children.end(); ++it) {
|
||||
const UIWidgetPtr& child = *it;
|
||||
if(child->isExplicitlyVisible() && child->isExplicitlyEnabled())
|
||||
child->propagateOnMouseMove(mousePos, mouseMoved, widgetList);
|
||||
if(containsPaddingPoint(mousePos)) {
|
||||
for(auto it = m_children.begin(); it != m_children.end(); ++it) {
|
||||
const UIWidgetPtr& child = *it;
|
||||
if(child->isExplicitlyVisible() && child->isExplicitlyEnabled() && child->containsPoint(mousePos))
|
||||
child->propagateOnMouseMove(mousePos, mouseMoved, widgetList);
|
||||
|
||||
widgetList.push_back(static_self_cast<UIWidget>());
|
||||
}
|
||||
}
|
||||
|
||||
widgetList.push_back(static_self_cast<UIWidget>());
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user