Fix pin icon in Properties not right-aligned after zooming

The logic for separator-spacers (used here for right-alignment) didn't take
region scaling into account. Usually that's not an issue because they are
otherwise only used in headers which can't zoom.
This commit is contained in:
Julian Eisel 2020-11-18 19:49:20 +01:00
parent 9a8f5022b7
commit ad58999b0d
Notes: blender-bot 2023-02-14 06:19:41 +01:00
Referenced by issue #84889, EnumProperty with ENUM_FLAG causes a crash
Referenced by issue #82857, Crash on GP toggle select mode
1 changed files with 3 additions and 1 deletions

View File

@ -64,6 +64,7 @@
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "UI_view2d.h"
#include "IMB_imbuf.h"
@ -286,11 +287,12 @@ static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block)
}
}
const float view_scale_x = UI_view2d_scale_get_x(&region->v2d);
const float segment_width = region_width / (float)sepr_flex_len;
float offset = 0, remaining_space = region_width - buttons_width;
i = 0;
LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
BLI_rctf_translate(&but->rect, offset, 0);
BLI_rctf_translate(&but->rect, offset / view_scale_x, 0);
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] :