MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / RefreshCursor

Method RefreshCursor

SDK/src/NDK/Widgets/TextAreaWidget.cpp:261–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 2

GetGlyphCountMethod · 0.80
SetPositionMethod · 0.45

Tested by

no test coverage detected