diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-04 08:12:21 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-04 08:12:21 +0300 |
commit | 3e22cb42d56aec3075c3ee77f5ff4fca2ab41813 (patch) | |
tree | a817e0e34c83f3a9982e6bf715039fceb5fce4c2 /src | |
parent | 4a86b0a6f05e07d8c13431b9d13e8c4d87841f76 (diff) |
GmDocument: Fixed list item overdraw
Bullet icon backgrounds were overlapping the bullet text, causing them to be overdrawn.
Diffstat (limited to 'src')
-rw-r--r-- | src/gmdocument.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 8361e77b..c086898f 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -314,22 +314,25 @@ static enum iGmDocumentTheme currentTheme_(void) { | |||
314 | static void alignDecoration_GmRun_(iGmRun *run, iBool isCentered) { | 314 | static void alignDecoration_GmRun_(iGmRun *run, iBool isCentered) { |
315 | const iRect visBounds = visualBounds_Text(run->font, run->text); | 315 | const iRect visBounds = visualBounds_Text(run->font, run->text); |
316 | const int visWidth = width_Rect(visBounds); | 316 | const int visWidth = width_Rect(visBounds); |
317 | int xAdjust = 0; | ||
317 | if (!isCentered) { | 318 | if (!isCentered) { |
318 | /* Keep the icon aligned to the left edge. */ | 319 | /* Keep the icon aligned to the left edge. */ |
319 | run->visBounds.pos.x -= left_Rect(visBounds); | 320 | xAdjust -= left_Rect(visBounds); |
320 | if (visWidth > width_Rect(run->visBounds)) { | 321 | if (visWidth > width_Rect(run->visBounds)) { |
321 | /* ...unless it's a wide icon, in which case move it to the left. */ | 322 | /* ...unless it's a wide icon, in which case move it to the left. */ |
322 | run->visBounds.pos.x -= visWidth - width_Rect(run->visBounds); | 323 | xAdjust -= visWidth - width_Rect(run->visBounds); |
323 | } | 324 | } |
324 | else if (visWidth < width_Rect(run->visBounds) * 3 / 4) { | 325 | else if (visWidth < width_Rect(run->visBounds) * 3 / 4) { |
325 | /* ...or a narrow icon, which needs to be centered but leave a gap. */ | 326 | /* ...or a narrow icon, which needs to be centered but leave a gap. */ |
326 | run->visBounds.pos.x += (width_Rect(run->visBounds) * 3 / 4 - visWidth) / 2; | 327 | xAdjust += (width_Rect(run->visBounds) * 3 / 4 - visWidth) / 2; |
327 | } | 328 | } |
328 | } | 329 | } |
329 | else { | 330 | else { |
330 | /* Centered. */ | 331 | /* Centered. */ |
331 | run->visBounds.pos.x += (width_Rect(run->visBounds) - visWidth) / 2; | 332 | xAdjust += (width_Rect(run->visBounds) - visWidth) / 2; |
332 | } | 333 | } |
334 | run->visBounds.pos.x += xAdjust; | ||
335 | run->visBounds.size.x -= xAdjust; | ||
333 | } | 336 | } |
334 | 337 | ||
335 | static void doLayout_GmDocument_(iGmDocument *d) { | 338 | static void doLayout_GmDocument_(iGmDocument *d) { |