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
12 years ago
Commit
2317749f18720c941998edae6358de54876d9318
1 parent
56b13c87
fix shape/circle hit detection passed on presence of fill color
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
MapView/Map/RMCircle.m
MapView/Map/RMShape.m
MapView/Map/RMCircle.m
View file @
2317749
...
...
@@ -135,7 +135,25 @@
-
(
BOOL
)
containsPoint
:
(
CGPoint
)
thePoint
{
return
CGPathContainsPoint
(
shapeLayer
.
path
,
nil
,
thePoint
,
[
shapeLayer
.
fillRule
isEqualToString
:
kCAFillRuleEvenOdd
]);
BOOL
containsPoint
=
NO
;
if
([
self
.
fillColor
isEqual
:[
UIColor
clearColor
]])
{
// if shape is not filled with a color, do a simple "point on path" test
//
UIGraphicsBeginImageContext
(
self
.
bounds
.
size
);
CGContextAddPath
(
UIGraphicsGetCurrentContext
(),
shapeLayer
.
path
);
containsPoint
=
CGContextPathContainsPoint
(
UIGraphicsGetCurrentContext
(),
thePoint
,
kCGPathStroke
);
UIGraphicsEndImageContext
();
}
else
{
// else do a "path contains point" test
//
containsPoint
=
CGPathContainsPoint
(
shapeLayer
.
path
,
nil
,
thePoint
,
[
shapeLayer
.
fillRule
isEqualToString
:
kCAFillRuleEvenOdd
]);
}
return
containsPoint
;
}
-
(
void
)
setLineColor
:
(
UIColor
*
)
newLineColor
...
...
MapView/Map/RMShape.m
View file @
2317749
...
...
@@ -437,7 +437,25 @@
-
(
BOOL
)
containsPoint
:
(
CGPoint
)
thePoint
{
return
CGPathContainsPoint
(
shapeLayer
.
path
,
nil
,
thePoint
,
[
shapeLayer
.
fillRule
isEqualToString
:
kCAFillRuleEvenOdd
]);
BOOL
containsPoint
=
NO
;
if
([
self
.
fillColor
isEqual
:[
UIColor
clearColor
]])
{
// if shape is not filled with a color, do a simple "point on path" test
//
UIGraphicsBeginImageContext
(
self
.
bounds
.
size
);
CGContextAddPath
(
UIGraphicsGetCurrentContext
(),
shapeLayer
.
path
);
containsPoint
=
CGContextPathContainsPoint
(
UIGraphicsGetCurrentContext
(),
thePoint
,
kCGPathStroke
);
UIGraphicsEndImageContext
();
}
else
{
// else do a "path contains point" test
//
containsPoint
=
CGPathContainsPoint
(
shapeLayer
.
path
,
nil
,
thePoint
,
[
shapeLayer
.
fillRule
isEqualToString
:
kCAFillRuleEvenOdd
]);
}
return
containsPoint
;
}
-
(
void
)
closePath
...
...
Please
register
or
login
to post a comment