Permalink
Browse files

[FIX] Spacing between items should be proportional to the items' size…

… (it used to be a constant)

[FIX] -itemSize should use the ratio of _itemSize's dimensions (it was using a hardcoded ratio)
  • Loading branch information...
1 parent fc91f5d commit 285a79af01ffc6794b278021571cac90496fdc96 @mattball committed Mar 31, 2009
Showing with 16 additions and 14 deletions.
  1. +2 −2 English.lproj/MainMenu.xib
  2. +7 −8 MBCoverFlowView.h
  3. +4 −2 MBCoverFlowView.m
  4. +3 −2 MBCoverFlowViewController.m
@@ -8,8 +8,8 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="57"/>
<integer value="372"/>
+ <integer value="57"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1127,7 +1127,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomView" id="260292442">
<reference key="NSNextResponder" ref="439893737"/>
- <int key="NSvFlags">286</int>
+ <int key="NSvFlags">310</int>
<string key="NSFrame">{{0, 20}, {623, 229}}</string>
<reference key="NSSuperview" ref="439893737"/>
<string key="NSClassName">MBCoverFlowView</string>
View
@@ -38,32 +38,31 @@
@interface MBCoverFlowView : NSView {
NSInteger _selectedIndex;
+ // Layers
CAScrollLayer *_scrollLayer;
CALayer *_containerLayer;
CALayer *_leftGradientLayer;
CALayer *_rightGradientLayer;
CALayer *_bottomGradientLayer;
+ // Appearance
CGImageRef _shadowImage;
CATransform3D _leftTransform;
CATransform3D _rightTransform;
+ // Display Attributes
NSSize _itemSize;
- NSArray *_content;
-
NSViewController *_accessoryController;
-
MBCoverFlowScroller *_scroller;
-
BOOL _showsScrollbar;
BOOL _autoresizesItems;
+ CGImageRef _placeholderRef;
+ NSImage *_placeholderIcon;
+ // Data
+ NSArray *_content;
NSString *_imageKeyPath;
-
NSOperationQueue *_imageLoadQueue;
-
- CGImageRef _placeholderRef;
- NSImage *_placeholderIcon;
}
/**
View
@@ -32,7 +32,9 @@ of this software and associated documentation files (the "Software"), to deal
#import <QuartzCore/QuartzCore.h>
// Constants
-const float MBCoverFlowViewCellSpacing = 14.0;
+//const float MBCoverFlowViewCellSpacing = 14.0;
+#define MBCoverFlowViewCellSpacing ([self itemSize].width/10)
+
const float MBCoverFlowViewPlaceholderHeight = 600;
const float MBCoverFlowViewTopMargin = 30.0;
@@ -443,7 +445,7 @@ - (NSSize)itemSize
NSSize size;
size.height = ([self frame].size.height - origin) - [self frame].size.height/3;
- size.width = 1.4*size.height;
+ size.width = size.height * _itemSize.width / _itemSize.height;
// Make sure it's integral
size.height = floor(size.height);
@@ -84,12 +84,13 @@ - (void)dealloc
- (void)addItem:(id)sender
{
- if ([items isEqualToArray:[(MBCoverFlowView *)self.view content]]) {
+ /*if ([items isEqualToArray:[(MBCoverFlowView *)self.view content]]) {
return;
}
NSArray *content = [items subarrayWithRange:NSMakeRange(0, [[(MBCoverFlowView *)self.view content] count]+1)];
- [(MBCoverFlowView *)self.view setContent:content];
+ [(MBCoverFlowView *)self.view setContent:content];*/
+ [(MBCoverFlowView *)self.view setContent:items];
}
@end

0 comments on commit 285a79a

Please sign in to comment.