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:
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user