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 | 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 | 269 | class AngularMeasure(ZoomInteractorStyle): |
255 | 270 | """ |
256 | 271 | Interactor style responsible for insert angular measurements. | ... | ... |
invesalius/data/viewer_slice.py
... | ... | @@ -217,6 +217,13 @@ class Viewer(wx.Panel): |
217 | 217 | self.interactor.SetInteractorStyle(style) |
218 | 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 | 227 | else: |
221 | 228 | self.state = state |
222 | 229 | action = { |
... | ... | @@ -228,12 +235,6 @@ class Viewer(wx.Panel): |
228 | 235 | "EnterEvent": self.OnEnterInteractor, |
229 | 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 | 238 | const.STATE_SPIN: |
238 | 239 | { |
239 | 240 | "MouseMoveEvent": self.OnSpinMove, | ... | ... |