diff --git a/assets/js/sections/flightpath.js b/assets/js/sections/flightpath.js index 05e6f7ee7..801e22d4b 100644 --- a/assets/js/sections/flightpath.js +++ b/assets/js/sections/flightpath.js @@ -8,6 +8,18 @@ let saticon = L.divIcon({ iconSize: [30, 30], iconAnchor: [15, 15] // Center the icon }); +let pasticon = L.divIcon({ + html: '', + className: '', + iconSize: [30, 30], + iconAnchor: [15, 15] +}); +let futureicon = L.divIcon({ + html: '', + className: '', + iconSize: [30, 30], + iconAnchor: [15, 15] +}); let homeicon = L.icon({ iconUrl: icon_home_url, iconSize: [15, 15] }); let observerGd = { @@ -247,8 +259,15 @@ Satellite.prototype.update = function () { if (this._altitude < 35700 || this._altitude > 36000) { + pastmarker.remove(); + futuremarker.remove(); + + pastmarker.addTo(leafletMap) + futuremarker.addTo(leafletMap) // Compute paths with Antimeridian handling let { pastSegments, futureSegments } = computePath(this._satrec, this._date, 100, 100, 10); + pastmarker.setLatLng({lat: pastSegments[0][0][0], lng: pastSegments[0][0][1]}); + futuremarker.setLatLng({lat: futureSegments[(futureSegments.length - 1)][futureSegments[(futureSegments.length - 1)].length - 1][0], lng: futureSegments[(futureSegments.length - 1)][futureSegments[(futureSegments.length - 1)].length - 1][1]}); // Remove old polylines if they exist if (this._pastTrajectories) { @@ -430,6 +449,7 @@ function getBearing(lat1, lng1, lat2, lng2) { svgLayer = L.svg(); leafletMap = L.map('sat_map', { zoom: 3, + minZoom: 1, center: [20, 0], // attributionControl: false, layers: [ @@ -447,6 +467,22 @@ function getBearing(lat1, lng1, lat2, lng2) { } ).addTo(leafletMap).on('click', displayUpComingPasses); + pastmarker = L.marker( + [0, 0], { + icon: pasticon, + zIndex: 1000, + } + ); + pastmarker.bindTooltip("-90 min", { permanent: true, offset: [15, 15], className: '', opacity: 0.65 }); + + futuremarker = L.marker( + [0, 0], { + icon: futureicon, + zIndex: 1000, + } + ); + futuremarker.bindTooltip("+90 min", { permanent: true, offset: [15, 15], className: '', opacity: 0.65 }); + // Add an always-visible label (tooltip) satmarker.bindTooltip(satellite, { permanent: true, // Always visible