Fix #93504: Text moving in status bar
When flexiable spacing clamp the floating point widths to whole pixels in ui_update_flexible_spacing to remove the random jiggling that can occur, notable seen on the status bar at the right edge. Pull Request: https://projects.blender.org/blender/blender/pulls/135899
This commit is contained in:
committed by
Harley Acheson
parent
96869d03d4
commit
cb11e23605
@@ -314,8 +314,8 @@ static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block)
|
||||
|
||||
rcti rect;
|
||||
ui_but_to_pixelrect(&rect, region, block, block->buttons.last().get());
|
||||
const float buttons_width = float(rect.xmax) + UI_HEADER_OFFSET;
|
||||
const float region_width = float(region->sizex) * UI_SCALE_FAC;
|
||||
const float buttons_width = std::ceil(float(rect.xmax) + UI_HEADER_OFFSET);
|
||||
const float region_width = float(region->winx);
|
||||
|
||||
if (region_width <= buttons_width) {
|
||||
return;
|
||||
@@ -335,7 +335,7 @@ static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block)
|
||||
float offset = 0, remaining_space = region_width - buttons_width;
|
||||
int i = 0;
|
||||
for (const std::unique_ptr<uiBut> &but : block->buttons) {
|
||||
BLI_rctf_translate(&but->rect, offset / view_scale_x, 0);
|
||||
BLI_rctf_translate(&but->rect, std::floor(offset / view_scale_x), 0.0f);
|
||||
if (but->type == UI_BTYPE_SEPR_SPACER) {
|
||||
/* How much the next block overlap with the current segment */
|
||||
int overlap = ((i == sepr_flex_len - 1) ? buttons_width - spacers_pos[i] :
|
||||
|
||||
Reference in New Issue
Block a user