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

RadarMarker click event #163

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/ui/RadarMarker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

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?

// 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
Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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

}

export default RadarMarker;
Loading