comparison libinterp/corefcn/graphics.cc @ 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 670a0d878af1
children 332a6ccac881
comparison
equal deleted inserted replaced
31237:e3016248ca5d 31238:67cad4e8f866
8050 %! assert (get (hax, "xlim"), [0.9, 1.1]); 8050 %! assert (get (hax, "xlim"), [0.9, 1.1]);
8051 %! assert (get (hax, "ylim"), [1, pi]); 8051 %! assert (get (hax, "ylim"), [1, pi]);
8052 %! unwind_protect_cleanup 8052 %! unwind_protect_cleanup
8053 %! delete (hf); 8053 %! delete (hf);
8054 %! end_unwind_protect 8054 %! end_unwind_protect
8055
8056 ## Check that graphics objects with hidden handle visibility are included in
8057 ## axis limit calculation.
8058 %!test <*63095>
8059 %! hf = figure ("visible", "off");
8060 %! unwind_protect
8061 %! hax = axes ("parent", hf);
8062 %! plot (hax, [0, 1]);
8063 %! assert (get (hax, "ylim"), [0, 1]);
8064 %! hold (hax, "on");
8065 %! plot (hax, [2, 0], "handlevisibility", "off");
8066 %! assert (get (hax, "ylim"), [0, 2]);
8067 %! unwind_protect_cleanup
8068 %! delete (hf);
8069 %! end_unwind_protect
8055 */ 8070 */
8056 8071
8057 void 8072 void
8058 axes::properties::calc_ticks_and_lims (array_property& lims, 8073 axes::properties::calc_ticks_and_lims (array_property& lims,
8059 array_property& ticks, 8074 array_property& ticks,
8694 != updating_axis_limits.end ()) 8709 != updating_axis_limits.end ())
8695 || (updating_aspectratios.find (get_handle ().value ()) 8710 || (updating_aspectratios.find (get_handle ().value ())
8696 != updating_aspectratios.end ())) 8711 != updating_aspectratios.end ()))
8697 return; 8712 return;
8698 8713
8699 Matrix kids = m_properties.get_children (); 8714 Matrix kids = m_properties.get_all_children ();
8700 8715
8701 double min_val = octave::numeric_limits<double>::Inf (); 8716 double min_val = octave::numeric_limits<double>::Inf ();
8702 double max_val = -octave::numeric_limits<double>::Inf (); 8717 double max_val = -octave::numeric_limits<double>::Inf ();
8703 double min_pos = octave::numeric_limits<double>::Inf (); 8718 double min_pos = octave::numeric_limits<double>::Inf ();
8704 double max_neg = -octave::numeric_limits<double>::Inf (); 8719 double max_neg = -octave::numeric_limits<double>::Inf ();