optimize the last change

This commit is contained in:
2025-05-13 17:01:10 -05:00
parent 166b66e34e
commit 4cd07098cd
4 changed files with 23 additions and 15 deletions

View File

@@ -10,6 +10,7 @@
#include <cmath>
#include "scen.btnmg.hpp"
#include "dialogxml/widgets/scrollbar.hpp"
#include "gfx/render_text.hpp"
extern rectangle right_sbar_rect;
@@ -84,7 +85,8 @@ void set_rb(short slot, eRBAction action, int n, std::string label, bool do_draw
right_button_status.resize(slot + 1);
right_button_status[slot].action = action;
right_button_status[slot].i = n;
right_button_status[slot].label = label;
static TextStyle style;
right_button_status[slot].label = truncate_with_ellipsis(label, style, right_buttons[0].width());
for(char& c : right_button_status[slot].label) {
if(c == '|')
c = ' ';