question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simple click events

See original GitHub issue

Need a way to make click event on map and get something like LatLng, I only see an onChildClick event in the library and no examples like this way, it seems like could not easy to dynamic add new markers since no feedback when user click on the map, or maybe am I missing something?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
istarkovcommented, Oct 1, 2015

Usage example:

// ES6 users
_onClick = ({x, y, lat, lng, event}) => console.log(x, y, lat, lng, event)
// ES5 users
function _onClick(obj){ console.log(obj.x, obj.y, obj.lat, obj.lng, obj.event);}

<GoogleMap  onClick={_onClick} ... />

About event prop in args, be sure it is not gmap-api ‘click’ event, but outer div onClick event.

2reactions
vsshaposhnikovcommented, Jan 12, 2018

@istarkov may be you can add usage example to documentation ? Thanks And can you show how i can change pointer, any props for that, like center, zoom .etc

Read more comments on GitHub >

github_iconTop Results From Across the Web

Simple Click Events | Maps JavaScript API - Google Developers
Stay organized with collections Save and categorize content based on your preferences. listens for the click event on a marker to zoom the...
Read more >
Element: click event - Web APIs | MDN
An element receives a click event when a pointing device button (such as a mouse's primary mouse button) is both pressed and released...
Read more >
onclick Event - W3Schools
Definition and Usage. The onclick event occurs when the user clicks on an HTML element. Mouse Events ... Click to copy text from...
Read more >
Handling click events in Google Maps JS API v3 while ...
With the Google Maps JS API v3, I want to drop a marker where the user clicks on the map, while keeping the...
Read more >
HTML Button onclick – JavaScript Click Event Tutorial
In this tutorial, we are going to explore the two different ways of executing click events in JavaScript using two different methods.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found