Skip to content
/ Slicer Public
forked from Slicer/Slicer

Commit

Permalink
BUG: Consistently handle First/Back/Next/Last keyframe in Endoscopy
Browse files Browse the repository at this point in the history
This commit ensures that clicking on the Back and Next buttons does not
progress beyond the behavior triggered by clicking on the First and Last
buttons.
  • Loading branch information
jcfr committed Dec 8, 2023
1 parent 81e12b6 commit 083595b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Modules/Scripted/Endoscopy/Endoscopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,24 +412,32 @@ def onDeleteOrientationButtonClicked(self):

def onFirstOrientationButtonClicked(self):
allIndices = self.logic.cameraOrientationResampledCurveIndices
if not allIndices:
return
whereTo = min(allIndices, default=self.frameSlider.minimum)
self.frameSlider.value = whereTo

def onBackOrientationButtonClicked(self):
allIndices = self.logic.cameraOrientationResampledCurveIndices
allIndices = [x for x in allIndices if x < self.frameSlider.value]
whereTo = max(allIndices, default=self.frameSlider.minimum)
if not allIndices:
return
whereTo = max(allIndices)
self.frameSlider.value = whereTo

def onNextOrientationButtonClicked(self):
allIndices = self.logic.cameraOrientationResampledCurveIndices
allIndices = [x for x in allIndices if x > self.frameSlider.value]
whereTo = min(allIndices, default=self.frameSlider.maximum)
if not allIndices:
return
whereTo = min(allIndices)
self.frameSlider.value = whereTo

def onLastOrientationButtonClicked(self):
allIndices = self.logic.cameraOrientationResampledCurveIndices
whereTo = max(allIndices, default=self.frameSlider.maximum)
if not allIndices:
return
whereTo = max(allIndices)
self.frameSlider.value = whereTo

def onSaveExportModelButtonClicked(self):
Expand Down

0 comments on commit 083595b

Please sign in to comment.