MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / updateCursor

Method updateCursor

Source/TextInputNode.cpp:287–300  ·  view source on GitHub ↗

Updates the x-position and scale of the cursor

Source from the content-addressed store, hash-verified

285
286// Updates the x-position and scale of the cursor
287void TextInputNode::updateCursor()
288{
289 if (!_displayedLabel || !_cursor)
290 return;
291
292 float scale = (_placeholderScale != 0.0f && _textField->getString().empty()) ? _placeholderScale : _displayedLabel->getScale();
293
294 _cursor->setScale(scale);
295
296 if (_displayedLabel->getAnchorPoint().x)
297 _cursor->setPositionX((_displayedLabel->getPositionX() + ((_displayedLabel->getContentSize().width * scale) * _displayedLabel->getAnchorPoint().x)));
298 else
299 _cursor->setPositionX((_displayedLabel->getPositionX() + (_displayedLabel->getContentSize().width * scale)));
300}
301
302std::string TextInputNode::sanitizeString(std::string_view str)
303{

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.80
getStringMethod · 0.80
setScaleMethod · 0.80

Tested by

no test coverage detected