Skip to content
New issue

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

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

Already on GitHub? # to your account

moveend event handler is invoked after result is triggered #131

Closed
Erutan409 opened this issue Oct 30, 2017 · 3 comments
Closed

moveend event handler is invoked after result is triggered #131

Erutan409 opened this issue Oct 30, 2017 · 3 comments
Labels
Milestone

Comments

@Erutan409
Copy link

My moveend handler is being triggered before the map even starts to move to the location I select from the search results.

mapboxgl: v0.41.0
geocoder: v2.1.1

@Erutan409 Erutan409 changed the title moveend handler is invoked after result is triggered moveend event handler is invoked after result is triggered Oct 30, 2017
@andrewharvey
Copy link
Collaborator

@Erutan409 I suspect this is because of #99, which causes the result event to be fired twice. As part of that the map tries to animate to the location twice (the first one being interrupted by the second).

Interrupting a camera animation with another camera animation in GL JS causes the moveend event to fire, hence you're getting the issue you describe.

Unfortunately #99 is not easy to fix for both modern browsers and IE11, so it remains a bug.

If you don't need to support IE11 then you can try #99 (comment) and see if that resolves the issue?

@Erutan409
Copy link
Author

I'll check my code Monday, but I think I solved it with a closure and a brief timeout. It was weird, but necessary.

@scottsfarley93 scottsfarley93 added this to the v4.0.0 milestone Mar 21, 2019
scottsfarley93 pushed a commit that referenced this issue Mar 21, 2019
@scottsfarley93
Copy link

This was addressed in #229 and will be fixed when version 4 is released.

katydecorah pushed a commit that referenced this issue Mar 21, 2019
* version4:
  fixes double moveend event #131
katydecorah pushed a commit that referenced this issue Mar 22, 2019
* version4:
  reset this.lastSelected on clear (#224)
  [v4] style updates (#211)
  [v4] create collapsed option (#222)
  fixes double moveend event #131
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants