Skip to content

Commit 3343ae4

Browse files
committed
show dropdown only with route extras
1 parent e0740fa commit 3343ae4

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

app/javascript/controllers/feature/modal_controller.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ export default class extends Controller {
7373

7474
dom.hideElements(['.edit-point', '.edit-line', '.edit-polygon'])
7575

76+
// Hide stroke color mode dropdown by default (only shown for LineStrings with route extras)
77+
document.querySelector('#stroke-color-mode')?.classList.add('hidden')
78+
7679
// transparent stroke
7780
if (feature.properties.stroke === 'transparent') {
7881
document.querySelector('#stroke-color').setAttribute('disabled', 'true')
@@ -131,16 +134,13 @@ export default class extends Controller {
131134
// Only show dropdown if there are extras options (more than just the default "Color" option)
132135
if (colorModeSelect.options.length > 1) {
133136
colorModeSelect.classList.remove('hidden')
134-
} else {
135-
colorModeSelect.classList.add('hidden')
136137
}
137138
if (feature.properties['show-route-extras']) {
138139
document.querySelector('#stroke-color').setAttribute('disabled', 'true')
139140
}
140141
} else {
141142
// Clear any extra options from previously selected routed features
142143
colorModeSelect.options.length = 1
143-
colorModeSelect.classList.add('hidden')
144144
colorModeSelect.value = ''
145145
}
146146

app/javascript/maplibre/routing/directions.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ class CustomMapLibreGlDirections extends MapLibreGlDirections {
5757
"type": "WAYPOINT",
5858
"id": functions.featureId(),
5959
"index": index,
60-
"label": String.fromCharCode(64 + index+1),
60+
"label": index < 26
61+
? String.fromCharCode(65 + index) // A-Z
62+
: String.fromCharCode(97 + index - 26), // a-z
6163
"highlight": false
6264
}
6365
}

0 commit comments

Comments
 (0)