@@ -303,8 +303,8 @@ class TrainsRealtime extends HTMLElement {
303303 return `+${ min } min` ;
304304 }
305305
306- _pillWidth ( vehicleId , dest ) {
307- const raw = `${ vehicleId } - ${ dest } ` ;
306+ _pillWidth ( lineName , dest ) {
307+ const raw = `${ lineName } - ${ dest } ` ;
308308 const text = raw . length > 18 ? raw . substring ( 0 , 17 ) + '…' : raw ;
309309 return Math . max ( 48 , text . length * 6 + 14 ) ;
310310 }
@@ -325,9 +325,9 @@ class TrainsRealtime extends HTMLElement {
325325 } ) ;
326326 }
327327
328- _makeLabelIcon ( vehicleId , dest , delaySec ) {
328+ _makeLabelIcon ( lineName , dest , delaySec ) {
329329 const color = this . _delayColor ( delaySec ) ;
330- const raw = `${ vehicleId } - ${ dest } ` ;
330+ const raw = `${ lineName } - ${ dest } ` ;
331331 const label = this . _esc ( raw . length > 18 ? raw . substring ( 0 , 17 ) + '…' : raw ) ;
332332 const pillW = Math . max ( 48 , label . length * 6 + 14 ) ;
333333
@@ -376,14 +376,15 @@ class TrainsRealtime extends HTMLElement {
376376 const j = v . MonitoredVehicleJourney ;
377377 if ( ! j ?. VehicleLocation ) continue ;
378378
379- const id = j . VehicleRef ?. value ?? String ( Math . random ( ) ) ;
380- const lat = j . VehicleLocation . Latitude ;
381- const lon = j . VehicleLocation . Longitude ;
382- const dest = j . DirectionName ?. [ 0 ] ?. value ?? '?' ;
383- const delay = this . _delaySeconds ( j . Delay ) ;
384- const color = this . _delayColor ( delay ) ;
385- const pillW = this . _pillWidth ( id , dest ) ;
386- const popup = this . _popupHtml ( j , id , delay , v . RecordedAtTime ) ;
379+ const id = j . VehicleRef ?. value ?? String ( Math . random ( ) ) ;
380+ const lat = j . VehicleLocation . Latitude ;
381+ const lon = j . VehicleLocation . Longitude ;
382+ const dest = j . DirectionName ?. [ 0 ] ?. value ?? '?' ;
383+ const lineName = j . PublishedLineName ?. [ 0 ] ?. value ?? '?' ;
384+ const delay = this . _delaySeconds ( j . Delay ) ;
385+ const color = this . _delayColor ( delay ) ;
386+ const pillW = this . _pillWidth ( lineName , dest ) ;
387+ const popup = this . _popupHtml ( j , id , delay , v . RecordedAtTime ) ;
387388
388389 seen . add ( id ) ;
389390 this . _markerData . set ( id , { pillW, color } ) ;
@@ -396,7 +397,7 @@ class TrainsRealtime extends HTMLElement {
396397 dot . setIcon ( this . _makeDotIcon ( color ) ) ;
397398 dot . getPopup ( ) . setContent ( popup ) ;
398399 dot . getTooltip ( ) . setContent ( this . _esc ( dest ) ) ;
399- label . setIcon ( this . _makeLabelIcon ( id , dest , delay ) ) ;
400+ label . setIcon ( this . _makeLabelIcon ( lineName , dest , delay ) ) ;
400401 label . getPopup ( ) . setContent ( popup ) ;
401402 line . setStyle ( { color } ) ;
402403 } else {
@@ -406,7 +407,7 @@ class TrainsRealtime extends HTMLElement {
406407 . addTo ( this . _map ) ;
407408 this . _dots . set ( id , dot ) ;
408409
409- const label = L . marker ( [ lat , lon ] , { icon : this . _makeLabelIcon ( id , dest , delay ) } )
410+ const label = L . marker ( [ lat , lon ] , { icon : this . _makeLabelIcon ( lineName , dest , delay ) } )
410411 . bindPopup ( popup )
411412 . addTo ( this . _map ) ;
412413 this . _labels . set ( id , label ) ;
0 commit comments