Page MenuHomeWildfire Games

Fix margin/padding issue in tooltips
ClosedPublic

Authored by s0600204 on Feb 13 2018, 6:45 AM.

Details

Summary

As reported by @bb in rP21142, the right-side of some tooltips don't appear to have the correct margin/padding on the right-hand side edge.

On close inspection, this appears to affect all tooltips with text short enough that line-wrapping does not happen, with wrapped tooltips looking okay.

Inspecting the code, it appears that when each word is measured, the space between the current word and the next is included in the result.

The solution implemented below deducts the width of the space from the calculated width of the last word in a line where wrapping occurs; then adds the BufferZone variable a second time to give a right as well as a left internal margin.

Test Plan

Confirm it addresses the problem.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

s0600204 created this revision.Feb 13 2018, 6:45 AM
elexis added a subscriber: elexis.Feb 13 2018, 11:10 AM

width not being calculated correctly, the edge case of a line ending with an explicit line break ("\n") has also been fixed.)

Reminds me of #3351

Vulcan added a subscriber: Vulcan.Feb 13 2018, 4:02 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/12/display/redirect

s0600204 updated this revision to Diff 5778.Feb 13 2018, 8:11 PM
s0600204 edited the summary of this revision. (Show Details)

As it appears that the case dealing with explicit line breaks/line breaks needs more attention (with regards to testing beyond use in tooltips), I've moved that change to another revision.

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/14/display/redirect

bb accepted this revision.Feb 14 2018, 10:53 PM
This revision is now accepted and ready to land.Feb 14 2018, 10:53 PM
bb added inline comments.Feb 14 2018, 11:23 PM
source/gui/CGUI.cpp
1 ↗(On Diff #5778)

year

This revision was automatically updated to reflect the committed changes.