Page Menu
Home
Search
Configure Global Search
Log In
Paste
P2650
D13481 stitch align but
Archived
Public
Actions
Authored by
Yevgeny Makarov (jenkm)
on Dec 6 2021, 7:47 PM.
Edit Paste
Activate Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Tags
None
Subscribers
None
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -279,6 +279,25 @@ void ui_region_to_window(const ARegion *region, int *r_x, int *r_y)
*r_y += region->winrct.ymin;
}
+static void ui_update_align_stitch_but(const ARegion *region, uiBlock *block)
+{
+ float offset_x = 0;
+ float offset_y = 0;
+
+ LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
+ if (but->drawflag & UI_BUT_ALIGN) {
+ if (but->drawflag & (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_STITCH_TOP)) {
+ offset_y += U.pixelsize;
+ }
+ if (but->drawflag & (UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_STITCH_LEFT)) {
+ offset_x -= U.pixelsize;
+ }
+ }
+
+ BLI_rctf_translate(&but->rect, offset_x, offset_y);
+ }
+}
+
static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block)
{
int sepr_flex_len = 0;
@@ -1980,6 +1999,7 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2], int r_x
UI_block_align_end(block);
}
+ ui_update_align_stitch_but(region, block);
ui_update_flexible_spacing(region, block);
block->endblock = true;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -4604,10 +4604,10 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
/* ui_popup_block_position has this correction too, keep in sync */
if (but->drawflag & (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_STITCH_TOP)) {
- rect->ymax += U.pixelsize;
+ // rect->ymax += U.pixelsize;
}
if (but->drawflag & (UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_STITCH_LEFT)) {
- rect->xmin -= U.pixelsize;
+ // rect->xmin -= U.pixelsize;
}
switch (but->drawflag & UI_BUT_ALIGN) {
Event Timeline
Yevgeny Makarov (jenkm)
created this paste.
Dec 6 2021, 7:47 PM
Yevgeny Makarov (jenkm)
mentioned this in
D13481: [WIP] UI: Change icon buttons width to be even with layout->align
.
Dec 6 2021, 7:56 PM
Yevgeny Makarov (jenkm)
archived this paste.
Dec 10 2021, 1:59 PM
Log In to Comment