Separate GetTextSize and GetWrappedTextSize functions for clarity. Fix sizing comparisons for wrapping text. Fixed issue with menu destinations not properly being assigned on certain buttons.

This commit is contained in:
2023-12-21 10:26:18 -06:00
parent d29f7d47bd
commit a26d86d0b0
11 changed files with 99 additions and 40 deletions
+3 -3
View File
@@ -119,15 +119,15 @@ void MenuComponent::DrawDecal(ViewPort&window,bool focused){
}
if(showDefaultLabel){
vf2d adjustedScale=labelScaling;
vi2d labelTextSize=game->GetTextSizeProp(label,rect.size.x);
vi2d labelTextSize=vf2d(game->GetTextSizeProp(label))*adjustedScale;
if(fitToLabel){
float sizeRatio=((labelTextSize*adjustedScale).x)/(rect.size.x-2);
float sizeRatio=((vf2d(labelTextSize)*adjustedScale).x)/(rect.size.x-2);
if(sizeRatio>1){
adjustedScale.x/=sizeRatio;
}
}
window.DrawStringPropDecal(rect.pos+V(A::DRAW_OFFSET)+rect.size/2-vf2d(labelTextSize)/2.f*adjustedScale,label,WHITE,adjustedScale,rect.size.x);
window.DrawStringPropDecal(rect.pos+V(A::DRAW_OFFSET)+rect.size/2-vf2d(labelTextSize)/2.f,label,WHITE,adjustedScale);
}
if(selected){
switch(selectionType){