Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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
mattball committed Mar 31, 2009
1 parent fc91f5d commit 285a79a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions English.lproj/MainMenu.xib
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
15 changes: 7 additions & 8 deletions MBCoverFlowView.h
Expand Up @@ -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;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions MBCoverFlowView.m
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions MBCoverFlowViewController.m
Expand Up @@ -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.