comparison libinterp/corefcn/graphics.in.h @ 19712:c17e1cefdbd3

Fix reordering graphics property children for hidden objects (bug #44211) * graphics.in.h (children_property::do_set): check if children also list contains hidden chidren.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sun, 08 Feb 2015 18:40:00 +0100
parents e7df12f37f71
children 2b93834e5ede
comparison
equal deleted inserted replaced
19711:0f557da98f5b 19712:c17e1cefdbd3
1714 octave_idx_type nel = new_kids.numel (); 1714 octave_idx_type nel = new_kids.numel ();
1715 1715
1716 const Matrix new_kids_column = new_kids.reshape (dim_vector (nel, 1)); 1716 const Matrix new_kids_column = new_kids.reshape (dim_vector (nel, 1));
1717 1717
1718 bool is_ok = true; 1718 bool is_ok = true;
1719 bool add_hidden = true;
1719 1720
1720 if (! error_state) 1721 if (! error_state)
1721 { 1722 {
1722 const Matrix visible_kids = do_get_children (false); 1723 const Matrix visible_kids = do_get_children (false);
1723 1724
1724 if (visible_kids.numel () == new_kids.numel ()) 1725 if (visible_kids.numel () == new_kids.numel ())
1725 { 1726 {
1726 Matrix t1 = visible_kids.sort (); 1727 Matrix t1 = visible_kids.sort ();
1727 Matrix t2 = new_kids_column.sort (); 1728 Matrix t2 = new_kids_column.sort ();
1729 Matrix t3 = get_hidden ().sort ();
1728 1730
1729 if (t1 != t2) 1731 if (t1 != t2)
1730 is_ok = false; 1732 is_ok = false;
1733
1734 if (t1 == t3)
1735 add_hidden = false;
1731 } 1736 }
1732 else 1737 else
1733 is_ok = false; 1738 is_ok = false;
1734 1739
1735 if (! is_ok) 1740 if (! is_ok)
1741 error ("set: expecting children to be array of graphics handles"); 1746 error ("set: expecting children to be array of graphics handles");
1742 } 1747 }
1743 1748
1744 if (is_ok) 1749 if (is_ok)
1745 { 1750 {
1746 Matrix tmp = new_kids_column.stack (get_hidden ()); 1751 Matrix tmp = new_kids_column;
1752
1753 if (add_hidden)
1754 tmp.stack (get_hidden ());
1747 1755
1748 children_list.clear (); 1756 children_list.clear ();
1749 1757
1750 // Don't use do_init_children here, as that reverses the 1758 // Don't use do_init_children here, as that reverses the
1751 // order of the list, and we don't want to do that if setting 1759 // order of the list, and we don't want to do that if setting