Commit 18b9f8194c41fbe9a554d9f8c2433a4a4921adab

Authored by Paulo Henrique Junqueira Amorim
1 parent e43c949b

ENH: Add UnZoom

Showing 1 changed file with 23 additions and 12 deletions   Show diff stats
invesalius/data/viewer_slice.py
... ... @@ -132,8 +132,12 @@ class Viewer(wx.Panel):
132 132 'ZOOM':{
133 133 "MouseMoveEvent": self.OnZoomMove,
134 134 "LeftButtonPressEvent": self.OnZoomClick,
135   - "LeftButtonReleaseEvent": self.OnReleaseModes
136   - }
  135 + "LeftButtonReleaseEvent": self.OnReleaseModes,
  136 + "RightButtonReleaseEvent":self.OnUnZoom
  137 + },
  138 + 'ZOOMSELECT':{
  139 + "RightButtonReleaseEvent":self.OnUnZoom
  140 + }
137 141 }
138 142  
139 143 # Bind method according to current mode
... ... @@ -142,13 +146,13 @@ class Viewer(wx.Panel):
142 146 else:
143 147 style = vtk.vtkInteractorStyleImage()
144 148  
145   - # Check all modes set by user
146   - for mode in self.modes:
147   - # Check each event available for each mode
148   - for event in action[mode]:
149   - # Bind event
150   - style.AddObserver(event,
151   - action[mode][event])
  149 + # Check all modes set by user
  150 + for mode in self.modes:
  151 + # Check each event available for each mode
  152 + for event in action[mode]:
  153 + # Bind event
  154 + style.AddObserver(event,
  155 + action[mode][event])
152 156 self.style = style
153 157 self.interactor.SetInteractorStyle(style)
154 158  
... ... @@ -165,7 +169,8 @@ class Viewer(wx.Panel):
165 169 def ChangeZoomMode(self, pubsub_evt):
166 170 self.append_mode('ZOOM')
167 171 self.mouse_pressed = 0
168   - self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_SIZENS))
  172 + ICON_IMAGE = wx.Image("../icons/tool_zoom.png",wx.BITMAP_TYPE_PNG)
  173 + self.interactor.SetCursor(wx.CursorFromImage(ICON_IMAGE))
169 174  
170 175 def ChangePanMode(self, pubsub_evt):
171 176 self.append_mode('PAN')
... ... @@ -174,7 +179,8 @@ class Viewer(wx.Panel):
174 179  
175 180 def ChangeZoomSelectMode(self, pubsub_evt):
176 181 self.append_mode('ZOOMSELECT')
177   - self.mouse_pressed = 0
  182 + ICON_IMAGE = wx.Image("../icons/tool_zoom.png",wx.BITMAP_TYPE_PNG)
  183 + self.interactor.SetCursor(wx.CursorFromImage(ICON_IMAGE))
178 184  
179 185 def OnPanMove(self, evt, obj):
180 186 if (self.mouse_pressed):
... ... @@ -193,7 +199,12 @@ class Viewer(wx.Panel):
193 199 def OnZoomClick(self, evt, obj):
194 200 self.mouse_pressed = 1
195 201 evt.StartDolly()
196   -
  202 +
  203 + def OnUnZoom(self, evt, obj):
  204 + self.ren.ResetCamera()
  205 + self.ren.ResetCameraClippingRange()
  206 + self.interactor.Render()
  207 +
197 208 def OnSpinMove(self, evt, obj):
198 209 if (self.mouse_pressed):
199 210 evt.Spin()
... ...