Wrong Marker Opening on Click

9 vistas
Ir al primer mensaje no leído

Keith Kaiser

no leída,
1 nov 2022, 12:49:38 p.m.1/11/22
para Leaflet
This is the URL to a map, https://net-control.us/map.php?NetID=7544 it is created via MySQL/PHP/Javascript but is complete as is. Please click on the list at the left at marker #6 which is DL6GE, it will open the appropriate marker on the map.

Close the open dialog and click on the marker itself, it should (and might) open that marker again. But if you click it or others (try 11) of the markers on the map eventually it will open the man-in-the-middle or one of the corner black flags instead of the clicked marker. When the click goes wrong it always opens one of the black flags or the man-in-the-middle.

The definitions of the individual markers are at the correct lat/lon pairs, which can be checked by looking at the page source. So why is the wrong item on the map opening? This happens in Safari, FireFox and Chrome most often in Safari however. Am I supposed to have some kind of code in the program to flush out some old values or something? 

Any thoughts or ideas would be appreciated.


Keith, WA0̷TJT
Author: https://net-control.us
ARRL ARES Communicator Level 2, AEC for Platte Co. MO
KCHEART Radio Operator - St. Lukes Barry Road Hospital

Mark Lawton

no leída,
1 nov 2022, 2:01:20 p.m.1/11/22
para leafl...@googlegroups.com
keith,

Thanks for the thorough description.  I tried on a mac with chrome and was unable to replicate the problem.  My only guess is that maybe you are recreating the markers each time there is a click?  If so, that might lead to some sort of memory problem.  But, as i said, i couldn’t replicate the problem.

Mark

--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leaflet-js/27882659-9C63-4E0F-9FDA-D9A5E9E631F4%40gmail.com.

Keith Kaiser

no leída,
1 nov 2022, 2:06:05 p.m.1/11/22
para Leaflet
Thanks Mark. 
I’m certainly not recreating the markers at each click. The page is built once for use and then stays unchanged by the user at the time.

Any change you tried it with Safari? I’m a Mac user and do all the development on Mac also.

Keith, WA0̷TJT
Author: https://net-control.us
ARRL ARES Communicator Level 2, AEC for Platte Co. MO
KCHEART Radio Operator - St. Lukes Barry Road Hospital

Mark Lawton

no leída,
1 nov 2022, 2:12:26 p.m.1/11/22
para leafl...@googlegroups.com
just tried it in safari on a mac and it seems to be working fine as well.

On Nov 1, 2022, at 11:05 AM, Keith Kaiser <wa0...@gmail.com> wrote:


Keith Kaiser

no leída,
1 nov 2022, 2:16:37 p.m.1/11/22
para leafl...@googlegroups.com
Just to double check me… did you try clicking on several different markers not the list on the left but the marker itself?

I just can resolve what I see vs what you are seeing. Truth is no one has ever complained to me about it either, and there are a lot of users for this program.  This map is created using my net control manager see https://net-control.us built entirely on my Mac.


Keith, WA0̷TJT
Author: https://net-control.us
ARRL ARES Communicator Level 2, AEC for Platte Co. MO
KCHEART Radio Operator - St. Lukes Barry Road Hospital
--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.

Mark Lawton

no leída,
1 nov 2022, 2:23:51 p.m.1/11/22
para leafl...@googlegroups.com
yep, i clicked many markers (probably 50 reps).  they all pop up in the right space with the right text and close correctly.  i don’t see anything popping up in other places.

is it possible that the published version and the version with the problem are different?



Keith Kaiser

no leída,
1 nov 2022, 2:45:35 p.m.1/11/22
para leafl...@googlegroups.com
I guess anything is possible but I did send it to my wife to try on her Mac as well and she DOES NOT have the issue.
You can try it go to https://net-control.us, use the big dropdown to pick net #7544, at the bottom it says 'map this net' click that. It should open the exact same map.

But I think I’m starting to find its only on my Macs, both my m1 mini and my m2 MacBook Air, I just don’t know what setting might be causing it.

Keith, WA0̷TJT
Author: https://net-control.us
ARRL ARES Communicator Level 2, AEC for Platte Co. MO
KCHEART Radio Operator - St. Lukes Barry Road Hospital

Mark Lawton

no leída,
1 nov 2022, 3:37:41 p.m.1/11/22
para leafl...@googlegroups.com
if you send me the pertinent code, I can look to see if there is anything obviously off.



Keith Kaiser

