diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-25 17:29:51 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-25 17:29:51 +0300 |
commit | 07b10a92a467a8a2ceb045e5eae37a1be440a1ca (patch) | |
tree | 3244642c200eaf44c8184750849e3e6a9572f0c3 /src/ui/documentwidget.c | |
parent | 3dee6c5d167044fae4159e6e657ce547ab32f854 (diff) |
DocumentWidget: Center vertically if document is short
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index aa24be48..2a3a2509 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -87,6 +87,12 @@ static iRect documentBounds_DocumentWidget_(const iDocumentWidget *d) { | |||
87 | rect.pos.x = bounds.size.x / 2 - rect.size.x / 2; | 87 | rect.pos.x = bounds.size.x / 2 - rect.size.x / 2; |
88 | rect.pos.y = top_Rect(bounds) + margin; | 88 | rect.pos.y = top_Rect(bounds) + margin; |
89 | rect.size.y = height_Rect(bounds) - 2 * margin; | 89 | rect.size.y = height_Rect(bounds) - 2 * margin; |
90 | if (size_GmDocument(d->doc).y < rect.size.y) { | ||
91 | /* Center vertically if short. */ | ||
92 | int offset = (rect.size.y - size_GmDocument(d->doc).y) / 2; | ||
93 | rect.pos.y += offset; | ||
94 | rect.size.y = size_GmDocument(d->doc).y; | ||
95 | } | ||
90 | return rect; | 96 | return rect; |
91 | } | 97 | } |
92 | 98 | ||