Mercurial > hg > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
20100:fa290c42197e | 20101:0c32e02d60c3 |
---|---|
7675 } | 7675 } |
7676 | 7676 |
7677 void | 7677 void |
7678 axes::properties::push_zoom_stack (void) | 7678 axes::properties::push_zoom_stack (void) |
7679 { | 7679 { |
7680 // FIXME: Maybe make the size of the undo stack configurable. A limit | 7680 if (zoom_stack.empty ()) |
7681 // of 500 elements means 100 pan, rotate, or zoom actions are stored | 7681 { |
7682 // and may be undone. | 7682 zoom_stack.push_front (xlimmode.get ()); |
7683 | 7683 zoom_stack.push_front (xlim.get ()); |
7684 if (zoom_stack.size () >= 500) | 7684 zoom_stack.push_front (ylimmode.get ()); |
7685 { | 7685 zoom_stack.push_front (ylim.get ()); |
7686 for (int i = 0; i < 5; i++) | 7686 zoom_stack.push_front (zlimmode.get ()); |
7687 zoom_stack.pop_back (); | 7687 zoom_stack.push_front (zlim.get ()); |
7688 } | 7688 zoom_stack.push_front (view.get ()); |
7689 | 7689 } |
7690 zoom_stack.push_front (xlimmode.get ()); | |
7691 zoom_stack.push_front (xlim.get ()); | |
7692 zoom_stack.push_front (ylimmode.get ()); | |
7693 zoom_stack.push_front (ylim.get ()); | |
7694 zoom_stack.push_front (view.get ()); | |
7695 } | 7690 } |
7696 | 7691 |
7697 void | 7692 void |
7698 axes::properties::zoom (const std::string& mode, | 7693 axes::properties::zoom (const std::string& mode, |
7699 const Matrix& xl, const Matrix& yl, | 7694 const Matrix& xl, const Matrix& yl, |
7902 } | 7897 } |
7903 | 7898 |
7904 void | 7899 void |
7905 axes::properties::unzoom (void) | 7900 axes::properties::unzoom (void) |
7906 { | 7901 { |
7907 if (zoom_stack.size () >= 5) | 7902 if (zoom_stack.size () >= 7) |
7908 { | 7903 { |
7909 view = zoom_stack.front (); | 7904 view = zoom_stack.front (); |
7910 zoom_stack.pop_front (); | 7905 zoom_stack.pop_front (); |
7911 | 7906 |
7907 zlim = zoom_stack.front (); | |
7908 zoom_stack.pop_front (); | |
7909 | |
7910 zlimmode = zoom_stack.front (); | |
7911 zoom_stack.pop_front (); | |
7912 | |
7912 ylim = zoom_stack.front (); | 7913 ylim = zoom_stack.front (); |
7913 zoom_stack.pop_front (); | 7914 zoom_stack.pop_front (); |
7914 | 7915 |
7915 ylimmode = zoom_stack.front (); | 7916 ylimmode = zoom_stack.front (); |
7916 zoom_stack.pop_front (); | 7917 zoom_stack.pop_front (); |
7923 | 7924 |
7924 update_transform (); | 7925 update_transform (); |
7925 | 7926 |
7926 update_xlim (); | 7927 update_xlim (); |
7927 update_ylim (); | 7928 update_ylim (); |
7929 update_zlim (); | |
7928 | 7930 |
7929 update_view (); | 7931 update_view (); |
7930 } | 7932 } |
7931 } | 7933 } |
7932 | 7934 |
7933 void | 7935 void |
7934 axes::properties::clear_zoom_stack (bool do_unzoom) | 7936 axes::properties::clear_zoom_stack (bool do_unzoom) |
7935 { | 7937 { |
7936 size_t items_to_leave_on_stack = do_unzoom ? 5 : 0; | 7938 size_t items_to_leave_on_stack = do_unzoom ? 7 : 0; |
7937 | 7939 |
7938 while (zoom_stack.size () > items_to_leave_on_stack) | 7940 while (zoom_stack.size () > items_to_leave_on_stack) |
7939 zoom_stack.pop_front (); | 7941 zoom_stack.pop_front (); |
7940 | 7942 |
7941 if (do_unzoom) | 7943 if (do_unzoom) |