diff --git a/invesalius/data/styles.py b/invesalius/data/styles.py index b8b80ad..ad67721 100644 --- a/invesalius/data/styles.py +++ b/invesalius/data/styles.py @@ -251,6 +251,21 @@ class LinearMeasure(ZoomInteractorStyle): Publisher.sendMessage('Update slice viewer') +class PanMoveInteractorStyle(ZoomInteractorStyle): + """ + Interactor style responsible for translate the camera. + """ + def __init__(self): + ZoomInteractorStyle.__init__(self) + self.AddObserver("MouseMoveEvent", self.OnPanMove) + + def OnPanMove(self, obj, evt): + print "PAN" + if self.left_pressed: + obj.Pan() + obj.OnRightButtonDown() + + class AngularMeasure(ZoomInteractorStyle): """ Interactor style responsible for insert angular measurements. diff --git a/invesalius/data/viewer_slice.py b/invesalius/data/viewer_slice.py index e68200e..a8f8710 100755 --- a/invesalius/data/viewer_slice.py +++ b/invesalius/data/viewer_slice.py @@ -217,6 +217,13 @@ class Viewer(wx.Panel): self.interactor.SetInteractorStyle(style) self.interactor.Render() + elif state == const.STATE_PAN: + style = styles.PanMoveInteractorStyle() + + self.style = style + self.interactor.SetInteractorStyle(style) + self.interactor.Render() + else: self.state = state action = { @@ -228,12 +235,6 @@ class Viewer(wx.Panel): "EnterEvent": self.OnEnterInteractor, "LeaveEvent": self.OnLeaveInteractor }, - const.STATE_PAN: - { - "MouseMoveEvent": self.OnPanMove, - "LeftButtonPressEvent": self.OnPanClick, - "LeftButtonReleaseEvent": self.OnVtkRightRelease - }, const.STATE_SPIN: { "MouseMoveEvent": self.OnSpinMove, -- libgit2 0.21.2