-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,20 @@ class RadarMarker extends maplibregl.Marker { | |
} | ||
return super.remove(); | ||
} | ||
|
||
_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); | ||
} | ||
} | ||
Comment on lines
+125
to
+137
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. this is the maplibre gl js implementation There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
} | ||
|
||
export default RadarMarker; |
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?