From 4c794855d6f36a82aec8ee8cc9f375a983ec5686 Mon Sep 17 00:00:00 2001 From: Pyro Nicampt <81565698+PyroNicampt@users.noreply.github.com> Date: Fri, 3 Jan 2025 22:26:47 -0600 Subject: [PATCH] Add grade direction switching to map settings --- index.html | 6 ++++++ index.js | 1 + legend.js | 18 ++++++++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 1e92fa6..018e7a7 100644 --- a/index.html +++ b/index.html @@ -113,6 +113,12 @@ + + + + + + diff --git a/index.js b/index.js index 47c2c7e..d962362 100644 --- a/index.js +++ b/index.js @@ -621,6 +621,7 @@ function drawMarkers(){ markerImg.classList.add('fixedScale', 'sign'); // Grade signs if(markerData.type == 'grade'){ + markerImg.classList.add('gradeArrow'); markerImg.setAttribute('href', '#gradeArrow'); markerImg.setAttribute('fill', Config.gradeColors['grade_'+markerData.gradeClass]); const tanLen = Math.sqrt(markerData.tangent.x*markerData.tangent.x + markerData.tangent.z*markerData.tangent.z) * Math.sign(markerData.tangent.y); diff --git a/legend.js b/legend.js index 5f1cb08..24862b3 100644 --- a/legend.js +++ b/legend.js @@ -75,6 +75,21 @@ let settingEntries = [ }, ] }, + { + label: 'Grade Arrow Direction', + id: 'dropdown_gradeArrowDirection', + options: [ + 'Uphill', + 'Downhill', + ], + default: 'Uphill', + func: state =>{ + let newHref = state == 'Uphill' ? '#gradeArrow' : '#gradeArrowDownhill'; + for(let arrow of document.getElementsByClassName('gradeArrow')){ + arrow.setAttribute('href', newHref); + } + } + }, ]; const legendKey = document.getElementById('legendKey'); @@ -194,7 +209,6 @@ async function setLastUpdateData(){ } function populateKey(){ - addKeyEntry(null, '(Grade arrows point uphill)'); const getGradeValue = gradeIndex => {return Math.round(Utils.gradeIncrements[Utils.gradeIncrements.length-gradeIndex-1]*10000)/100}; for(let i=-1; i', ' Landmark'); addKeyEntry('', ' Garage'); //Add empty entries to make entries align right in the columns. - for(let i=0; i<4; i++){ + for(let i=0; i<3; i++){ addKeyEntry(); } }