Commit 372512ae800de73515421d7021f9458c99767424
1 parent
2cd86549
Exists in
master
and in
6 other branches
ADD: Brush operation while clicking (despite moving)
Showing
1 changed file
with
22 additions
and
3 deletions
Show diff stats
invesalius/data/viewer_slice.py
@@ -172,8 +172,27 @@ class Viewer(wx.Panel): | @@ -172,8 +172,27 @@ class Viewer(wx.Panel): | ||
172 | 172 | ||
173 | def OnBrushClick(self, obj, evt_vtk): | 173 | def OnBrushClick(self, obj, evt_vtk): |
174 | self.mouse_pressed = 1 | 174 | self.mouse_pressed = 1 |
175 | - coord = self.GetCoordinate() | ||
176 | - print "Edit pixel region based on origin:", coord | 175 | + |
176 | + | ||
177 | + coord = self.GetCoordinateCursor() | ||
178 | + self.cursor.SetPosition(coord) | ||
179 | + self.cursor.SetEditionPosition(self.GetCoordinateCursorEdition()) | ||
180 | + self.__update_cursor_position(coord) | ||
181 | + self.ren.Render() | ||
182 | + | ||
183 | + if self._brush_cursor_op == 'Erase': | ||
184 | + evt_msg = 'Erase mask pixel' | ||
185 | + elif self._brush_cursor_op == 'Draw': | ||
186 | + evt_msg = 'Add mask pixel' | ||
187 | + elif self._brush_cursor_op == 'Threshold': | ||
188 | + evt_msg = 'Edit mask pixel' | ||
189 | + | ||
190 | + pixels = self.cursor.GetPixels() | ||
191 | + for coord in pixels: | ||
192 | + ps.Publisher().sendMessage(evt_msg, coord) | ||
193 | + | ||
194 | + self.OnCrossMove(None, None) | ||
195 | + | ||
177 | 196 | ||
178 | def OnBrushMove(self, obj, evt_vtk): | 197 | def OnBrushMove(self, obj, evt_vtk): |
179 | coord = self.GetCoordinateCursor() | 198 | coord = self.GetCoordinateCursor() |
@@ -190,11 +209,11 @@ class Viewer(wx.Panel): | @@ -190,11 +209,11 @@ class Viewer(wx.Panel): | ||
190 | evt_msg = 'Edit mask pixel' | 209 | evt_msg = 'Edit mask pixel' |
191 | 210 | ||
192 | if self.mouse_pressed: | 211 | if self.mouse_pressed: |
193 | - print "Edit pixel region based on origin:", coord | ||
194 | pixels = self.cursor.GetPixels() | 212 | pixels = self.cursor.GetPixels() |
195 | for coord in pixels: | 213 | for coord in pixels: |
196 | ps.Publisher().sendMessage(evt_msg, coord) | 214 | ps.Publisher().sendMessage(evt_msg, coord) |
197 | self.interactor.Render() | 215 | self.interactor.Render() |
216 | + | ||
198 | 217 | ||
199 | def OnCrossMove(self, obj, evt_vtk): | 218 | def OnCrossMove(self, obj, evt_vtk): |
200 | coord = self.GetCoordinate() | 219 | coord = self.GetCoordinate() |