Skip to content

Commit

Permalink
Fix floating-point conversion. Remove useless logging
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Nov 16, 2012
1 parent 43ff2fd commit a2593f7
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions CoconutKit/Sources/View/HLSCursor.m
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ - (void)layoutSubviews

// Adjust individual frames so that the element views are centered within the available frame; warn if too large (will still
// be centered)
CGFloat xPos = floorf(fabs(self.frame.size.width - totalWidth) / 2.f) + floatmax(0.f, -self.pointerViewTopLeftOffset.width);
CGFloat xPos = floorf(fabsf(self.frame.size.width - totalWidth) / 2.f) + floatmax(0.f, -self.pointerViewTopLeftOffset.width);
if (floatgt(totalWidth, self.frame.size.width)) {
HLSLoggerWarn(@"Cursor frame not wide enough");
xPos = -xPos;
Expand Down Expand Up @@ -343,7 +343,6 @@ - (void)deselectPreviousIndex
[self swapElementViewAtIndex:m_selectedIndex selected:NO];

// Notify deselection
HLSLoggerDebug(@"Calling cursor:didMoveFromIndex:");
if (m_viewsCreated && [self.delegate respondsToSelector:@selector(cursor:didMoveFromIndex:)]) {
[self.delegate cursor:self didMoveFromIndex:m_selectedIndex];
}
Expand All @@ -363,7 +362,6 @@ - (void)finalizeSelectionForIndex:(NSUInteger)index
// previously selected. This is needed (and makes sense) since the deselect event is sent as soon the user
// starts dragging the pointer. Even if we arrive on the same element as before, we must get the corresponding
// anti-event, i.e. select.
HLSLoggerDebug(@"Calling cursor:didMoveToIndex:");
if ([self.delegate respondsToSelector:@selector(cursor:didMoveToIndex:)]) {
[self.delegate cursor:self didMoveToIndex:index];
}
Expand Down Expand Up @@ -536,12 +534,10 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event

[self swapElementViewAtIndex:m_selectedIndex selected:NO];

HLSLoggerDebug(@"Calling cursor:didMoveFromIndex:");
if ([self.delegate respondsToSelector:@selector(cursor:didMoveFromIndex:)]) {
[self.delegate cursor:self didMoveFromIndex:m_selectedIndex];
}

HLSLoggerDebug(@"Calling cursorDidStartDragging:");
if ([self.delegate respondsToSelector:@selector(cursorDidStartDragging:)]) {
[self.delegate cursorDidStartDragging:self];
}
Expand All @@ -554,7 +550,6 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
if (m_grabbed) {
CGFloat xPos = point.x - m_initialDraggingXOffset;
self.pointerContainerView.frame = [self pointerFrameForXPos:xPos];
HLSLoggerDebug(@"Calling cursor:didDragNearIndex:");
if ([self.delegate respondsToSelector:@selector(cursor:didDragNearIndex:)]) {
[self.delegate cursor:self didDragNearIndex:[self indexForXPos:xPos]];
}
Expand All @@ -578,7 +573,6 @@ - (void)endTouches:(NSSet *)touches animated:(BOOL)animated
NSUInteger index = [self indexForXPos:point.x];
[self setSelectedIndex:index animated:animated];

HLSLoggerDebug(@"Calling cursorDidStopDragging:");
if ([self.delegate respondsToSelector:@selector(cursorDidStopDragging:)]) {
[self.delegate cursorDidStopDragging:self];
}
Expand Down

0 comments on commit a2593f7

Please sign in to comment.