consider each marker to be a midpoint

This commit is contained in:
zyphlar 2023-05-24 13:28:42 -07:00
parent 0117a3fe7e
commit ec9c502040
Signed by: will
GPG Key ID: 1159B930701263F3

View File

@ -312,8 +312,8 @@
const longForm = document.querySelector("#long"); const longForm = document.querySelector("#long");
function loadMapCoords(e){ function loadMapCoords(e){
latForm.value = e.latlng.lat; latForm.value = Math.round(e.latlng.lat*100)/100;
longForm.value = e.latlng.lng; longForm.value = Math.round(e.latlng.lng*100)/100;
render({coords: { latitude: latForm.value , longitude: longForm.value }}); render({coords: { latitude: latForm.value , longitude: longForm.value }});
} }
@ -342,8 +342,8 @@
function getLocation() { function getLocation() {
if (navigator.geolocation) { if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(gpsCoords){ navigator.geolocation.getCurrentPosition(function(gpsCoords){
latForm.value = gpsCoords.coords.latitude; latForm.value = Math.round(gpsCoords.coords.latitude*100)/100;
longForm.value = gpsCoords.coords.longitude; longForm.value = Math.round(gpsCoords.coords.longitude*100)/100;
render(gpsCoords); render(gpsCoords);
}, function(err){ }, function(err){
console.error("Invalid geo:", err); console.error("Invalid geo:", err);
@ -361,7 +361,7 @@
return false; return false;
} }
let now = DateTime.fromFormat("1:15:00 PM +0000", 'h:mm:ss a ZZZ'); let now = DateTime.now(); //.fromFormat("1:15:00 PM +0000", 'h:mm:ss a ZZZ');
let sunrise = DateTime.fromFormat(json.results.sunrise+" +0000", 'h:mm:ss a ZZZ'); let sunrise = DateTime.fromFormat(json.results.sunrise+" +0000", 'h:mm:ss a ZZZ');
// handle sunrises that are tomorrow UTC // handle sunrises that are tomorrow UTC
@ -389,24 +389,16 @@
let romanMinute = romanTime-romanHour; let romanMinute = romanTime-romanHour;
var romanMinuteEnglish = ""; var romanMinuteEnglish = "";
if (romanMinute < 0.2) { if (romanMinute < 0.33) {
romanMinuteEnglish = "just after"; romanMinuteEnglish = "just beginning";
} else if (romanMinute < 0.4) { } else if (romanMinute < 0.66) {
romanMinuteEnglish = "quarter after"; romanMinuteEnglish = "midway through";
} else if (romanMinute < 0.6) {
romanMinuteEnglish = "half after";
} else if (romanMinute < 0.8) {
romanMinuteEnglish = "three quarters after";
} else { } else {
romanHour = romanHour+1; romanMinuteEnglish = "nearly past";
romanMinuteEnglish = "almost";
} }
// 0 special case // from here on out we increment by 1 because the instant daylight begins it's the first hour
if (romanHour == 0) {
romanHour = romanHour+1; romanHour = romanHour+1;
romanMinuteEnglish = "soon to be";
}
let romanNumeralHourArr = ["0", "I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII"]; let romanNumeralHourArr = ["0", "I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII"];
let romanNumeralHour = romanNumeralHourArr[romanHour]; let romanNumeralHour = romanNumeralHourArr[romanHour];
@ -424,8 +416,8 @@
if (msAfterSunrise > 0 && percentOfDay < 1) { if (msAfterSunrise > 0 && percentOfDay < 1) {
document.getElementById('clock').innerHTML = "It is "+romanMinuteEnglish+" <a href='https://en.wikipedia.org/wiki/Roman_timekeeping'>Hora "+romanHour+" ("+romanNumeralHour+")</a><br/>AKA "+(Math.round(percentOfDay*10000)/100)+"% through today's daylight."; document.getElementById('clock').innerHTML = "It is "+romanMinuteEnglish+" <a href='https://en.wikipedia.org/wiki/Roman_timekeeping'>Hora "+romanHour+" ("+romanNumeralHour+")</a><br/>AKA "+(Math.round(percentOfDay*10000)/100)+"% through today's daylight.";
let zeroHrDeg = 86; let zeroHrDeg = 82;
let twelveHrDeg = -82; let twelveHrDeg = -91;
let degreeSweep = twelveHrDeg-zeroHrDeg; let degreeSweep = twelveHrDeg-zeroHrDeg;
let sundialDegree = percentOfDay*degreeSweep+zeroHrDeg; let sundialDegree = percentOfDay*degreeSweep+zeroHrDeg;