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

Open popup at cursor position instead of LineString center #5235

Closed
HugoHeneault opened this issue Jan 7, 2017 · 2 comments
Closed

Open popup at cursor position instead of LineString center #5235

HugoHeneault opened this issue Jan 7, 2017 · 2 comments

Comments

@HugoHeneault
Copy link

How to reproduce

  • Leaflet version I'm using: 1.0.2
  • Browser (with version) I'm using: Chrome 55
  • OS/Platform (with version) I'm using: Win7

Steps

  • Add a popup to a LineString geojson
  • Hover it

What behaviour I'm expecting and which behaviour I'm seeing

I want the popup to open at my cursor position, but the popup opens at the center of the linestring

Minimal example reproducing the issue

http://jsfiddle.net/wuu8Lv2t/1/

@perliedman
Copy link
Member

You can achieve this by creating a new popup and adding at the desired location, instead of binding it. Since a bound popup can be opened by other means than a mouse click, it can't know where to open.

See here for a modified example: http://jsfiddle.net/uwdnvfy6/

@HugoHeneault
Copy link
Author

This is short and very clear. Thank you for your answer!

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

No branches or pull requests

2 participants