diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-11 17:54:40 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-11 17:54:40 +0300 |
commit | dea66025b91832df59c435afd9b72966ef1e61b1 (patch) | |
tree | d17d19463081a0e0ee0698bc725dec5274b3c46d | |
parent | 20e00806e518d3d33093158df3a7d2f5d9c0160e (diff) |
Fixed centering a sheet not under root
-rw-r--r-- | src/ui/util.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index 71539fa0..36fd91eb 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -484,7 +484,10 @@ iWidget *makeSheet_Widget(const char *id) { | |||
484 | void centerSheet_Widget(iWidget *sheet) { | 484 | void centerSheet_Widget(iWidget *sheet) { |
485 | arrange_Widget(sheet); | 485 | arrange_Widget(sheet); |
486 | const iInt2 rootSize = rootSize_Window(get_Window()); | 486 | const iInt2 rootSize = rootSize_Window(get_Window()); |
487 | sheet->rect.pos.x = rootSize.x / 2 - sheet->rect.size.x / 2; | 487 | const iInt2 orig = localCoord_Widget( |
488 | sheet->parent, | ||
489 | init_I2(rootSize.x / 2 - sheet->rect.size.x / 2, bounds_Widget(sheet).pos.y)); | ||
490 | sheet->rect.pos = orig; | ||
488 | postRefresh_App(); | 491 | postRefresh_App(); |
489 | } | 492 | } |
490 | 493 | ||