Mercurial > hg > octave-avbm
changeset 14325:a646cee995cf stable
disable zoom-box zooming for negative log scales; enable zooming for positive log scales
* graphics.cc (axes::properties::zoom): Disable zooming if either
axis is log and negative.
(axes::properties::zoom_about_point): Enable zooming for positive log
scale axes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 04 Feb 2012 10:29:50 -0500 |
parents | 45f5a5d5656f |
children | 63f1bdf08339 4d917a6a858b |
files | src/graphics.cc |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -6463,10 +6463,10 @@ double max_neg_y = -octave_Inf; get_children_limits (miny, maxy, min_pos_y, max_neg_y, kids, 'y'); - if (! xscale_is ("log")) + if (! (xscale_is ("log") && xlims(0) < 0 && xlims(1) < 0)) xlims = do_zoom (x, factor, xlims, xscale_is ("log")); - if (! yscale_is ("log")) + if (! (yscale_is ("log") && ylims(0) < 0 && ylims(1) < 0)) ylims = do_zoom (y, factor, ylims, yscale_is ("log")); zoom (xlims, ylims, push_to_zoom_stack); @@ -6475,6 +6475,14 @@ void axes::properties::zoom (const Matrix& xl, const Matrix& yl, bool push_to_zoom_stack) { + // FIXME: Do we need error checking here? + Matrix xlims = get_xlim ().matrix_value (); + Matrix ylims = get_ylim ().matrix_value (); + + if ((xscale_is ("log") && xlims(0) < 0 && xlims(1) < 0) + || (yscale_is ("log") && ylims(0) < 0 && ylims(1) < 0)) + return; + if (push_to_zoom_stack) { zoom_stack.push_front (xlimmode.get ());