Updates the x-position and scale of the cursor
| 285 | |
| 286 | // Updates the x-position and scale of the cursor |
| 287 | void 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 | |
| 302 | std::string TextInputNode::sanitizeString(std::string_view str) |
| 303 | { |