Fix panels forwarding clicks from anywhere
Very similar toab28f93753
. Broken by69e0a8b0aa
where I added an extra MouseDownInside check to the OnMouseDown (used to be OnMouseClick) of every component except that of sliders AND apparently panels, great.
This commit is contained in:
parent
4b866c409a
commit
bb471e63e1
@ -114,32 +114,35 @@ void Panel::OnMouseClick(int localx, int localy, unsigned button)
|
||||
|
||||
void Panel::OnMouseDown(int x, int y, unsigned button)
|
||||
{
|
||||
auto localx = x - Position.X;
|
||||
auto localy = y - Position.Y;
|
||||
//check if clicked a child
|
||||
for(int i = children.size()-1; i >= 0 ; --i)
|
||||
if (MouseDownInside)
|
||||
{
|
||||
//child must be enabled
|
||||
if(children[i]->Enabled)
|
||||
auto localx = x - Position.X;
|
||||
auto localy = y - Position.Y;
|
||||
//check if clicked a child
|
||||
for(int i = children.size()-1; i >= 0 ; --i)
|
||||
{
|
||||
//is mouse inside?
|
||||
if( localx >= children[i]->Position.X + ViewportPosition.X &&
|
||||
localy >= children[i]->Position.Y + ViewportPosition.Y &&
|
||||
localx < children[i]->Position.X + ViewportPosition.X + children[i]->Size.X &&
|
||||
localy < children[i]->Position.Y + ViewportPosition.Y + children[i]->Size.Y )
|
||||
//child must be enabled
|
||||
if(children[i]->Enabled)
|
||||
{
|
||||
GetParentWindow()->FocusComponent(children[i]);
|
||||
children[i]->MouseDownInside = true;
|
||||
break;
|
||||
//is mouse inside?
|
||||
if( localx >= children[i]->Position.X + ViewportPosition.X &&
|
||||
localy >= children[i]->Position.Y + ViewportPosition.Y &&
|
||||
localx < children[i]->Position.X + ViewportPosition.X + children[i]->Size.X &&
|
||||
localy < children[i]->Position.Y + ViewportPosition.Y + children[i]->Size.Y )
|
||||
{
|
||||
GetParentWindow()->FocusComponent(children[i]);
|
||||
children[i]->MouseDownInside = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XOnMouseDown(x, y, button);
|
||||
for (size_t i = 0; i < children.size(); ++i)
|
||||
{
|
||||
if(children[i]->Enabled)
|
||||
children[i]->OnMouseDown(x - Position.X - ViewportPosition.X, y - Position.Y - ViewportPosition.Y, button);
|
||||
XOnMouseDown(x, y, button);
|
||||
for (size_t i = 0; i < children.size(); ++i)
|
||||
{
|
||||
if(children[i]->Enabled)
|
||||
children[i]->OnMouseDown(x - Position.X - ViewportPosition.X, y - Position.Y - ViewportPosition.Y, button);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user