Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in ability to click on polygons, circles and ground overlays #124

Closed

Conversation

lookaflyingdonkey
Copy link

See #123 for original discussion.

I have now added in the ability for android to click on circles and ground overlays.

Cheers,
Dean

Dean Collins added 3 commits July 8, 2014 17:19
You can now catch polygon click events in PhoneGap, iOS supports all types such as polygon, polyline, circle, etc whereas Android is only polygons at this point.
@wf9a5m75
Copy link
Member

Merged into the issue123 branch by hand, then I will test.
Thank you

wf9a5m75 added a commit that referenced this pull request Jul 11, 2014
wf9a5m75 added a commit that referenced this pull request Jul 11, 2014
wf9a5m75 added a commit that referenced this pull request Jul 11, 2014
wf9a5m75 added a commit that referenced this pull request Jul 12, 2014
@wf9a5m75
Copy link
Member

@lookaflyingdonkey Thank you for sending the pull request. Unfortunately, there is a bug.
When the polygon crosses over the dateline, rayCrossesSegment() function does not detect correctly.
Could you fix this?

const POINTS = [
  new plugin.google.maps.LatLng(38.548852, 139.784086),
  new plugin.google.maps.LatLng(32.548852, 139.784086),
  new plugin.google.maps.LatLng(18.332898, -157.921418),
  new plugin.google.maps.LatLng(24.332898, -157.921418),
];

map.moveCamera({
  'target': POINTS
});
map.addPolygon({
  'points': POINTS,
  'strokeColor' : '#AA00FF',
  'strokeWidth': 5,
}, function(polygon) {
  polygon.on(plugin.google.maps.event.OVERLAY_CLICK, function() {
    polygon.setFillColor("blue");
    alert("clicked");
  });
});

demo

@wf9a5m75
Copy link
Member

I'm trying to fix this using map.getProjection() now.

@wf9a5m75
Copy link
Member

I finally managed to implement the OVERLAY_CLICK event for Polyline, Polygon, Circle, and GroundOverlay both Android and iOS.
Thank you for your encouragement, @lookaflyingdonkey 👍

@wf9a5m75
Copy link
Member

overlay-click

@wf9a5m75 wf9a5m75 reopened this Jul 13, 2014
@wf9a5m75 wf9a5m75 closed this Jul 13, 2014
@lookaflyingdonkey
Copy link
Author

Looks good! Thanks for tidying up a bit, should be a great addition!

@wf9a5m75
Copy link
Member

For lover who want to test this feature before releasing v1.1.4, you can check out ffb64d3.

$> git clone https://github.com/wf9a5m75/phonegap-googlemaps-plugin.git
$> git checkout ffb64d3
$> cd (your project dir)
$> cordova plugin add (path to the phonegap-googlemaps-plugin dir) --variable API_KEY_FOR_ANDROID= --variable API_KEY_FOR_IOS=

wf9a5m75 added a commit that referenced this pull request Mar 1, 2015
wf9a5m75 added a commit that referenced this pull request Mar 1, 2015
wf9a5m75 added a commit that referenced this pull request Mar 1, 2015
wf9a5m75 added a commit that referenced this pull request Mar 1, 2015
@alexislg2
Copy link

For me this PR is not working on iOS. See this issue:

#541

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants