TimeViewers / timeview

TimeView
Other
33 stars 7 forks source link

Unexpected mouse scroll behavior #25

Open rcgale opened 6 years ago

rcgale commented 6 years ago

I keep expecting the left/right mouse scroll (I'm using an Apple Magic Mouse) to move left and right, but it zooms instead.

lxkain commented 6 years ago

I wasn't aware of this... that is indeed inconsistent. On a trackpad, using three fingers moves left and right, if that is helpful in any way. Unfortunately I don't think we can easily change this since we are using pyqtgraph as our plotting layer:

http://www.pyqtgraph.org/documentation/mouse_interaction.html

j9ac9k commented 6 years ago

We could implement this, but this was remarkably more difficult to determine how than I thought it would be.

Background information:

We filter for wheel events in plot_area.py here:

    def wheelEvent(self, event: QtGui.QWheelEvent):
        super().wheelEvent(event)
        event.accept()

That means, we intercept the wheel event, and we can redirect as necessary.

Reading on the QWheelEvent docs, there is no property that indicates if the wheel event is horizontal or vertical, but there is the pixelDelta property, which returns a QPoint, and you can query if the wheel event occurs in x or in y (thus determining if it's a horizontal event or not).

I'm going to reopen the issue; but given how I would dive into this, there would be some major testing/vetting needed in order to make sure we're not getting any undesirable side effects.