Commit 827aff91ea7783327680686dc5d5a47f14df59c1
1 parent
897031ca
Exists in
master
and in
67 other branches
FIX: The edition was not applied when the user edits a slice and scrolls without…
… release the mouse button
Showing
1 changed file
with
12 additions
and
1 deletions
Show diff stats
invesalius/data/viewer_slice.py
... | ... | @@ -100,6 +100,7 @@ class Viewer(wx.Panel): |
100 | 100 | self.__bind_events_wx() |
101 | 101 | |
102 | 102 | self._warped = False |
103 | + self._flush_buffer = False | |
103 | 104 | |
104 | 105 | def __init_gui(self): |
105 | 106 | self.interactor = wxVTKRenderWindowInteractor(self, -1, size=self.GetSize()) |
... | ... | @@ -740,6 +741,7 @@ class Viewer(wx.Panel): |
740 | 741 | |
741 | 742 | self.slice_.edit_mask_pixel(self._brush_cursor_op, cursor.GetPixels(), |
742 | 743 | position, radius, self.orientation) |
744 | + self._flush_buffer = True | |
743 | 745 | |
744 | 746 | # TODO: To create a new function to reload images to viewer. |
745 | 747 | self.OnScrollBar() |
... | ... | @@ -783,7 +785,6 @@ class Viewer(wx.Panel): |
783 | 785 | |
784 | 786 | self.slice_.edit_mask_pixel(self._brush_cursor_op, cursor.GetPixels(), |
785 | 787 | position, radius, self.orientation) |
786 | - | |
787 | 788 | # TODO: To create a new function to reload images to viewer. |
788 | 789 | self.OnScrollBar(update3D=False) |
789 | 790 | |
... | ... | @@ -792,6 +793,7 @@ class Viewer(wx.Panel): |
792 | 793 | |
793 | 794 | def OnBrushRelease(self, evt, obj): |
794 | 795 | self.slice_.apply_slice_buffer_to_mask(self.orientation) |
796 | + self._flush_buffer = False | |
795 | 797 | |
796 | 798 | def OnCrossMouseClick(self, evt, obj): |
797 | 799 | self.ChangeCrossPosition() |
... | ... | @@ -1361,6 +1363,8 @@ class Viewer(wx.Panel): |
1361 | 1363 | else: |
1362 | 1364 | self.interactor.Render() |
1363 | 1365 | if evt: |
1366 | + if self._flush_buffer: | |
1367 | + self.slice_.apply_slice_buffer_to_mask(self.orientation) | |
1364 | 1368 | evt.Skip() |
1365 | 1369 | |
1366 | 1370 | def OnScrollBarRelease(self, evt): |
... | ... | @@ -1373,6 +1377,9 @@ class Viewer(wx.Panel): |
1373 | 1377 | min = 0 |
1374 | 1378 | max = self.slice_.GetMaxSliceNumber(self.orientation) |
1375 | 1379 | |
1380 | + if self._flush_buffer: | |
1381 | + self.slice_.apply_slice_buffer_to_mask(self.orientation) | |
1382 | + | |
1376 | 1383 | if (evt.GetKeyCode() == wx.WXK_UP and pos > min): |
1377 | 1384 | self.OnScrollForward() |
1378 | 1385 | self.OnScrollBar() |
... | ... | @@ -1392,6 +1399,8 @@ class Viewer(wx.Panel): |
1392 | 1399 | min = 0 |
1393 | 1400 | |
1394 | 1401 | if(pos > min): |
1402 | + if self._flush_buffer: | |
1403 | + self.slice_.apply_slice_buffer_to_mask(self.orientation) | |
1395 | 1404 | pos = pos - 1 |
1396 | 1405 | self.scroll.SetThumbPosition(pos) |
1397 | 1406 | self.OnScrollBar() |
... | ... | @@ -1401,6 +1410,8 @@ class Viewer(wx.Panel): |
1401 | 1410 | max = self.slice_.GetMaxSliceNumber(self.orientation) |
1402 | 1411 | |
1403 | 1412 | if(pos < max): |
1413 | + if self._flush_buffer: | |
1414 | + self.slice_.apply_slice_buffer_to_mask(self.orientation) | |
1404 | 1415 | pos = pos + 1 |
1405 | 1416 | self.scroll.SetThumbPosition(pos) |
1406 | 1417 | self.OnScrollBar() | ... | ... |