Skip to content

Commit

Permalink
Make it work without a plot backend
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 committed Jul 10, 2023
1 parent ea40072 commit 385236d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/silx/gui/plot/PlotInteraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,10 @@ def __init__(self, *args, **kw):
self._hoverMarker = None

def enterState(self):
plot = self.machine.plot
position = plot.getWidgetHandle().mapFromGlobal(qt.QCursor.pos())
widget = self.machine.plot.getWidgetHandle()
if widget is None or not widget.isVisible():
return
position = widget.mapFromGlobal(qt.QCursor.pos())
self.onMove(position.x(), position.y())

def onMove(self, x, y):
Expand Down Expand Up @@ -1342,7 +1344,10 @@ def endDrag(self, startPos, endPos, btn):

def cancel(self):
self._pan.cancel()
position = self.plot.getWidgetHandle().mapFromGlobal(qt.QCursor.pos())
widget = self.plot.getWidgetHandle()
if widget is None or not widget.isVisible():
return
position = widget.mapFromGlobal(qt.QCursor.pos())
self.__terminateDrag(position.x(), position.y())


Expand Down

0 comments on commit 385236d

Please sign in to comment.