mirror of
https://github.com/edubart/otclient.git
synced 2025-05-01 18:19:20 +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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(m_pressedWidget) {
|
||||||
|
if(m_pressedWidget->onMouseMove(event.mousePos, event.mouseMoved)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_mouseReceiver->propagateOnMouseMove(event.mousePos, event.mouseMoved, widgetList);
|
m_mouseReceiver->propagateOnMouseMove(event.mousePos, event.mouseMoved, widgetList);
|
||||||
for(const UIWidgetPtr& widget : widgetList) {
|
for(const UIWidgetPtr& widget : widgetList) {
|
||||||
if(widget->onMouseMove(event.mousePos, event.mouseMoved))
|
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)
|
bool UIWidget::propagateOnMouseMove(const Point& mousePos, const Point& mouseMoved, UIWidgetList& widgetList)
|
||||||
{
|
{
|
||||||
for(auto it = m_children.begin(); it != m_children.end(); ++it) {
|
if(containsPaddingPoint(mousePos)) {
|
||||||
const UIWidgetPtr& child = *it;
|
for(auto it = m_children.begin(); it != m_children.end(); ++it) {
|
||||||
if(child->isExplicitlyVisible() && child->isExplicitlyEnabled())
|
const UIWidgetPtr& child = *it;
|
||||||
child->propagateOnMouseMove(mousePos, mouseMoved, widgetList);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user