From 89e6591f9ae54c31f025f1fd26cb15890bb2fc6b Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Fri, 29 Nov 2019 18:03:36 +0100 Subject: [PATCH] trains overlay fixes --- static/js/map/overlays/TrainOverlay.js | 8 ++++---- static/js/map/overlays/TrainsignalOverlay.js | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) 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); } });