From 87eacea8d9d7b2a460a8156b45c372fa8d6a32f4 Mon Sep 17 00:00:00 2001 From: Thiago Franco de Moraes Date: Fri, 22 Mar 2013 16:53:16 -0300 Subject: [PATCH] Created a new interactor style to the pan --- invesalius/data/styles.py | 15 +++++++++++++++ invesalius/data/viewer_slice.py | 13 +++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) 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