changeset 26317:7902a3a8f02c

maint: merge stable to default.
author Rik <rik@octave.org>
date Fri, 28 Dec 2018 22:05:27 -0800
parents c4ad9ad970a9 (current diff) 522a70bb738f (diff)
children cb96d4ba6daa
files libinterp/corefcn/graphics.cc
diffstat 3 files changed, 62 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Fri Dec 28 13:58:57 2018 -0800
+++ b/libinterp/corefcn/graphics.cc	Fri Dec 28 22:05:27 2018 -0800
@@ -5533,11 +5533,32 @@
 axes::properties::adopt (const graphics_handle& h)
 {
   graphics_object go (gh_manager::get_object (h));
+
   if (go.isa ("light") && go.get_properties ().is_visible ())
     increase_num_lights ();
 
   base_properties::adopt (h);
 
+  // FIXME: For performance reasons, we would like to call
+  //          update_axis_limits ("xlim", h);
+  //        which updates the limits based ONLY on the new data from h.
+  //        But this isn't working properly at the moment, so we
+  //        call the other form which invokes a full tree traversal of all
+  //        of the axes children.
+  if (xlimmode_is ("auto"))
+    update_axis_limits ("xlim");
+
+  if (ylimmode_is ("auto"))
+    update_axis_limits ("ylim");
+
+  if (zlimmode_is ("auto"))
+    update_axis_limits ("zlim");
+
+  if (climmode_is ("auto"))
+    update_axis_limits ("clim");
+
+  if (climmode_is ("auto"))
+    update_axis_limits ("alim");
 }
 
 inline Matrix
@@ -12455,8 +12476,6 @@
              go_name.c_str ());
     }
 
-  adopt (parent, h);
-
   try
     {
       xset (h, xargs);
@@ -12468,6 +12487,8 @@
              go_name.c_str ());
     }
 
+  adopt (parent, h);
+
   xcreatefcn (h);
   xinitialize (h);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-55321/bug-55321.tst	Fri Dec 28 22:05:27 2018 -0800
@@ -0,0 +1,35 @@
+## Copyright (C) 2018 Rik Wehbring
+##
+## This file is part of Octave.
+##
+## Octave is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <https://www.gnu.org/licenses/>.
+
+%!function cb_children (hg)
+%!  hl = get (hg, "children");
+%!  color = get (hl, "color");
+%!  set (hl, "userdata", isequal (color, [1 0 0]));
+%!endfunction
+
+%!test
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   hax = axes ("parent", hf);
+%!   hg = hggroup ();
+%!   addlistener (hg, "children", @cb_children);
+%!   hl = line ([0, 1], [1, 1], "color", "r", "parent", hg);
+%!   assert (get (hl, "userdata"), true);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-55321/module.mk	Fri Dec 28 22:05:27 2018 -0800
@@ -0,0 +1,4 @@
+bug_55321_TEST_FILES = \
+  %reldir%/bug-55321.tst
+
+TEST_FILES += $(bug_55321_TEST_FILES)