From ace90fe43222ea5be7d5ba84bc4dbfcfd6dc407e Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Wed, 3 Apr 2019 21:31:36 +0200 Subject: [PATCH] proper train display --- server/static/js/overlays/AbstractGeoJsonOverlay.js | 6 +++++- server/static/js/overlays/TrainOverlay.js | 2 +- server/static/js/overlays/TrainlineOverlay.js | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/server/static/js/overlays/AbstractGeoJsonOverlay.js b/server/static/js/overlays/AbstractGeoJsonOverlay.js index afec469..f8052c0 100644 --- a/server/static/js/overlays/AbstractGeoJsonOverlay.js +++ b/server/static/js/overlays/AbstractGeoJsonOverlay.js @@ -43,10 +43,14 @@ var AbstractGeoJsonOverlay = L.LayerGroup.extend({ return geoJsonLayer; }, + getMaxDisplayedZoom: function(){ + return 7; + }, + reDraw: function(){ var self = this; - if (this.map.getZoom() < 10) { + if (this.map.getZoom() < this.getMaxDisplayedZoom()) { this.clearLayers(); return; } diff --git a/server/static/js/overlays/TrainOverlay.js b/server/static/js/overlays/TrainOverlay.js index 166a013..d8de722 100644 --- a/server/static/js/overlays/TrainOverlay.js +++ b/server/static/js/overlays/TrainOverlay.js @@ -137,7 +137,7 @@ var TrainOverlay = L.LayerGroup.extend({ var mapLayer = this.layerMgr.getCurrentLayer() this.trains.forEach(function(train){ - if (!self.isPlayerInCurrentLayer(train)){ + if (!self.isTrainInCurrentLayer(train)){ //not in current layer return; } diff --git a/server/static/js/overlays/TrainlineOverlay.js b/server/static/js/overlays/TrainlineOverlay.js index 0dd88a5..a2d1062 100644 --- a/server/static/js/overlays/TrainlineOverlay.js +++ b/server/static/js/overlays/TrainlineOverlay.js @@ -15,6 +15,16 @@ var TrainlineOverlay = AbstractGeoJsonOverlay.extend({ } }, pointToLayer: function (feature, latlng) { + + var geojsonMarkerOptions = { + radius: 8, + fillColor: "#ff7800", + color: "#000", + weight: 1, + opacity: 1, + fillOpacity: 0.8 + }; + return L.circleMarker(latlng, geojsonMarkerOptions); } });