always calculate_layout() when recalcRect() is called

This commit is contained in:
2024-08-12 20:55:50 -05:00
committed by Celtic Minstrel
parent 5ac49be9df
commit 3b6d16a549

View File

@@ -124,7 +124,10 @@ void cTextMsg::calculate_layout() {
}
void cTextMsg::recalcRect() {
if(fixedWidth && fixedHeight) return;
if(fixedWidth && fixedHeight){
calculate_layout();
return;
}
TextStyle style;
style.font = textFont;
style.pointSize = textSize;
@@ -166,7 +169,10 @@ void cTextMsg::recalcRect() {
rectangle test_rect = calc_rect;
test_rect.offset(-test_rect.left, -test_rect.top);
rects = draw_string_hilite(temp, test_rect, getText(), style, hilites, sf::Color::Black);
if(rects.empty()) return;
if(rects.empty()){
calculate_layout();
return;
}
// Basically take the the union of the rects, and add 8 to its height or width
rectangle combo = rects.back();
if(rects.size() > 1) {