Jump to content

Leaflet Live Map (Remove Points after closing popup (solution)


Ither

Recommended Posts

Hi.

I grabbed Nabeel files for moving to leaflet and all is well except 1 thing--whenever you click on an aircraft that's on live map you get the bubble popup that shows flight info, nav markers for route, etc. However, when you click X the only thing that disappears is navbubble. How do you get all the markers clear?

--- SOLUTION ---

If you want the points to disappear when clicking "X" in the pop up find the following in acarsmap.js

.bindPopup(tmpl("navpoint_bubble", { nav: nav }))

.bindPopup(detailed_bubble)

and replace with

.bindPopup(tmpl("navpoint_bubble", { nav: nav })).on("popupopen", () => {
					$(".leaflet-popup-close-button").on("click", e => {
						clearSelMarkers();
					})
				})

.bindPopup(detailed_bubble).on("popupopen", () => {
					$(".leaflet-popup-close-button").on("click", e => {
						clearSelMarkers();
					})
				})

 

Edited by Ither
Link to comment
Share on other sites

9 hours ago, ProAvia said:

The markers on the map for VOR, fix, etc, - those along the planned route line, should disappear in 10-30 seconds without any input from the user. I believe the default is 10,000 ms (10 seconds).

 

I thought that 10,000 was refresh rate of the map. Is that the only way to clear markers?

Update it doesn't clear markers for me. I click on airplane; I get the markers for dep/arr/nav fixes and bubble over aircraft showing details. In 10 seconds the bubble disappears but the markers stay and I'm stuck zoomed in on that flight. I want the opposite to happen; I want all markers to go away at most. So that when I zoom out I have clean map of just airplane icons until I click another flight. I've seen other maps do it with Google where you click X on navbubble and it clears everything. I'm not real good with leaflet so I haven't found magic button that does it. I see where markers get pushed tho.

Edited by Ither
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...