Commit 87eacea8d9d7b2a460a8156b45c372fa8d6a32f4
1 parent
fd616666
Exists in
interactor_style
Created a new interactor style to the pan
Showing
2 changed files
with
22 additions
and
6 deletions
Show diff stats
invesalius/data/styles.py
| @@ -251,6 +251,21 @@ class LinearMeasure(ZoomInteractorStyle): | @@ -251,6 +251,21 @@ class LinearMeasure(ZoomInteractorStyle): | ||
| 251 | Publisher.sendMessage('Update slice viewer') | 251 | Publisher.sendMessage('Update slice viewer') |
| 252 | 252 | ||
| 253 | 253 | ||
| 254 | +class PanMoveInteractorStyle(ZoomInteractorStyle): | ||
| 255 | + """ | ||
| 256 | + Interactor style responsible for translate the camera. | ||
| 257 | + """ | ||
| 258 | + def __init__(self): | ||
| 259 | + ZoomInteractorStyle.__init__(self) | ||
| 260 | + self.AddObserver("MouseMoveEvent", self.OnPanMove) | ||
| 261 | + | ||
| 262 | + def OnPanMove(self, obj, evt): | ||
| 263 | + print "PAN" | ||
| 264 | + if self.left_pressed: | ||
| 265 | + obj.Pan() | ||
| 266 | + obj.OnRightButtonDown() | ||
| 267 | + | ||
| 268 | + | ||
| 254 | class AngularMeasure(ZoomInteractorStyle): | 269 | class AngularMeasure(ZoomInteractorStyle): |
| 255 | """ | 270 | """ |
| 256 | Interactor style responsible for insert angular measurements. | 271 | Interactor style responsible for insert angular measurements. |
invesalius/data/viewer_slice.py
| @@ -217,6 +217,13 @@ class Viewer(wx.Panel): | @@ -217,6 +217,13 @@ class Viewer(wx.Panel): | ||
| 217 | self.interactor.SetInteractorStyle(style) | 217 | self.interactor.SetInteractorStyle(style) |
| 218 | self.interactor.Render() | 218 | self.interactor.Render() |
| 219 | 219 | ||
| 220 | + elif state == const.STATE_PAN: | ||
| 221 | + style = styles.PanMoveInteractorStyle() | ||
| 222 | + | ||
| 223 | + self.style = style | ||
| 224 | + self.interactor.SetInteractorStyle(style) | ||
| 225 | + self.interactor.Render() | ||
| 226 | + | ||
| 220 | else: | 227 | else: |
| 221 | self.state = state | 228 | self.state = state |
| 222 | action = { | 229 | action = { |
| @@ -228,12 +235,6 @@ class Viewer(wx.Panel): | @@ -228,12 +235,6 @@ class Viewer(wx.Panel): | ||
| 228 | "EnterEvent": self.OnEnterInteractor, | 235 | "EnterEvent": self.OnEnterInteractor, |
| 229 | "LeaveEvent": self.OnLeaveInteractor | 236 | "LeaveEvent": self.OnLeaveInteractor |
| 230 | }, | 237 | }, |
| 231 | - const.STATE_PAN: | ||
| 232 | - { | ||
| 233 | - "MouseMoveEvent": self.OnPanMove, | ||
| 234 | - "LeftButtonPressEvent": self.OnPanClick, | ||
| 235 | - "LeftButtonReleaseEvent": self.OnVtkRightRelease | ||
| 236 | - }, | ||
| 237 | const.STATE_SPIN: | 238 | const.STATE_SPIN: |
| 238 | { | 239 | { |
| 239 | "MouseMoveEvent": self.OnSpinMove, | 240 | "MouseMoveEvent": self.OnSpinMove, |