Widgets/SimpleWidgetStyles: Fix hovered sprite not being detached on click
This commit is contained in:
@@ -316,8 +316,11 @@ namespace Nz
|
|||||||
if (!pressed)
|
if (!pressed)
|
||||||
m_sprite->SetMaterial(owner->GetMaterial());
|
m_sprite->SetMaterial(owner->GetMaterial());
|
||||||
|
|
||||||
GraphicsComponent& gfxComponent = GetRegistry().get<GraphicsComponent>(m_entity);
|
if (!m_isHovered)
|
||||||
gfxComponent.AttachRenderable(m_hoveredSprite, GetRenderMask());
|
{
|
||||||
|
GraphicsComponent& gfxComponent = GetRegistry().get<GraphicsComponent>(m_entity);
|
||||||
|
gfxComponent.AttachRenderable(m_hoveredSprite, GetRenderMask());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -325,8 +328,11 @@ namespace Nz
|
|||||||
if (!pressed)
|
if (!pressed)
|
||||||
m_sprite->SetMaterial(owner->GetMaterial());
|
m_sprite->SetMaterial(owner->GetMaterial());
|
||||||
|
|
||||||
GraphicsComponent& gfxComponent = GetRegistry().get<GraphicsComponent>(m_entity);
|
if (m_isHovered)
|
||||||
gfxComponent.DetachRenderable(m_hoveredSprite);
|
{
|
||||||
|
GraphicsComponent& gfxComponent = GetRegistry().get<GraphicsComponent>(m_entity);
|
||||||
|
gfxComponent.DetachRenderable(m_hoveredSprite);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user