From 230c0db866777e0e5cbf8ad8754298584fe7ed3b Mon Sep 17 00:00:00 2001 From: Tim Fischer Date: Thu, 11 Feb 2016 15:45:01 -0600 Subject: [PATCH 1/5] hitTest should call super to check for subviews before assuming we only want the main view --- src/KDXCollectionView.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/KDXCollectionView.m b/src/KDXCollectionView.m index 8d4e222..02982e5 100644 --- a/src/KDXCollectionView.m +++ b/src/KDXCollectionView.m @@ -2080,11 +2080,13 @@ - (BOOL)acceptsFirstResponder - (NSView *)hitTest:(NSPoint)aPoint { - if (NSMouseInRect(aPoint, [self visibleRect], [self isFlipped])) { + NSView *hitView = [super hitTest:aPoint]; + + if (!hitView && NSMouseInRect(aPoint, [self visibleRect], [self isFlipped])) { return self; } - return nil; + return hitView; } - (void)_clearTrackingArea From af0bc93805ce3fcbaba3df7576d9f7a81191d857 Mon Sep 17 00:00:00 2001 From: Tim Fischer Date: Thu, 11 Feb 2016 18:02:58 -0600 Subject: [PATCH 2/5] add pod spec --- KDXCollectionView.podspec | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 KDXCollectionView.podspec diff --git a/KDXCollectionView.podspec b/KDXCollectionView.podspec new file mode 100644 index 0000000..4921134 --- /dev/null +++ b/KDXCollectionView.podspec @@ -0,0 +1,25 @@ +{ +"name": "KDXCollectionView", +"version": "0.1.1", +"license": { +"type": "MIT", +"file": "LICENSE" +}, +"summary": "A better collection view for Mac.", +"homepage": "https://github.com/lembacon/KDXCollectionView", +"authors": { +"Chongyu Zhu": "lembacon@gmail.com" +}, +"source": { +"git": "https://github.com/tsfischer/KDXCollectionView.git", +"tag": "0.1" +}, +"source_files": "src/*.{h,c,m}", +"requires_arc": false, +"platforms": { +"osx": "10.6" +}, +"osx": { +"frameworks": "Cocoa" +} +} \ No newline at end of file From 984d1ca0dfd9fdde01affdad30a065fcecc1aba1 Mon Sep 17 00:00:00 2001 From: Tim Fischer Date: Thu, 11 Feb 2016 18:06:37 -0600 Subject: [PATCH 3/5] Corrected pod spec --- KDXCollectionView.podspec | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/KDXCollectionView.podspec b/KDXCollectionView.podspec index 4921134..928d76b 100644 --- a/KDXCollectionView.podspec +++ b/KDXCollectionView.podspec @@ -1,25 +1,14 @@ -{ -"name": "KDXCollectionView", -"version": "0.1.1", -"license": { -"type": "MIT", -"file": "LICENSE" -}, -"summary": "A better collection view for Mac.", -"homepage": "https://github.com/lembacon/KDXCollectionView", -"authors": { -"Chongyu Zhu": "lembacon@gmail.com" -}, -"source": { -"git": "https://github.com/tsfischer/KDXCollectionView.git", -"tag": "0.1" -}, -"source_files": "src/*.{h,c,m}", -"requires_arc": false, -"platforms": { -"osx": "10.6" -}, -"osx": { -"frameworks": "Cocoa" -} -} \ No newline at end of file +Pod::Spec.new do |s| +s.name = 'KDXCollectionView' +s.version = '0.1.1' +s.license = { :type => 'MIT', :file => 'LICENSE' } +s.summary = 'A better collection view for Mac.' +s.homepage = 'https://github.com/lembacon/KDXCollectionView' +s.author = { 'Chongyu Zhu' => 'lembacon@gmail.com' } +s.source = { :git => 'https://github.com/tsfischer/KDXCollectionView.git' } +s.source_files = 'src/*.{h,c,m}' +s.requires_arc = false + +s.osx.deployment_target = '10.6' +s.osx.framework = 'Cocoa' +end \ No newline at end of file From 65964e5188bd96e62f4417061d6b5ea6843a5009 Mon Sep 17 00:00:00 2001 From: Tim Fischer Date: Fri, 15 Apr 2016 09:58:31 -0500 Subject: [PATCH 4/5] insert and move should call addVisibleCells to make sure display is accurate --- KDXCollectionView.podspec | 2 +- src/KDXCollectionView.m | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/KDXCollectionView.podspec b/KDXCollectionView.podspec index 928d76b..8859eff 100644 --- a/KDXCollectionView.podspec +++ b/KDXCollectionView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'KDXCollectionView' -s.version = '0.1.1' +s.version = '0.1.2' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'A better collection view for Mac.' s.homepage = 'https://github.com/lembacon/KDXCollectionView' diff --git a/src/KDXCollectionView.m b/src/KDXCollectionView.m index 02982e5..64b20f4 100644 --- a/src/KDXCollectionView.m +++ b/src/KDXCollectionView.m @@ -659,6 +659,7 @@ - (void)_fixLayoutAfterMoving _flags.shouldAnimateCellFrameChanging = YES; [self _updateFramesOfCells]; + [self _addVisibleCells]; _flags.shouldAnimateCellFrameChanging = oldShouldAnimateCellFrameChanging; } @@ -754,6 +755,7 @@ - (void)_fixLayoutAfterInsertion [self _updateFrame]; [self _updateFramesOfCells]; [self _removeInvisibleCells]; + [self _addVisibleCells]; _flags.shouldAnimateCellFrameChanging = oldShouldAnimateCellFrameChanging; } From ea2472555b3be96e97a1729c1b1c50065e74044b Mon Sep 17 00:00:00 2001 From: Tim Fischer Date: Tue, 19 Jul 2016 14:44:38 -0500 Subject: [PATCH 5/5] Fix yet another KDXCollectionView bug, this time regarding reloadData --- KDXCollectionView.podspec | 2 +- src/KDXCollectionView.m | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/KDXCollectionView.podspec b/KDXCollectionView.podspec index 8859eff..4424c23 100644 --- a/KDXCollectionView.podspec +++ b/KDXCollectionView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'KDXCollectionView' -s.version = '0.1.2' +s.version = '0.1.3' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'A better collection view for Mac.' s.homepage = 'https://github.com/lembacon/KDXCollectionView' diff --git a/src/KDXCollectionView.m b/src/KDXCollectionView.m index 64b20f4..d194585 100644 --- a/src/KDXCollectionView.m +++ b/src/KDXCollectionView.m @@ -114,6 +114,10 @@ - (void)_delegateUpdateDraggingItemsForDrag:(id )draggingInfo; @implementation KDXCollectionView +// TSF 7/19/2016 Work-around for a nasty bug where visibleCells array is not trustable during a reloadData. +// Ugly, but trying to minimize pod code changes. +static BOOL doingPreReloadData = false; + #pragma mark - Synthesizing Properties @synthesize dataSource = _dataSource; @@ -448,11 +452,13 @@ - (void)deselectAllItems - (void)_preReloadData { + doingPreReloadData = true; [_selectedIndexes removeAllIndexes]; _hoveringIndex = NSNotFound; _numberOfItems = [self _dataSourceNumberOfItems]; [self _updateFrame]; + doingPreReloadData = false; } - (void)_postReloadData @@ -966,7 +972,9 @@ - (void)drawRect:(NSRect)dirtyRect - (void)setFrame:(NSRect)frameRect { [super setFrame:frameRect]; - [self _layout]; + if (!doingPreReloadData) { + [self _layout]; + } if ([self inLiveResize]) { [self setNeedsDisplay:YES];