-
Notifications
You must be signed in to change notification settings - Fork 11
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
RadarMarker click
event
#163
Conversation
_onMapClick(e: maplibregl.MapMouseEvent): void { | ||
const targetElement = e.originalEvent.target; | ||
const element = this._element; | ||
|
||
if (targetElement === element || element.contains(targetElement as any)) { | ||
// TODO: Need to stop propagation somehow | ||
// can use addEventListener in the constructor instead but then the togglePopup logic will be kinda wonky | ||
if (this._popup) { | ||
this.togglePopup(); | ||
} | ||
this.fire('click', this); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kochis i screwed up the commits and the previous PR closed but to address your comment this is a method override
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the maplibre gl js implementation
https://github.com/maplibre/maplibre-gl-js/blob/3000ba109488c5503ce7719066ae0bd8a8100960/src/ui/marker.ts#L472-L479
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: do not do method override. Add a click handler to the marker html element
const element = this._element; | ||
|
||
if (targetElement === element || element.contains(targetElement as any)) { | ||
// TODO: Need to stop propagation somehow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this a bit more?
duplicate of: #167 |
RadarMarker
. This is useful for attaching event listeners to the marker