Fire OnMouseEnter events for components that are added under the mouse cursor, fixes issue #37
This commit is contained in:
parent
e06d8e4d15
commit
ae5d099b81
@ -40,6 +40,10 @@ void Window::AddComponent(Component* c)
|
|||||||
{
|
{
|
||||||
c->SetParentWindow(this);
|
c->SetParentWindow(this);
|
||||||
Components.push_back(c);
|
Components.push_back(c);
|
||||||
|
|
||||||
|
if(Engine::Ref().GetMouseX() > Position.X + c->Position.X && Engine::Ref().GetMouseX() < Position.X + c->Position.X + c->Size.X &&
|
||||||
|
Engine::Ref().GetMouseY() > Position.Y + c->Position.Y && Engine::Ref().GetMouseY() < Position.Y + c->Position.Y + c->Size.Y)
|
||||||
|
c->OnMouseEnter(Engine::Ref().GetMouseX() - (Position.X + c->Position.X), Engine::Ref().GetMouseY() - (Position.Y + c->Position.Y));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user