Mercurial > hg > octave-nkf
diff libinterp/corefcn/graphics.cc @ 20101:0c32e02d60c3
only save one set of limits on the zoom stack (bug #44304)
* graphics.cc (axes::properties::push_zoom_stack): Only push one set
of limits to the stack. Also store zlim and zlimmode.
(axes::properties::unzoom): Handle zlim and zlimmode.
(axes::properties::clear_zoom_stack): Adjust to new number of elements
stored on the stack.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 02 Mar 2015 23:58:10 -0500 |
parents | e814e202cd84 |
children | 90299974feda |
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc +++ b/libinterp/corefcn/graphics.cc @@ -7677,21 +7677,16 @@ void axes::properties::push_zoom_stack (void) { - // FIXME: Maybe make the size of the undo stack configurable. A limit - // of 500 elements means 100 pan, rotate, or zoom actions are stored - // and may be undone. - - if (zoom_stack.size () >= 500) - { - for (int i = 0; i < 5; i++) - zoom_stack.pop_back (); - } - - zoom_stack.push_front (xlimmode.get ()); - zoom_stack.push_front (xlim.get ()); - zoom_stack.push_front (ylimmode.get ()); - zoom_stack.push_front (ylim.get ()); - zoom_stack.push_front (view.get ()); + if (zoom_stack.empty ()) + { + zoom_stack.push_front (xlimmode.get ()); + zoom_stack.push_front (xlim.get ()); + zoom_stack.push_front (ylimmode.get ()); + zoom_stack.push_front (ylim.get ()); + zoom_stack.push_front (zlimmode.get ()); + zoom_stack.push_front (zlim.get ()); + zoom_stack.push_front (view.get ()); + } } void @@ -7904,11 +7899,17 @@ void axes::properties::unzoom (void) { - if (zoom_stack.size () >= 5) + if (zoom_stack.size () >= 7) { view = zoom_stack.front (); zoom_stack.pop_front (); + zlim = zoom_stack.front (); + zoom_stack.pop_front (); + + zlimmode = zoom_stack.front (); + zoom_stack.pop_front (); + ylim = zoom_stack.front (); zoom_stack.pop_front (); @@ -7925,6 +7926,7 @@ update_xlim (); update_ylim (); + update_zlim (); update_view (); } @@ -7933,7 +7935,7 @@ void axes::properties::clear_zoom_stack (bool do_unzoom) { - size_t items_to_leave_on_stack = do_unzoom ? 5 : 0; + size_t items_to_leave_on_stack = do_unzoom ? 7 : 0; while (zoom_stack.size () > items_to_leave_on_stack) zoom_stack.pop_front ();