changeset 31238:67cad4e8f866

Include graphics objects with hidden handles in axes limit calculation (bug #63095). * libinterp/corefcn/graphics.cc (get_children_limits): Get handles to all axes children including those with hidden handle visibility. Add BIST. * libinterp/corefcn/graphics.in.h (text::update_position): Do not automatically change "zliminclude" property. Axes labels are implemented as text objects, and we don't want their extent to be included in the axis limit calculation.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 24 Sep 2022 11:57:44 +0200
parents e3016248ca5d
children dd6b37f67db2
files libinterp/corefcn/graphics.cc libinterp/corefcn/graphics.in.h
diffstat 2 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Wed Sep 21 09:55:32 2022 -0400
+++ b/libinterp/corefcn/graphics.cc	Sat Sep 24 11:57:44 2022 +0200
@@ -8052,6 +8052,21 @@
 %! unwind_protect_cleanup
 %!   delete (hf);
 %! end_unwind_protect
+
+## Check that graphics objects with hidden handle visibility are included in
+## axis limit calculation.
+%!test <*63095>
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   hax = axes ("parent", hf);
+%!   plot (hax, [0, 1]);
+%!   assert (get (hax, "ylim"), [0, 1]);
+%!   hold (hax, "on");
+%!   plot (hax, [2, 0], "handlevisibility", "off");
+%!   assert (get (hax, "ylim"), [0, 2]);
+%! unwind_protect_cleanup
+%!   delete (hf);
+%! end_unwind_protect
 */
 
 void
@@ -8696,7 +8711,7 @@
           != updating_aspectratios.end ()))
     return;
 
-  Matrix kids = m_properties.get_children ();
+  Matrix kids = m_properties.get_all_children ();
 
   double min_val = octave::numeric_limits<double>::Inf ();
   double max_val = -octave::numeric_limits<double>::Inf ();
--- a/libinterp/corefcn/graphics.in.h	Wed Sep 21 09:55:32 2022 -0400
+++ b/libinterp/corefcn/graphics.in.h	Sat Sep 24 11:57:44 2022 +0200
@@ -4641,11 +4641,8 @@
                                 : lim(2));
           lim(3) = (lim(3) >= 0 ? -octave::numeric_limits<double>::Inf ()
                                 : lim(3));
-          set_zliminclude ("on");
           set_zlim (lim);
         }
-      else
-        set_zliminclude ("off");
     }
 
     OCTINTERP_API void request_autopos (void);