From 74ad9f4532e30ee859cf0773b76e5a1b4f73e5db Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Mon, 5 Jul 2010 09:05:25 +0000 Subject: Tab tweaks: - Improve hideForSingleTab: settings changes to only update the tab bar if only one tab exists; fixes tab sizing on drag start caused by placeholder cell/update tab bar display conflict - Improve tab drag location detection, particularly when dragging tabs into a new tab bar; drags into new tab bars now respond quickly and correctly --- Frameworks/PSMTabBar/PSMTabBarControl.m | 4 +++- Frameworks/PSMTabBar/PSMTabDragAssistant.m | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Frameworks/PSMTabBar') diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m index 6753bc08..53e48729 100644 --- a/Frameworks/PSMTabBar/PSMTabBarControl.m +++ b/Frameworks/PSMTabBar/PSMTabBarControl.m @@ -450,7 +450,9 @@ - (void)setHideForSingleTab:(BOOL)value { _hideForSingleTab = value; - [self update]; + if ([_cells count] == 1) { + [self update]; + } } - (BOOL)showAddTabButton diff --git a/Frameworks/PSMTabBar/PSMTabDragAssistant.m b/Frameworks/PSMTabBar/PSMTabDragAssistant.m index 7ebada1a..1e7b22a1 100644 --- a/Frameworks/PSMTabBar/PSMTabDragAssistant.m +++ b/Frameworks/PSMTabBar/PSMTabDragAssistant.m @@ -810,6 +810,9 @@ static PSMTabDragAssistant *sharedDragAssistant = nil; // Determine the index of the tab the dragged tab is over NSUInteger overCellIndex = [cells indexOfObject:overCell]; + + // Determine the index of the current target + NSUInteger currentTargetCellIndex = _targetCell?[cells indexOfObject:_targetCell]:NSUIntegerMax; // Ensure that drag changes aren't as a result of an animation NSInteger currentCellStep = [[cells objectAtIndex:(overCellIndex - 1)] currentStep]; @@ -817,7 +820,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil; // Center of the tab is past the edge of the tab to the left if (targetPoint.x < (overCellRect.origin.x + overCellRect.size.width) - && targetPoint.x > (overCellRect.origin.x + overCellRect.size.width/2.0)) + && currentTargetCellIndex > overCellIndex) { [self setTargetCell:[cells objectAtIndex:(overCellIndex - 1)]]; -- cgit v1.2.3