diff --git a/static/js/map/overlays/TrainOverlay.js b/static/js/map/overlays/TrainOverlay.js index 4b55cfc..271331d 100644 --- a/static/js/map/overlays/TrainOverlay.js +++ b/static/js/map/overlays/TrainOverlay.js @@ -44,7 +44,7 @@ export default L.LayerGroup.extend({ this.currentObjects = {}; // name => marker - this.reDraw = this.reDraw.bind(this); + this.onMinetestUpdate = this.onMinetestUpdate.bind(this); }, createPopup: function(train){ @@ -67,7 +67,7 @@ export default L.LayerGroup.extend({ getMaxDisplayedZoom: function(){ - return 8; + return 10; }, createMarker: function(train){ @@ -180,12 +180,12 @@ export default L.LayerGroup.extend({ onAdd: function(map) { this.map = map; - wsChannel.addListener("minetest-info", () => this.onMinetestUpdate()); + wsChannel.addListener("minetest-info", this.onMinetestUpdate); this.reDraw(); }, onRemove: function(/*map*/) { this.clearLayers(); - wsChannel.removeListener("minetest-info", () => this.onMinetestUpdate()); + wsChannel.removeListener("minetest-info", this.onMinetestUpdate); } }); diff --git a/static/js/map/overlays/TrainsignalOverlay.js b/static/js/map/overlays/TrainsignalOverlay.js index 4336dd7..68c30d2 100644 --- a/static/js/map/overlays/TrainsignalOverlay.js +++ b/static/js/map/overlays/TrainsignalOverlay.js @@ -27,6 +27,7 @@ export default L.LayerGroup.extend({ L.LayerGroup.prototype.initialize.call(this); this.currentObjects = {}; // name => marker + this.onMinetestUpdate = this.onMinetestUpdate.bind(this); }, createPopup: function(signal){ @@ -140,12 +141,12 @@ export default L.LayerGroup.extend({ onAdd: function(map) { this.map = map; - wsChannel.addListener("minetest-info", () => this.onMinetestUpdate()); + wsChannel.addListener("minetest-info", this.onMinetestUpdate); this.reDraw(); }, onRemove: function(/*map*/) { this.clearLayers(); - wsChannel.removeListener("minetest-info", () => this.onMinetestUpdate()); + wsChannel.removeListener("minetest-info", this.onMinetestUpdate); } });