diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-08-06 19:01:12 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-08-06 19:01:29 +0300 |
commit | 7c7af3b7425f0496203d68d9bc42be0603048a9b (patch) | |
tree | e02ee9aae3ab71fa001f3e11b356103a24aa9874 /src/ui | |
parent | f9571a595986fbaaa7e03c8316219a579fb5b914 (diff) |
GmDocument: Full-width images in narrow layout
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index e1be27c2..8de1162f 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1054,9 +1054,12 @@ static void documentWasChanged_DocumentWidget_(iDocumentWidget *d) { | |||
1054 | 1054 | ||
1055 | void setSource_DocumentWidget(iDocumentWidget *d, const iString *source) { | 1055 | void setSource_DocumentWidget(iDocumentWidget *d, const iString *source) { |
1056 | setUrl_GmDocument(d->doc, d->mod.url); | 1056 | setUrl_GmDocument(d->doc, d->mod.url); |
1057 | const int docWidth = documentWidth_DocumentWidget_(d); | ||
1058 | const int outsideMargin = (width_Widget(d) - docWidth) / 2; | ||
1057 | setSource_GmDocument(d->doc, | 1059 | setSource_GmDocument(d->doc, |
1058 | source, | 1060 | source, |
1059 | documentWidth_DocumentWidget_(d), | 1061 | docWidth, |
1062 | outsideMargin, | ||
1060 | isFinished_GmRequest(d->request) ? final_GmDocumentUpdate | 1063 | isFinished_GmRequest(d->request) ? final_GmDocumentUpdate |
1061 | : partial_GmDocumentUpdate); | 1064 | : partial_GmDocumentUpdate); |
1062 | documentWasChanged_DocumentWidget_(d); | 1065 | documentWasChanged_DocumentWidget_(d); |
@@ -2249,7 +2252,7 @@ static iBool updateDocumentWidthRetainingScrollPosition_DocumentWidget_(iDocumen | |||
2249 | /* TODO: First *fully* visible run? */ | 2252 | /* TODO: First *fully* visible run? */ |
2250 | voffset = visibleRange_DocumentWidget_(d).start - top_Rect(run->visBounds); | 2253 | voffset = visibleRange_DocumentWidget_(d).start - top_Rect(run->visBounds); |
2251 | } | 2254 | } |
2252 | setWidth_GmDocument(d->doc, newWidth); | 2255 | setWidth_GmDocument(d->doc, newWidth, (width_Widget(d) - newWidth) / 2); |
2253 | documentRunsInvalidated_DocumentWidget_(d); | 2256 | documentRunsInvalidated_DocumentWidget_(d); |
2254 | if (runLoc && !keepCenter) { | 2257 | if (runLoc && !keepCenter) { |
2255 | run = findRunAtLoc_GmDocument(d->doc, runLoc); | 2258 | run = findRunAtLoc_GmDocument(d->doc, runLoc); |