mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-28 17:16:29 +03:00
Some minor stuff.
This commit is contained in:
@@ -386,12 +386,13 @@ Float RichText::getMaxIntrinsicWidth() {
|
||||
size_t end = 0;
|
||||
while ( ( end = s.find( '\n', start ) ) != String::InvalidPos ) {
|
||||
curX += Text::getTextWidth( s.substr( start, end - start ),
|
||||
span->getFontStyleConfig() );
|
||||
span->getFontStyleConfig(), 4, span->getTextHints() );
|
||||
maxW = std::max( maxW, curX );
|
||||
curX = 0;
|
||||
start = end + 1;
|
||||
}
|
||||
curX += Text::getTextWidth( s.substr( start ), span->getFontStyleConfig() );
|
||||
curX += Text::getTextWidth( s.substr( start ), span->getFontStyleConfig(), 4,
|
||||
span->getTextHints() );
|
||||
} else if ( auto pDrawable = std::get_if<std::shared_ptr<Drawable>>( &block ) ) {
|
||||
curX += ( *pDrawable )->getPixelsSize().getWidth();
|
||||
} else if ( auto pSize = std::get_if<Sizef>( &block ) ) {
|
||||
@@ -491,7 +492,8 @@ void RichText::updateLayout() {
|
||||
}
|
||||
|
||||
// Wrap if needed
|
||||
if ( mMaxWidth > 0 && curX + blockSize.getWidth() > mMaxWidth && curX > 0 ) {
|
||||
if ( mMaxWidth > 0 &&
|
||||
( curX + blockSize.getWidth() >= mMaxWidth || curX >= mMaxWidth ) && curX > 0 ) {
|
||||
maxWidth = std::max( maxWidth, curX );
|
||||
mLines.push_back( RenderParagraph() );
|
||||
curX = 0;
|
||||
@@ -514,7 +516,7 @@ void RichText::updateLayout() {
|
||||
curX += blockSize.getWidth();
|
||||
currentLine.width += blockSize.getWidth();
|
||||
|
||||
if ( mMaxWidth > 0 && curX + blockSize.getWidth() > mMaxWidth && curX > 0 ) {
|
||||
if ( mMaxWidth > 0 && curX >= mMaxWidth ) {
|
||||
maxWidth = std::max( maxWidth, curX );
|
||||
mLines.push_back( RenderParagraph() );
|
||||
curX = 0;
|
||||
|
||||
@@ -526,9 +526,10 @@ void UIRichText::rebuildRichText( RichText& richText, IntrinsicMode mode ) {
|
||||
if ( mode == IntrinsicMode::None ) {
|
||||
if ( widget->getLayoutWidthPolicy() == SizePolicy::MatchParent ) {
|
||||
if ( mSize.getWidth() != 0 ) {
|
||||
widget->setPixelsSize( eemax( 0.f, mSize.getWidth() - mPaddingPx.Left -
|
||||
mPaddingPx.Right - margin.Left -
|
||||
margin.Right ),
|
||||
Float maxSize =
|
||||
eemax( 0.f, mSize.getWidth() - mPaddingPx.Left - mPaddingPx.Right -
|
||||
margin.Left - margin.Right );
|
||||
widget->setPixelsSize( eemax( 0.f, maxSize ),
|
||||
widget->getPixelsSize().getHeight() );
|
||||
} else {
|
||||
onAutoSizeChild( widget );
|
||||
|
||||
@@ -142,7 +142,7 @@ void UITextInput::draw() {
|
||||
if ( textCache.getTextWidth() ) {
|
||||
drawSelection( textCache );
|
||||
|
||||
if ( isClipped() ) {
|
||||
if ( mMode == TextInputMode::Password && isClipped() ) {
|
||||
clipSmartEnable( mScreenPos.x + mPaddingPx.Left, mScreenPos.y + mPaddingPx.Top,
|
||||
mSize.getWidth() - mPaddingPx.Left - mPaddingPx.Right,
|
||||
mSize.getHeight() - mPaddingPx.Top - mPaddingPx.Bottom );
|
||||
@@ -154,12 +154,12 @@ void UITextInput::draw() {
|
||||
std::trunc( mScreenPos.y ) + (int)mRealAlignOffset.y + (int)mPaddingPx.Top,
|
||||
Vector2f::One, 0.f, getBlendMode() );
|
||||
|
||||
if ( isClipped() ) {
|
||||
if ( mMode == TextInputMode::Password && isClipped() ) {
|
||||
clipSmartDisable();
|
||||
}
|
||||
} else if ( !mHintCache->getString().empty() &&
|
||||
( mHintDisplay == HintDisplay::Always || hasFocus() ) ) {
|
||||
if ( isClipped() ) {
|
||||
if ( mMode == TextInputMode::Password && isClipped() ) {
|
||||
clipSmartEnable( mScreenPos.x + mPaddingPx.Left, mScreenPos.y + mPaddingPx.Top,
|
||||
mSize.getWidth() - mPaddingPx.Left - mPaddingPx.Right,
|
||||
mSize.getHeight() - mPaddingPx.Top - mPaddingPx.Bottom );
|
||||
@@ -170,7 +170,7 @@ void UITextInput::draw() {
|
||||
std::trunc( mScreenPos.y ) + (int)mRealAlignOffset.y + (int)mPaddingPx.Top,
|
||||
Vector2f::One, 0.f, getBlendMode() );
|
||||
|
||||
if ( isClipped() ) {
|
||||
if ( mMode == TextInputMode::Password && isClipped() ) {
|
||||
clipSmartDisable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ SyntaxDefinition& addTypeScript() {
|
||||
->add(
|
||||
|
||||
{ "TypeScript",
|
||||
{ "%.ts$", "%.d%.ts$", "%.cts$" },
|
||||
{ "%.ts$", "%.d%.ts$", "%.cts$", "%.mts$" },
|
||||
{
|
||||
{ { "//.-\n" }, "comment" },
|
||||
{ { "/%*", "%*/" }, "comment" },
|
||||
|
||||
Reference in New Issue
Block a user