Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4df2bb7

Browse filesBrowse files
committed
Allow wraparound in image slice viewer example.
Also, drop the more expensive `np.clip` call.
1 parent e53876a commit 4df2bb7
Copy full SHA for 4df2bb7

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎examples/animation/image_slices_viewer.py

Copy file name to clipboardExpand all lines: examples/animation/image_slices_viewer.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def __init__(self, ax, X):
2525
def onscroll(self, event):
2626
print("%s %s" % (event.button, event.step))
2727
if event.button == 'up':
28-
self.ind = np.clip(self.ind + 1, 0, self.slices - 1)
28+
self.ind = (self.ind + 1) % self.slices
2929
else:
30-
self.ind = np.clip(self.ind - 1, 0, self.slices - 1)
30+
self.ind = (self.ind - 1) % self.slices
3131
self.update()
3232

3333
def update(self):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.