UITextSpan drawBorder fix when span has padding.

This commit is contained in:
Martín Lucas Golini
2026-04-28 01:28:25 -03:00
parent 7c2fad64bc
commit c65122e120
2 changed files with 13 additions and 0 deletions

View File

@@ -142,6 +142,8 @@ class EE_API UITextSpan : public UIHTMLWidget {
explicit UITextSpan( const std::string& tag = "span" );
virtual void drawBorder();
virtual void onTextChanged();
virtual void onFontChanged();

View File

@@ -2,6 +2,7 @@
#include <eepp/graphics/text.hpp>
#include <eepp/ui/css/propertydefinition.hpp>
#include <eepp/ui/tools/htmlformatter.hpp>
#include <eepp/ui/uiborderdrawable.hpp>
#include <eepp/ui/uiscenenode.hpp>
#include <eepp/ui/uitextspan.hpp>
#include <eepp/ui/uithememanager.hpp>
@@ -50,6 +51,16 @@ bool UITextSpan::isType( const Uint32& type ) const {
return UITextSpan::getType() == type ? true : UIWidget::isType( type );
}
void UITextSpan::drawBorder() {
if ( ( mFlags & UI_BORDER ) && NULL != mBorder ) {
mBorder->setAlpha( mAlpha );
mBorder->draw( { std::trunc( mScreenPos.x - mPaddingPx.Left ),
std::trunc( mScreenPos.y - mPaddingPx.Top ) },
{ std::floor( mSize.x + mPaddingPx.Left + mPaddingPx.Right ),
std::floor( mSize.y + mPaddingPx.Top + mPaddingPx.Bottom ) } );
}
}
void UITextSpan::draw() {
// Skip native generic rendering because it will be drawn by UIRichText
}