Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Using a scroll wheel now changes the selection as appropriate

  • Loading branch information...
commit 5b22847f8f9bb1a141d283bb546e751627df0169 1 parent 9d5fc57
@mattball authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 MBCoverFlowView.m
View
19 MBCoverFlowView.m
@@ -46,6 +46,8 @@ of this software and associated documentation files (the "Software"), to deal
const float MBCoverFlowScrollerHorizontalMargin = 80.0;
const float MBCoverFlowScrollerVerticalSpacing = 16.0;
+const float MBCoverFlowScrollMinimumDeltaThreshold = 0.4;
+
#define MBCoverFlowViewContainerMinY (NSMaxY([self.accessoryController.view frame]) - 3*[self itemSize].height/4)
// Perspective parameters
@@ -276,6 +278,23 @@ - (void)mouseDown:(NSEvent *)theEvent
}
}
+- (void)scrollWheel:(NSEvent *)theEvent
+{
+ if (fabs([theEvent deltaY]) > MBCoverFlowScrollMinimumDeltaThreshold) {
+ if ([theEvent deltaY] > 0) {
+ self.selectionIndex -= 1;
+ } else {
+ self.selectionIndex += 1;
+ }
+ } else if (fabs([theEvent deltaX]) > MBCoverFlowScrollMinimumDeltaThreshold) {
+ if ([theEvent deltaX] > 0) {
+ self.selectionIndex -= 1;
+ } else {
+ self.selectionIndex += 1;
+ }
+ }
+}
+
#pragma mark NSView
- (void)viewWillMoveToSuperview:(NSView *)newSuperview
Please sign in to comment.
Something went wrong with that request. Please try again.