///////////////////////////////////////////////////////////////////// initialize /////////////////////////////////////////////////////////////////////
| 279 | // initialize |
| 280 | ////////////////////////////////////////////////////////////////////////// |
| 281 | bool TextFieldEx::initWithPlaceHolder(std::string_view placeholder, |
| 282 | std::string_view fontName, |
| 283 | float fontSize, |
| 284 | float cursorWidth, |
| 285 | const Color4B& cursorColor) |
| 286 | { |
| 287 | _placeHolder = placeholder; |
| 288 | |
| 289 | _renderLabel = |
| 290 | _createLabel(placeholder, fontName, fontSize, Vec2::ZERO, TextHAlignment::CENTER, TextVAlignment::CENTER); |
| 291 | _renderLabel->setAnchorPoint(Point::ANCHOR_MIDDLE_LEFT); |
| 292 | this->addChild(_renderLabel); |
| 293 | |
| 294 | _director->getScheduler()->runOnAxmolThread([this] { _renderLabel->setPosition(Point(0, this->getContentSize().height / 2)); }); |
| 295 | |
| 296 | __initCursor(fontSize, cursorWidth, cursorColor); |
| 297 | |
| 298 | _fontName = fontName; |
| 299 | _fontSize = fontSize; |
| 300 | _systemFontUsed = !FileUtils::getInstance()->isFileExist(fontName); |
| 301 | |
| 302 | return true; |
| 303 | } |
| 304 | |
| 305 | std::string_view TextFieldEx::getTextFontName() const |
| 306 | { |
no test coverage detected