1
0
forked from MTSR/mapserver

train hide on zoom level

This commit is contained in:
NatureFreshMilk 2019-07-16 08:35:36 +02:00
parent dc4ea1d580
commit 9266c47c1e

View File

@ -66,6 +66,11 @@ export default L.LayerGroup.extend({
return html;
},
getMaxDisplayedZoom: function(){
return 8;
},
createMarker: function(train){
//search for wagin in front (whatever "front" is...)
@ -102,6 +107,13 @@ export default L.LayerGroup.extend({
onMinetestUpdate: function(/*info*/){
if (this.map.getZoom() < this.getMaxDisplayedZoom()) {
this.clearLayers();
this.currentObjects = {};
return;
}
this.trains.forEach(train => {
var isInLayer = this.isTrainInCurrentLayer(train);
@ -148,6 +160,10 @@ export default L.LayerGroup.extend({
this.currentObjects = {};
this.clearLayers();
if (this.map.getZoom() < this.getMaxDisplayedZoom()) {
return;
}
var mapLayer = this.layerMgr.getCurrentLayer();
this.trains.forEach(train => {