Open mstenta opened 1 year ago
@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
We provide an
addPopup()
method on map instances, which initializes a newPopup
and dispatches a customfarmOS-map.popup
event when asingleclick
is performed on the map. However, it doesn't pass the click coordinate into thefarmOS-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: https://github.com/farmOS/farmOS-map/blob/777758f7218499e2211c5d75c1faf3dbea87904a/src/instance/methods/popup.js#L16... so
event.coordinate
is not accessible in the downstream behavior.