Skip to content

Commit

Permalink
Fix #3123
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-osm committed Oct 5, 2023
1 parent 9903cc8 commit 63f01af
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 39 deletions.
2 changes: 2 additions & 0 deletions Sources/Controllers/Map/Layers/OAContextMenuLayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -636,13 +636,15 @@ - (void) showContextMenu:(CGPoint)touchPoint showUnknownLocation:(BOOL)showUnkno
NSArray<OATargetPoint *> *selectedObjects = [self selectObjectsForContextMenu:touchPoint showUnknownLocation:showUnknownLocation];
if (selectedObjects.count > 0)
{
[OsmAndApp instance].mapMode = OAMapModeFree;
if (selectedObjects[0].type == OATargetContext)
[[OARootViewController instance].mapPanel reopenContextMenu];
else
[[OARootViewController instance].mapPanel showContextMenuWithPoints:selectedObjects];
}
else if (showUnknownLocation)
{
[OsmAndApp instance].mapMode = OAMapModeFree;
CLLocationCoordinate2D coord = [self getTouchPointCoord:touchPoint];
OATargetPoint *unknownTargetPoint = [self getUnknownTargetPoint:coord.latitude longitude:coord.longitude];
[[OARootViewController instance].mapPanel showContextMenu:unknownTargetPoint];
Expand Down
1 change: 0 additions & 1 deletion Sources/Controllers/Map/OAMapHudViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
@property (nonatomic) OAWeatherToolbar *weatherToolbar;

@property (nonatomic, assign) BOOL contextMenuMode;
@property (nonatomic, assign) EOAMapModeButtonType mapModeButtonType;

- (void) enterContextMenuMode;
- (void) restoreFromContextMenuMode;
Expand Down
29 changes: 0 additions & 29 deletions Sources/Controllers/Map/OAMapHudViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -451,20 +451,6 @@ - (void) updateOverlayUnderlayView
- (IBAction) onMapModeButtonClicked:(id)sender
{
[self updateMapModeButton];

switch (self.mapModeButtonType)
{
case EOAMapModeButtonTypeShowMap:
{
dispatch_async(dispatch_get_main_queue(), ^{
[_mapViewController keepTempGpxTrackVisible];
});
[[OARootViewController instance].mapPanel hideContextMenu];
return;
}
default:
break;
}

[[OAMapViewTrackingUtilities instance] backToLocationImpl];
}
Expand Down Expand Up @@ -535,20 +521,6 @@ - (void) updateMapModeButtonIfNeeded

- (void) updateMapModeButton
{
if (self.contextMenuMode)
{
switch (self.mapModeButtonType)
{
case EOAMapModeButtonTypeShowMap:
[_mapModeButton setImage:[UIImage templateImageNamed:@"ic_custom_show_on_map"] forState:UIControlStateNormal];
break;

default:
break;
}
return;
}

if ([self isLocationAvailable])
{
switch (_app.mapMode)
Expand Down Expand Up @@ -1437,7 +1409,6 @@ - (void) restoreFromContextMenuMode
if (self.contextMenuMode)
{
self.contextMenuMode = NO;
self.mapModeButtonType = EOAMapModeButtonRegular;
[self updateMapModeButton];
[self updateControlsLayout:YES];
}
Expand Down
7 changes: 0 additions & 7 deletions Sources/Controllers/Map/OAMapModeHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@
#ifndef OsmAnd_OAMapModeHeaders_h
#define OsmAnd_OAMapModeHeaders_h

typedef enum
{
EOAMapModeButtonRegular = 0,
EOAMapModeButtonTypeShowMap

} EOAMapModeButtonType;

typedef enum
{
EOAMapHudBrowse = 0,
Expand Down
1 change: 1 addition & 0 deletions Sources/Controllers/Map/OAMapViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ - (void) moveGestureDetected:(UIPanGestureRecognizer *)recognizer
CGPoint firstPoint = [self getTouchPoint:recognizer touchIndex:0];
if (!CGPointEqualToPoint(firstPoint, CGPointZero) && _moveTouchLocations.count > 0 && !_rotatingByGesture && !_zoomingByGesture)
{
_app.mapMode = OAMapModeFree;
OATouchLocation *firstTouch = _moveTouchLocations[0];
OsmAnd::PointI touchLocation31 = [OANativeUtilities convertFromPoint31:firstTouch.touchLocation31];
[_mapView setMapTarget:OsmAnd::PointI((int)firstPoint.x, (int)firstPoint.y) location31:touchLocation31];
Expand Down
1 change: 0 additions & 1 deletion Sources/Controllers/Map/OAMapViewTrackingUtilities.mm
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ - (void) setMapLinkedToLocation:(BOOL)isMapLinkedToLocation

- (void) onMapGestureAction:(NSNotification *)notification
{
_app.mapMode = OAMapModeFree;
}

- (void) setMapViewController:(OAMapViewController *)mapViewController
Expand Down
1 change: 0 additions & 1 deletion Sources/Controllers/Panels/OAMapPanelViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,6 @@ - (BOOL) contextMenuMode

- (void) enterContextMenuMode
{
self.hudViewController.mapModeButtonType = EOAMapModeButtonRegular;
[self.hudViewController enterContextMenuMode];
}

Expand Down

0 comments on commit 63f01af

Please sign in to comment.