no leída,
1 nov 2022, 4:59:04 p.m.1/11/22
para leafl...@googlegroups.com
You have it, the page source, everything else is a PHP code attached (mostly).

map.php
poiMarkers.php

Mark Lawton

no leída,
1 nov 2022, 5:35:34 p.m.1/11/22
para leafl...@googlegroups.com
kk,

i’m not an expert on this but you might try binding the popup to the marker before adding it to the map.

also why do you call openPopUp ? (once it is bound, it should open when the user clicks).



> On Nov 1, 2022, at 1:58 PM, Keith Kaiser <wa0...@gmail.com> wrote:
>
> <map.php>

Keith Kaiser

no leída,
1 nov 2022, 6:40:54 p.m.1/11/22
para leafl...@googlegroups.com
I like your ideas just not sure how to do them. How would I go about binding the popup in advance of adding to the map?
I’ll have to look at the openPopUP and see what I know there too. I’m sure when I wrote this (several years ago) there was a reason I did it all, I just don’t remember them.

Thanks for the input I really appreciate your time.

Keith, WA0̷TJT
Author: https://net-control.us
ARRL ARES Communicator Level 2, AEC for Platte Co. MO
KCHEART Radio Operator - St. Lukes Barry Road Hospital
--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.

Keith Kaiser

no leída,
1 nov 2022, 6:53:31 p.m.1/11/22
para leafl...@googlegroups.com
It appears that openPopup is required to make the links in the left hand list work. I took it out of the code and tried things, all seemed to work until I tried the list. After which it started opening the wrong things again. 
Still working on it… I’ll keep trying.

Keith, WA0̷TJT
Author: https://net-control.us
ARRL ARES Communicator Level 2, AEC for Platte Co. MO
KCHEART Radio Operator - St. Lukes Barry Road Hospital
--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.

Mark Lawton

no leída,
1 nov 2022, 6:53:34 p.m.1/11/22
para leafl...@googlegroups.com
something like this (this is just pseudo code)

myNewMarker = new L.marker
myPopUp = new L.popup (‘the text’)

myNewMarker.bindPopUp(myPopUp);

myNewMarker.addTo(myMap)
> To view this discussion on the web visit https://groups.google.com/d/msgid/leaflet-js/506A53A1-BFAA-43F8-9B0A-57513C99D4C7%40gmail.com.

Keith Kaiser

no leída,
1 nov 2022, 7:00:19 p.m.1/11/22
para leafl...@googlegroups.com
I tried removing the openPopUp from ;
title:`marker_$markNO`}).addTo(fg).bindPopup(`$row[tactical]<br>$row[addr]<br>$gs`); /*.openPopup(); */ 
That also works but this time includes the list. But I still get the phantom opening of the black flags.

Keith, WA0̷TJT
Author: https://net-control.us
ARRL ARES Communicator Level 2, AEC for Platte Co. MO
KCHEART Radio Operator - St. Lukes Barry Road Hospital
--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.

Mark Lawton

no leída,
1 nov 2022, 7:00:40 p.m.1/11/22
para leafl...@googlegroups.com
that’s right.  i forgot that you are opening the popup using the left hand list.  

you can bind the popup to the marker, that will cause the marker to open the popup when you click it.

meanwhile, you can also have a click handler for the list so that each item also opens a popup.



Mark Lawton

no leída,
1 nov 2022, 7:02:57 p.m.1/11/22
para leafl...@googlegroups.com
that’s a weird problem.  maybe look closer into the black flags and see maybe if something is wrong with the way they are created and or stored.

there might be, for example, an error created when copying an array.  remember, in javascript copying an array to a new array doesn’t actually create a new array.  so, if you copy a to b then change some content of a, b will change also.



Keith Kaiser

no leída,
1 nov 2022, 7:03:30 p.m.1/11/22
para leafl...@googlegroups.com
I seem to have stumbled on something. If the map is small enough where two or more markers overlap, they open one of the black flags. If I widen the map so they no longer overlap, I can’t duplicate the issue. 
I’m not sure what that means yet, but its progress.

Keith, WA0̷TJT
Author: https://net-control.us
ARRL ARES Communicator Level 2, AEC for Platte Co. MO
KCHEART Radio Operator - St. Lukes Barry Road Hospital
--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.

Mark Lawton

no leída,
1 nov 2022, 7:22:17 p.m.1/11/22
para leafl...@googlegroups.com
sounds like you are on to it.  congratulations.

there is a new rabbit hole that awaits you…  marker clustering to deal with overlapping markers.  it works nicely.

you can see it in action on my website.


Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos