Toggle navigation
Toggle navigation
This project
Loading...
Sign in
尹诚
/
Mapbox-iOS-SDK
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
Justin R. Miller
13 years ago
Commit
12582fcc9a969b66bbabe42a2932cbc7fa922e68
1 parent
0bafb748
fixes #92: properly order user location annotations & disallow gestures
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
3 deletions
MapView/Map/RMMapOverlayView.h
MapView/Map/RMMapOverlayView.m
MapView/Map/RMMapView.m
MapView/Map/RMUserLocation.m
MapView/Map/RMMapOverlayView.h
View file @
12582fc
...
...
@@ -22,4 +22,6 @@
-
(
void
)
moveLayersBy
:(
CGPoint
)
delta
;
-
(
CALayer
*
)
overlayHitTest
:(
CGPoint
)
point
;
@end
...
...
MapView/Map/RMMapOverlayView.m
View file @
12582fc
...
...
@@ -10,8 +10,14 @@
#import "RMMarker.h"
#import "RMAnnotation.h"
#import "RMPixel.h"
#import "RMMapView.h"
@implementation
RMMapOverlayView
{
RMAnnotation
*
_userLocationAnnotation
;
RMAnnotation
*
_accuracyCircleAnnotation
;
RMAnnotation
*
_trackingHaloAnnotation
;
}
+
(
Class
)
layerClass
{
...
...
@@ -58,4 +64,30 @@
[
self
.
layer
scrollPoint
:
CGPointMake
(
-
delta
.
x
,
-
delta
.
y
)];
}
-
(
CALayer
*
)
overlayHitTest
:
(
CGPoint
)
point
{
RMMapView
*
mapView
=
((
RMMapView
*
)
self
.
superview
);
if
(
!
_userLocationAnnotation
)
_userLocationAnnotation
=
(
RMAnnotation
*
)
mapView
.
userLocation
;
if
(
!
_accuracyCircleAnnotation
)
for
(
RMAnnotation
*
annotation
in
mapView
.
annotations
)
if
([
annotation
.
annotationType
isEqualToString
:
kRMAccuracyCircleAnnotationTypeName
])
_accuracyCircleAnnotation
=
annotation
;
if
(
!
_trackingHaloAnnotation
)
for
(
RMAnnotation
*
annotation
in
mapView
.
annotations
)
if
([
annotation
.
annotationType
isEqualToString
:
kRMTrackingHaloAnnotationTypeName
])
_trackingHaloAnnotation
=
annotation
;
_userLocationAnnotation
.
layer
.
hidden
=
_accuracyCircleAnnotation
.
layer
.
hidden
=
_trackingHaloAnnotation
.
layer
.
hidden
=
YES
;
CALayer
*
hit
=
[
self
.
layer
hitTest
:
point
];
_userLocationAnnotation
.
layer
.
hidden
=
_accuracyCircleAnnotation
.
layer
.
hidden
=
_trackingHaloAnnotation
.
layer
.
hidden
=
NO
;
return
hit
;
}
@end
...
...
MapView/Map/RMMapView.m
View file @
12582fc
...
...
@@ -1343,7 +1343,7 @@
-
(
void
)
handleSingleTap
:
(
UIGestureRecognizer
*
)
recognizer
{
CALayer
*
hit
=
[
_overlayView
.
layer
h
itTest
:[
recognizer
locationInView
:
self
]];
CALayer
*
hit
=
[
_overlayView
overlayH
itTest
:[
recognizer
locationInView
:
self
]];
if
(
!
hit
)
{
...
...
@@ -1393,7 +1393,7 @@
-
(
void
)
handleDoubleTap
:
(
UIGestureRecognizer
*
)
recognizer
{
CALayer
*
hit
=
[
_overlayView
.
layer
h
itTest
:[
recognizer
locationInView
:
self
]];
CALayer
*
hit
=
[
_overlayView
overlayH
itTest
:[
recognizer
locationInView
:
self
]];
if
(
!
hit
)
{
...
...
@@ -1450,7 +1450,7 @@
if
([
recognizer
isKindOfClass
:[
UIPanGestureRecognizer
class
]])
{
// check whether our custom pan gesture recognizer should start recognizing the gesture
CALayer
*
hit
=
[
_overlayView
.
layer
h
itTest
:[
recognizer
locationInView
:
_overlayView
]];
CALayer
*
hit
=
[
_overlayView
overlayH
itTest
:[
recognizer
locationInView
:
_overlayView
]];
if
([
hit
isEqual
:
_overlayView
.
layer
])
return
NO
;
...
...
@@ -2789,6 +2789,7 @@
accuracyCircleAnnotation
.
annotationType
=
kRMAccuracyCircleAnnotationTypeName
;
accuracyCircleAnnotation
.
clusteringEnabled
=
NO
;
accuracyCircleAnnotation
.
layer
=
[[
RMCircle
alloc
]
initWithView
:
self
radiusInMeters
:
newLocation
.
horizontalAccuracy
];
accuracyCircleAnnotation
.
layer
.
zPosition
=
-
MAXFLOAT
;
accuracyCircleAnnotation
.
isUserLocationAnnotation
=
YES
;
((
RMCircle
*
)
accuracyCircleAnnotation
.
layer
).
lineColor
=
[
UIColor
colorWithRed
:
0
.
378
green
:
0
.
552
blue
:
0
.
827
alpha
:
0
.
7
];
...
...
@@ -2822,6 +2823,7 @@
// create image marker
//
trackingHaloAnnotation
.
layer
=
[[
RMMarker
alloc
]
initWithUIImage
:[
UIImage
imageNamed
:
@"TrackingDotHalo.png"
]];
trackingHaloAnnotation
.
layer
.
zPosition
=
-
MAXFLOAT
+
1
;
trackingHaloAnnotation
.
isUserLocationAnnotation
=
YES
;
[
CATransaction
begin
];
...
...
MapView/Map/RMUserLocation.m
View file @
12582fc
...
...
@@ -25,6 +25,8 @@
layer
=
[[
RMMarker
alloc
]
initWithUIImage
:[
UIImage
imageNamed
:
@"TrackingDot.png"
]];
layer
.
zPosition
=
-
MAXFLOAT
+
2
;
annotationType
=
[
kRMUserLocationAnnotationTypeName
retain
];
clusteringEnabled
=
NO
;
...
...
Please
register
or
login
to post a comment