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

mapboxgl.Marker undefined if togglePopup() when initialising Marker #5116

Closed
Utzel-Butzel opened this issue Aug 8, 2017 · 1 comment · Fixed by #5140
Closed

mapboxgl.Marker undefined if togglePopup() when initialising Marker #5116

Utzel-Butzel opened this issue Aug 8, 2017 · 1 comment · Fixed by #5140
Assignees
Labels

Comments

@Utzel-Butzel
Copy link

When creating a new marker and setting up a popup which will be immediately enabled via togglePopup() the created marker returns undefined.

based on the Custom Marker Icons demo

var markerEl = new mapboxgl.Marker(el)
.setLngLat(marker.geometry.coordinates)
.setPopup(popup)
.addTo(map)
.togglePopup();
 console.log(markerEl);

mapbox-gl-js version:
v0.37.0

Steps to Trigger Behavior

  1. Creating the marker
  2. Console output

Expected Behavior

Return the var markerEl

Actual Behavior

returns undefined if .togglePopup() set otherwise it returns the correct element

@mollymerp
Copy link
Contributor

@Utzel-Butzel thanks for the report. You're right, the documentation does say that Marker#togglePopup should return the Marker element, and right now it's returning nothing.

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

Successfully merging a pull request may close this issue.

2 participants