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

Method updateDisplayedLabelScale

Source/TextInputNode.cpp:264–284  ·  view source on GitHub ↗

Updates the displayed label's scale

Source from the content-addressed store, hash-verified

262
263// Updates the displayed label's scale
264void TextInputNode::updateDisplayedLabelScale()
265{
266 if (!_displayedLabel || !_cursor)
267 return;
268
269 if (_placeholderScale != 0.0f && _textField->getString().empty())
270 {
271 _displayedLabel->setScale(_placeholderScale);
272 }
273 else
274 {
275 float newScale = this->getContentSize().width / _displayedLabel->getContentSize().width;
276
277 if (newScale < _maxDisplayLabelScale)
278 _displayedLabel->setScale(newScale);
279 else
280 _displayedLabel->setScale(_maxDisplayLabelScale);
281 }
282
283 updateCursor();
284}
285
286// Updates the x-position and scale of the cursor
287void TextInputNode::updateCursor()

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.80
getStringMethod · 0.80
setScaleMethod · 0.80

Tested by

no test coverage detected