bugGNU Octave - Bugs: bug #52588, Crazy Scrolling in imagesc

 
 

bug #52588: Crazy Scrolling in imagesc

Submitter:  None
Submitted:  Tue 05 Dec 2017 10:33:49 AM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.2.1
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 07 Dec 2017 01:09:35 AM UTC, comment #5: 

@Pantxo: Awesome, that was quick work.  I applied the patch to the stable branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/708b98b4cdd1).

This will be a part of the 4.2.2 bug fix release expected by the end of the year.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Wed 06 Dec 2017 01:00:36 PM UTC, comment #4: 

I attached a patch that implements the behavior described in comment #1.

(file #42582)

Pantxo Diribarne <pantxo>
Group Member
Tue 05 Dec 2017 11:36:01 PM UTC, comment #3: 

Note that FLTK is a little more similar to gnuplot toolkit in terms of zooming and panning, except the FLTK toolkit has panning via click-drag while gnuplot doesn't.  (gnuplot has a zoom feature .)

Furthermore, for the Qt and FLTK toolkits the plot space can be rotated for which the image object does not rotate but merely scales and interferes with the plot background surface.  That looks very odd, but I'm sure rotated images in OpenGL wouldn't be a simple feature to add.  gnuplot has a feature (not utilized in Octave, I believe) for which images can be rotated in 3D space (see last example here):

http://gnuplot.sourceforge.net/demo_5.1/image2.html

My memory is that if there isn't some underlying support for rotated images in the library/platform selected, gnuplot will attempt drawing pixels as parallelograms using the polygon feature, a method that is much, much slower but works.

Dan Sebald <sebald>
Tue 05 Dec 2017 06:18:51 PM UTC, comment #2: 

Confirmed.  I agree with Pantxo that Octave should use a normal convention, like graphics programs, for what happens when pan mode is on.

Check out the pan() command.  It is possible to set the pan mode to x-only, y-only, or both.  The default, when the user selects pan, is for panning in both x and y directions to be allowed.  I think what is happening is that when the mouse wheel is used, the code checks the pan mode.  It sees that both pan-x and pan-y are on, and so it increments both (for wheel up) which produces a panning along the diagonal.  Probably just need a test for whether the SHIFT key is pressed.

The code is in libgui/graphics/Canvas.cc.  The callback routine is


  Canvas::canvasWheelEvent (QWheelEvent *event)


The actual case in the switch statement is at line 982.


              case PanMode:
                {
                  axes::properties& ap = Utils::properties<axes> (axesObj);

                  double factor = (event->delta () > 0 ? 0.1 : -0.1);

                  ap.pan (mode, factor);
                }
                break;


In pseudo-code, what has to happen is


  if (NO_MODIFIER_KEY)
    {
      if (PAN_MODE includes Y-panning)  // don't y-pan if it is disabled
        ap.pan (Y-PAN MODE ENUM, factor);
    }
  else if (SHIFT_MODIFIER_KEY)
    {
      if (PAN_MODE includes X-panning)  // don't x-pan if it is disabled
        ap.pan (X-PAN MODE ENUM, factor);
    }



Rik <rik5>
Group administrator
Tue 05 Dec 2017 02:06:22 PM UTC, comment #1: 

Here is what I observe with Qt toolkit:

  • pan tool enabled (crossing arrows button): the image is moved along the xmin-ymin/xmax-ymax diagonal (as explained by the OP)
  • zoom-in or zoom-out tool enabled: scrolling up is equivalent to zoom-in, scrolling down is equivalent to zoom-out


The latter is pretty much what I would expect (and what Gnuplot does if you add the CTRL key modifier), while the former is counter-intuitive. Maybe, in pan mode, scrolling could move up/down without modifier key and right/left with SHIFT modifier? That is what many drawing applications do and what Gnuplot does also.

Pantxo Diribarne <pantxo>
Group Member
Tue 05 Dec 2017 10:33:49 AM UTC, original submission:  

If an image is shown in a Figure with imagesc an one uses the scroll wheel, the image moves diagonally from top left to bottom right an vise versa. The same happens if you push the scroll wheel to the left or right.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #42582:  pan.patch added by pantxo (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by sebald (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-12-07 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2017-12-06 pantxo Attached File- Added pan.patch, #42582
        StatusConfirmed Patch Submitted
    2017-12-05 pantxo CategoryPlotting Plotting with OpenGL
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code