ttnmapper / ttnmapper-web

TTN Mapper production source code
https://ttnmapper.org
GNU General Public License v3.0
15 stars 5 forks source link

Advanced maps, Device Data problem #6

Open ejanse64 opened 4 years ago

ejanse64 commented 4 years ago

Hi JP, i think I discovered some unwanted behavior using TTNmapper website’s advanced maps, Device Data. When I untick the boxes for gateway markers and/or lines and/or circles and click View Map, all are still in view. There is no &gateway, &lines, &points=off added to the URL and by default the options seems to be on.

MatthewDriver commented 4 years ago

I noticed this issue also. I've been manually tweaking the URL to get the result I wanted (eg. turning off the lines by adding &lines=off ).

I'm not confident to do a pull request but I think the simplest fix is to leave the form code as-is and fix the /devices/ page.

ttnmapper-web/web/devices/index-logic.js

Current code:

 if(findGetParameter("gateways")!="off") {
    gatewayMarkers.addTo(map);
    gatewayMarkersNoCluster.addTo(map);
  }
  if(findGetParameter("points")!="off") {
    pointMarkers.addTo(map);
  }
  if(findGetParameter("lines")!="off") {
    lineMarkers.addTo(map);
  }
  getData();

Suggested fix:

 if(findGetParameter("gateways")=="on") {
    gatewayMarkers.addTo(map);
    gatewayMarkersNoCluster.addTo(map);
  }
  if(findGetParameter("points")=="on") {
    pointMarkers.addTo(map);
  }
  if(findGetParameter("lines")=="on") {
    lineMarkers.addTo(map);
  }
  getData();

Cheers,

Matthew

PS: I so love ttnmapper!