Skip to content

Commit 964e8a0

Browse files
committed
fix: sort stations, invert dock ratio and move location back
1 parent a78721e commit 964e8a0

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

scripts/map.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ async function initMap() {
128128
function mapDotSVG(ratio, docks = false) {
129129
// Calculate the Y coordinate at which the top of the "fill" rectangle will be
130130
// (the filled area is only visible from y=18 to y=430)
131-
const y = (18 + (1 - ratio) * (430 - 18)).toFixed(0);
131+
const effectiveRatio = docks ? 1 - ratio : ratio;
132+
const y = (18 + (1 - effectiveRatio) * (430 - 18)).toFixed(0);
132133

133134
// Create the SVG itself
134135
const svgString = `
@@ -171,7 +172,7 @@ async function loadStationMarkersFromArray(stationsArray, showDocks = false) {
171172

172173
let featuresArray = [];
173174

174-
for (const [featureID, station] of stationsArray.entries()) {
175+
for (const [featureID, station] of stationsArray.sort((a, b) => b.latitude - a.latitude).entries()) {
175176
let position = [station.longitude, station.latitude];
176177

177178
const iconFeature = new ol.Feature({
@@ -268,7 +269,7 @@ async function loadStationMarkersFromArray(stationsArray, showDocks = false) {
268269
className: "stationsLayer",
269270
name: "stationsLayer",
270271
source: vectorSource,
271-
zIndex: 0,
272+
zIndex: 2,
272273
//declutter: true
273274
});
274275

@@ -332,7 +333,7 @@ function getLocation(zoom = true, followLocationOverride) {
332333
const vectorLayer = new ol.layer.Vector({
333334
name: "currentLocationLayer",
334335
source: vectorSource,
335-
zIndex: 99,
336+
zIndex: 1,
336337
updateWhileInteracting: true,
337338
});
338339

scripts/user.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,6 @@ async function openTripHistory() {
502502
</div>
503503
`.trim();
504504

505-
console.log(tripHistory);
506-
507505
// populate the trip list
508506
addTripsToDOM(tripHistory);
509507

0 commit comments

Comments
 (0)