Permalink
Browse files

Fix a bug when drag-deleting an item and the scrollview is not at the…

… origin.
  • Loading branch information...
bjhomer committed Dec 9, 2010
1 parent 522f159 commit f48bbce3b79b77d3883a70c762070020ff51451b
Showing with 7 additions and 4 deletions.
  1. +6 −3 Classes/HSSidebarView.m
  2. +1 −1 en.lproj/SidebarViewController.xib
View
@@ -188,6 +188,7 @@ - (void)layoutSubviews {
imageView.image = image;
imageView.frame = [self imageViewFrameInScrollViewForIndex:idx];
+ imageView.transform = CGAffineTransformIdentity;
imageView.contentMode = UIViewContentModeScaleAspectFit;
[_scrollView addSubview:imageView];
@@ -472,10 +473,9 @@ - (void)pressedSidebar:(UILongPressGestureRecognizer *)recognizer {
[self.dragScrollTimer invalidate];
self.dragScrollTimer = nil;
- CGPoint pointInWindow = [self convertPoint:hitPoint toView:nil];
- CGRect deleteZone = CGRectInset(self.window.bounds, 40, 40);
+ CGRect safeZone = CGRectInset(_scrollView.bounds, -30, -30);
- if (isInScrollView || CGRectContainsPoint(deleteZone, pointInWindow) == NO) {
+ if (isInScrollView || CGRectContainsPoint(safeZone, hitPoint)) {
CGPoint finalPosition = [self imageViewCenterInScrollViewForIndex:newIndex];
[UIView animateWithDuration:0.2
animations:^{
@@ -504,6 +504,9 @@ - (void)pressedSidebar:(UILongPressGestureRecognizer *)recognizer {
}
completion:^(BOOL finished) {
self.selectedIndex = -1;
+ [UIView animateWithDuration:0.2 animations:^{
+ [self recalculateScrollViewContentSize];
+ }];
[self setNeedsLayout];
}];
[imageViews removeObject:viewBeingDragged];
@@ -29,7 +29,7 @@
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUIView" id="752737248">
<reference key="NSNextResponder" ref="766721923"/>
- <int key="NSvFlags">276</int>
+ <int key="NSvFlags">290</int>
<string key="NSFrameSize">{768, 85}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>

0 comments on commit f48bbce

Please sign in to comment.