From ef462034053f99f1d2998cafaf987504df74c5ec Mon Sep 17 00:00:00 2001 From: Tyler Burgett Date: Tue, 29 Oct 2024 17:45:01 -0600 Subject: [PATCH] fix for tapping user location point and drawer handling when making a new feature layer --- mapcache-ios.xcodeproj/project.pbxproj | 4 +- .../MCFeatureLayerDetailsViewController.m | 43 ++++++++++++++++++- mapcache-ios/map/MCMapViewController.m | 4 ++ 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/mapcache-ios.xcodeproj/project.pbxproj b/mapcache-ios.xcodeproj/project.pbxproj index c3e590e..016d3d8 100644 --- a/mapcache-ios.xcodeproj/project.pbxproj +++ b/mapcache-ios.xcodeproj/project.pbxproj @@ -1447,7 +1447,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 60; + CURRENT_PROJECT_VERSION = 61; DEVELOPMENT_TEAM = ZL8G5D9G2H; ENABLE_TESTABILITY = YES; GCC_NO_COMMON_BLOCKS = YES; @@ -1476,7 +1476,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 60; + CURRENT_PROJECT_VERSION = 61; DEVELOPMENT_TEAM = ZL8G5D9G2H; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = "mapcache-ios/Info.plist"; diff --git a/mapcache-ios/geopackage/NewLayerWizard/MCFeatureLayerDetailsViewController.m b/mapcache-ios/geopackage/NewLayerWizard/MCFeatureLayerDetailsViewController.m index 405f7f1..dc40ffb 100644 --- a/mapcache-ios/geopackage/NewLayerWizard/MCFeatureLayerDetailsViewController.m +++ b/mapcache-ios/geopackage/NewLayerWizard/MCFeatureLayerDetailsViewController.m @@ -21,6 +21,8 @@ @interface MCFeatureLayerDetailsViewController () @property (strong, nonatomic) MCFieldWithTitleCell *layerNameCell; @property (strong, nonatomic) MCButtonCell *buttonCell; @property (strong, nonatomic) MCDescriptionCell *descriptionCell; +@property (nonatomic) BOOL haveScrolled; +@property (nonatomic) CGFloat contentOffset; @end @implementation MCFeatureLayerDetailsViewController @@ -52,7 +54,15 @@ - (void)viewDidLoad { self.tableView.estimatedRowHeight = 100; self.tableView.rowHeight = UITableViewAutomaticDimension; self.tableView.separatorStyle = UIAccessibilityTraitNone; + + UIEdgeInsets tabBarInsets = UIEdgeInsetsMake(0, 0, self.tabBarController.tabBar.frame.size.height, 0); + self.tableView.contentInset = tabBarInsets; + self.tableView.scrollIndicatorInsets = tabBarInsets; + self.contentOffset = 0; + self.haveScrolled = NO; + [self.view addSubview:self.tableView]; + [self addDragHandle]; [self addCloseButton]; [[MCMetrics shared] featureLayerDetails]; @@ -157,11 +167,42 @@ - (BOOL)textFieldShouldReturn:(UITextField *)textField { return YES; } - +#pragma mark - NGADrawerView methods - (void) closeDrawer { [self.drawerViewDelegate popDrawer]; } +- (void) drawerWasCollapsed { + [super drawerWasCollapsed]; + [self.tableView setScrollEnabled:NO]; +} + + +- (void) drawerWasMadeFull { + [super drawerWasMadeFull]; + [self.tableView setScrollEnabled:YES]; +} + +// Override this method to make the drawer and the scrollview play nice +- (void)scrollViewDidScroll:(UIScrollView *)scrollView { + if (self.haveScrolled) { + [self rollUpPanGesture:scrollView.panGestureRecognizer withScrollView:scrollView]; + } +} + +// If the table view is scrolling rollup the gesture to the drawer and handle accordingly. +- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { + self.haveScrolled = YES; + + if (!self.isFullView) { + scrollView.scrollEnabled = NO; + scrollView.scrollEnabled = YES; + } else { + scrollView.scrollEnabled = YES; + } +} + + #pragma mark - GPKGSButtonCellDelegate diff --git a/mapcache-ios/map/MCMapViewController.m b/mapcache-ios/map/MCMapViewController.m index 6b52a49..9b1dc69 100644 --- a/mapcache-ios/map/MCMapViewController.m +++ b/mapcache-ios/map/MCMapViewController.m @@ -723,6 +723,10 @@ -(void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated{ - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view { NSLog(@"MCMapController - Tapped map point"); + if ([view.annotation isKindOfClass:MKUserLocation.class]) { + return; + } + if ([view isKindOfClass:MKAnnotationView.class] || [view isKindOfClass:MKMarkerAnnotationView.class]) { [self zoomToPointWithOffset:view.annotation.coordinate]; [self.mapActionDelegate showDetailsForAnnotation:(GPKGMapPoint *)view.annotation];