diff --git a/invesalius/data/styles.py b/invesalius/data/styles.py index f06f5d7..cfbc000 100644 --- a/invesalius/data/styles.py +++ b/invesalius/data/styles.py @@ -368,6 +368,23 @@ class ZoomInteractorStyle(RightZoomInteractorStyle): self.viewer.interactor.Render() +class ZoomSLInteractorStyle(vtk.vtkInteractorStyleRubberBandZoom): + """ + Interactor style responsible for zoom by selecting a region. + """ + def __init__(self, viewer): + self.viewer = viewer + self.viewer.interactor.Bind(wx.EVT_LEFT_DCLICK, self.OnUnZoom) + + def OnUnZoom(self, evt): + mouse_x, mouse_y = self.viewer.interactor.GetLastEventPosition() + ren = self.viewer.interactor.FindPokedRenderer(mouse_x, mouse_y) + #slice_data = self.get_slice_data(ren) + ren.ResetCamera() + ren.ResetCameraClippingRange() + #self.Reposition(slice_data) + self.viewer.interactor.Render() + class ViewerStyle: def __init__(self): self.interactor = None diff --git a/invesalius/data/viewer_slice.py b/invesalius/data/viewer_slice.py index b7a177e..2ab20b5 100755 --- a/invesalius/data/viewer_slice.py +++ b/invesalius/data/viewer_slice.py @@ -238,6 +238,13 @@ class Viewer(wx.Panel): self.interactor.SetInteractorStyle(style) self.interactor.Render() + elif state == const.STATE_ZOOM_SL: + style = styles.ZoomSLInteractorStyle(self) + + self.style = style + self.interactor.SetInteractorStyle(style) + self.interactor.Render() + else: self.state = state action = { -- libgit2 0.21.2