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

Pass click coordinate into farmOS-map.popup event #176

Open
mstenta opened this issue Aug 11, 2022 · 2 comments
Open

Pass click coordinate into farmOS-map.popup event #176

mstenta opened this issue Aug 11, 2022 · 2 comments

Comments

@mstenta
Copy link
Member

mstenta commented Aug 11, 2022

We provide an addPopup() method on map instances, which initializes a new Popup and dispatches a custom farmOS-map.popup event when a singleclick is performed on the map. However, it doesn't pass the click coordinate into the farmOS-map.popup, so that coordinate isn't available to other behaviors who want to hook into the popup display.

For example, the event on this line:

https://github.com/farmOS/farmOS/blob/fc77c86abe6b142702e7b103cd85e0c207333b79/modules/core/ui/map/js/farmOS.map.behaviors.asset_type_layers.js#L91

Is NOT the same event as this one:

popup.show(event.coordinate, content);

... so event.coordinate is not accessible in the downstream behavior.

@paul121
Copy link
Member

paul121 commented Aug 11, 2022

@symbioquine mentioned we might be able to just change the event.type to be `farmOS-map.popup' and pass on the original event attributes. We just need to make sure we don't loose any of the existing attributes at the same time

@paul121
Copy link
Member

paul121 commented Aug 11, 2022

Ha - related: walkermatt/ol-popup#145 (comment)

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

No branches or pull requests

2 participants