From 32f0234ba44c732d9f3812a6fc84370fb32452f8 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 3 Apr 2025 18:27:39 +0200 Subject: [PATCH 1/6] Add markers to +/- 90 min position --- assets/js/sections/flightpath.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/assets/js/sections/flightpath.js b/assets/js/sections/flightpath.js index 05e6f7ee7..36b09d065 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 = { @@ -249,6 +261,8 @@ Satellite.prototype.update = function () { // 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][(futureSegments.length - 1)]}); // Remove old polylines if they exist if (this._pastTrajectories) { @@ -447,6 +461,22 @@ function getBearing(lat1, lng1, lat2, lng2) { } ).addTo(leafletMap).on('click', displayUpComingPasses); + pastmarker = L.marker( + [0, 0], { + icon: pasticon, + zIndex: 1000, + } + ).addTo(leafletMap); + pastmarker.bindTooltip("-90 min", { permanent: true, offset: [15, 15], className: '', opacity: 0.65 }); + + futuremarker = L.marker( + [0, 0], { + icon: futureicon, + zIndex: 1000, + } + ).addTo(leafletMap); + 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 From 2f6e063b53104a6ad16da85efffe35a7c4d57216 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 3 Apr 2025 21:27:19 +0200 Subject: [PATCH 2/6] Add past/future markers only for non-GEO sats --- assets/js/sections/flightpath.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/assets/js/sections/flightpath.js b/assets/js/sections/flightpath.js index 36b09d065..0cc6e9d30 100644 --- a/assets/js/sections/flightpath.js +++ b/assets/js/sections/flightpath.js @@ -259,6 +259,11 @@ 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]}); @@ -466,7 +471,7 @@ function getBearing(lat1, lng1, lat2, lng2) { icon: pasticon, zIndex: 1000, } - ).addTo(leafletMap); + ); pastmarker.bindTooltip("-90 min", { permanent: true, offset: [15, 15], className: '', opacity: 0.65 }); futuremarker = L.marker( @@ -474,7 +479,7 @@ function getBearing(lat1, lng1, lat2, lng2) { icon: futureicon, zIndex: 1000, } - ).addTo(leafletMap); + ); futuremarker.bindTooltip("+90 min", { permanent: true, offset: [15, 15], className: '', opacity: 0.65 }); // Add an always-visible label (tooltip) From f7dffdbe3ba50c7e08c6cfa4c5cba93d93610458 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 3 Apr 2025 21:28:37 +0200 Subject: [PATCH 3/6] Limit minZoom to 1 in order to prevent tab crashing --- assets/js/sections/flightpath.js | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/js/sections/flightpath.js b/assets/js/sections/flightpath.js index 0cc6e9d30..b689f6f82 100644 --- a/assets/js/sections/flightpath.js +++ b/assets/js/sections/flightpath.js @@ -449,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: [ From b301238f9f2905302e3f48823edf09bf3957cb1f Mon Sep 17 00:00:00 2001 From: phl0 Date: Fri, 4 Apr 2025 07:47:19 +0200 Subject: [PATCH 4/6] Take the last but one pos just to make sure its not NaN in lat/lon --- assets/js/sections/flightpath.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/sections/flightpath.js b/assets/js/sections/flightpath.js index b689f6f82..7156c2f9e 100644 --- a/assets/js/sections/flightpath.js +++ b/assets/js/sections/flightpath.js @@ -267,7 +267,7 @@ Satellite.prototype.update = function () { // 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][(futureSegments.length - 1)]}); + futuremarker.setLatLng({lat: futureSegments[(futureSegments.length - 2)][futureSegments[(futureSegments.length - 2)].length - 1][0], lng: futureSegments[(futureSegments.length - 2)][futureSegments[(futureSegments.length - 2)].length - 1][(futureSegments.length - 2)]}); // Remove old polylines if they exist if (this._pastTrajectories) { From 712ccdb82540625890f671ead9b6221534c49b79 Mon Sep 17 00:00:00 2001 From: phl0 Date: Fri, 4 Apr 2025 07:50:28 +0200 Subject: [PATCH 5/6] Revert "Take the last but one pos just to make sure its not NaN in lat/lon" This reverts commit b301238f9f2905302e3f48823edf09bf3957cb1f. --- assets/js/sections/flightpath.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/sections/flightpath.js b/assets/js/sections/flightpath.js index 7156c2f9e..b689f6f82 100644 --- a/assets/js/sections/flightpath.js +++ b/assets/js/sections/flightpath.js @@ -267,7 +267,7 @@ Satellite.prototype.update = function () { // 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 - 2)][futureSegments[(futureSegments.length - 2)].length - 1][0], lng: futureSegments[(futureSegments.length - 2)][futureSegments[(futureSegments.length - 2)].length - 1][(futureSegments.length - 2)]}); + 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][(futureSegments.length - 1)]}); // Remove old polylines if they exist if (this._pastTrajectories) { From 6262e5695e616ebf4101b36cc48199dfa1bf3bf2 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 4 Apr 2025 17:40:29 +0200 Subject: [PATCH 6/6] Might have fixed an error in some cases with futuremarker --- assets/js/sections/flightpath.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/sections/flightpath.js b/assets/js/sections/flightpath.js index b689f6f82..801e22d4b 100644 --- a/assets/js/sections/flightpath.js +++ b/assets/js/sections/flightpath.js @@ -267,7 +267,7 @@ Satellite.prototype.update = function () { // 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][(futureSegments.length - 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) {