Skip to content

Commit

Permalink
Remove element view margins
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Nov 22, 2012
1 parent d443590 commit 0659a60
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ - (void)viewDidLoad

self.timeScalesCursor.dataSource = self;
self.timeScalesCursor.delegate = self;
// Not perfectly centered with the font used. Tweak a little bit to get a perfect result
self.timeScalesCursor.pointerViewTopLeftOffset = CGSizeMake(-11.f, -12.f);

self.foldersCursor.dataSource = self;
self.foldersCursor.delegate = self;
Expand Down
6 changes: 3 additions & 3 deletions CoconutKit/Sources/View/HLSCursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@

/**
* Pointer view offsets. Use these offsets to make the pointer rectangle larger or smaller than the element it points
* at. By default the pointer view frame matches the one of the underlying element
* at
*/
@property (nonatomic, assign) CGSize pointerViewTopLeftOffset; // Default is (0px, 0px); set negative values to grow larger
@property (nonatomic, assign) CGSize pointerViewBottomRightOffset; // Default is (0px, 0px); set negative values to grow larger
@property (nonatomic, assign) CGSize pointerViewTopLeftOffset; // Default is (-10px, -10px); set negative values to grow larger
@property (nonatomic, assign) CGSize pointerViewBottomRightOffset; // Default is (10px, 10px); set negative values to grow larger

/**
* Get the currently selected element. During the time the pointer is moved the selected index is not updated. This value
Expand Down
12 changes: 6 additions & 6 deletions CoconutKit/Sources/View/HLSCursor.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ - (void)dealloc

- (void)hlsCursorInit
{
self.pointerViewTopLeftOffset = CGSizeMake(0.f, 0.f);
self.pointerViewBottomRightOffset = CGSizeMake(0.f, 0.f);
self.pointerViewTopLeftOffset = CGSizeMake(-10.f, -10.f);
self.pointerViewBottomRightOffset = CGSizeMake(10.f, 10.f);

self.animated = YES;
}
Expand Down Expand Up @@ -292,8 +292,8 @@ - (UIView *)elementViewForIndex:(NSUInteger)index selected:(BOOL)selected
CGSize otherTitleSize = [title sizeWithFont:otherFont];
UILabel *elementLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0.f,
0.f,
floatmax(titleSize.width, otherTitleSize.width) + 10.f,
floatmax(titleSize.height, otherTitleSize.height) + 10.f)]
floatmax(titleSize.width, otherTitleSize.width),
floatmax(titleSize.height, otherTitleSize.height))]
autorelease];
elementLabel.text = title;
elementLabel.backgroundColor = [UIColor clearColor];
Expand Down Expand Up @@ -325,8 +325,8 @@ - (UIView *)elementWrapperViewForIndex:(NSUInteger)index

UIView *wrapperView = [[[UIView alloc] initWithFrame:CGRectMake(0.f,
0.f,
floatmax(CGRectGetWidth(elementView.frame), CGRectGetWidth(selectedElementView.frame) + 10.f),
floatmax(CGRectGetHeight(elementView.frame), CGRectGetHeight(selectedElementView.frame) + 10.f))] autorelease];
floatmax(CGRectGetWidth(elementView.frame), CGRectGetWidth(selectedElementView.frame)),
floatmax(CGRectGetHeight(elementView.frame), CGRectGetHeight(selectedElementView.frame)))] autorelease];
wrapperView.backgroundColor = [UIColor clearColor];

[wrapperView addSubview:elementView];
Expand Down

0 comments on commit 0659a60

Please sign in to comment.