octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #51645] zoom to singular region dumps core


From: Rik
Subject: [Octave-bug-tracker] [bug #51645] zoom to singular region dumps core
Date: Fri, 4 Aug 2017 20:38:56 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0

Follow-up Comment #6, bug #51645 (project octave):

The patch seems to work, but I also am able to trigger the warning on what I
believe is acceptable behavior.

A single click should cause a zoom in action.  If I click once and then
rapidly move the mouse to a new point, and click again, and move to a new
point, and click again then I can usually provoke a warning message.  It seems
about every 3 or 4 clicks I get the message.

Maybe the issue is back in the Qt handling of the ButtonUp event in Canvas.cc


  void
  Canvas::canvasMouseReleaseEvent (QMouseEvent *event)
  {
    if ((m_mouseMode == ZoomInMode || m_mouseMode == ZoomOutMode)
        && m_mouseAxes.ok ())
      {
        gh_manager::auto_lock lock;
        graphics_object ax = gh_manager::get_object (m_mouseAxes);

        if (ax.valid_object ())
          {
            axes::properties& ap = Utils::properties<axes> (ax);

            graphics_object obj = gh_manager::get_object (m_handle);

            graphics_object figObj (obj.get_ancestor ("figure"));

            std::string zm = zoom_mode (figObj);

            if (m_mouseAnchor == event->pos ())
              {
                double factor = (m_clickMode ? 2.0 : 0.5);

                ColumnVector p1 = ap.pixel2coord (event->x (), event->y ());

                ap.zoom_about_point (zm, p1(0), p1(1), factor);
              }
            else if (m_mouseMode == ZoomInMode)
              {
                ColumnVector p0 = ap.pixel2coord (m_mouseAnchor.x (),
                                                  m_mouseAnchor.y ());
                ColumnVector p1 = ap.pixel2coord (event->x (),
                                                  event->y ());

                Matrix xl (1, 2, 0.0);
                Matrix yl (1, 2, 0.0);

                xl(0) = std::min (p0(0), p1(0));
                xl(1) = std::max (p0(0), p1(0));
                yl(0) = std::min (p0(1), p1(1));
                yl(1) = std::max (p0(1), p1(1));

                ap.zoom (zm, xl, yl);
              }

            redraw (false);
          }
      }


Maybe the same test should be moved here and if one of the dimensions is 0,
then the behavior for a single button press is used (the code for
m_mouseAnchor == event->pos).



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51645>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]