Widgets: Fix new line selection not being bound to scissor box

This commit is contained in:
SirLynix
2023-08-23 17:33:59 +02:00
parent 216686e7c1
commit 8f0890f719
4 changed files with 34 additions and 15 deletions

View File

@@ -563,6 +563,9 @@ namespace Nz
std::size_t oldSpriteCount = m_cursors.size();
if (m_cursors.size() < selectionLineCount)
{
Recti scissorBox = GetScissorBox();
bool isVisible = IsVisible() && HasFocus();
m_cursors.resize(selectionLineCount);
for (std::size_t i = oldSpriteCount; i < m_cursors.size(); ++i)
{
@@ -570,8 +573,11 @@ namespace Nz
m_cursors[i].sprite->UpdateRenderLayer(GetBaseRenderLayer() + 1);
m_cursors[i].entity = CreateEntity();
registry.emplace<GraphicsComponent>(m_cursors[i].entity, IsVisible() && HasFocus()).AttachRenderable(m_cursors[i].sprite, GetCanvas()->GetRenderMask());
registry.emplace<NodeComponent>(m_cursors[i].entity).SetParent(textNode);
auto& cursorGfx = registry.emplace<GraphicsComponent>(m_cursors[i].entity, isVisible);
cursorGfx.AttachRenderable(m_cursors[i].sprite, GetCanvas()->GetRenderMask());
cursorGfx.UpdateScissorBox(scissorBox);
}
}
else if (m_cursors.size() > selectionLineCount)