| 259 | } |
| 260 | |
| 261 | void TextAreaWidget::RefreshCursor() |
| 262 | { |
| 263 | const auto& lineInfo = m_drawer.GetLine(m_cursorPosition.y); |
| 264 | |
| 265 | std::size_t glyphCount = m_drawer.GetGlyphCount(); |
| 266 | float position; |
| 267 | if (glyphCount > 0 && lineInfo.glyphIndex < m_cursorGlyph) |
| 268 | { |
| 269 | const auto& glyph = m_drawer.GetGlyph(std::min(m_cursorGlyph, glyphCount - 1)); |
| 270 | position = glyph.bounds.x; |
| 271 | if (m_cursorGlyph >= glyphCount) |
| 272 | position += glyph.bounds.width; |
| 273 | } |
| 274 | else |
| 275 | position = 0.f; |
| 276 | |
| 277 | Nz::Vector2f contentOrigin = GetContentOrigin(); |
| 278 | |
| 279 | m_cursorEntity->GetComponent<NodeComponent>().SetPosition(contentOrigin.x + position, contentOrigin.y + lineInfo.bounds.y); |
| 280 | } |
| 281 | } |
nothing calls this directly
no test coverage detected