changeset 26228:4f044bc43f07

legend.m: Space out legend objects 1/3 of a point more in x-direction (bug #55189). * legend.m: Add 1/3 to xpad variable which determines padding in x-direction.
author Rik <rik@octave.org>
date Thu, 13 Dec 2018 14:53:47 -0800
parents 2355f66cf91d
children 3af4f3e2dae8
files scripts/plot/appearance/legend.m
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/legend.m	Thu Dec 13 21:53:32 2018 +0100
+++ b/scripts/plot/appearance/legend.m	Thu Dec 13 14:53:47 2018 -0800
@@ -570,7 +570,10 @@
       end_unwind_protect
 
       ## Padding between legend entries horizontally and vertically
-      xpad = 2;
+      ## measured in points.
+      ## FIXME: 3*xpad must be integer or strange off-by-1 pixel issues
+      ##        with lines in OpenGL.
+      xpad = 2 + 1/3;
       ypad = 4;
 
       linelength = 15;
@@ -704,6 +707,7 @@
         endif
         num2 = ceil (nentries / num1);
 
+        ## Layout is [xpad, linelength, xpad, maxwidth, xpad]
         xstep = 3 * xpad + (maxwidth + linelength);
         if (strcmp (textpos, "right"))
           xoffset = xpad;
@@ -877,6 +881,7 @@
               style = get (hplt, "linestyle");
               lwidth = min (get (hplt, "linewidth"), 5);
               if (! strcmp (style, "none"))
+                #keyboard;
                 l1 = __go_line__ (hlegend, ...
                        "xdata", ([xoffset, xoffset + linelength] + xk * xstep) / lpos(3), ...
                        "ydata", [1, 1] .* (lpos(4) - yoffset - yk * ystep) / lpos(4), ...