File tree Expand file tree Collapse file tree 3 files changed +41
-3
lines changed
Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,13 @@ <h2><i class="icon-settings rfloat"></i>Settings</h2>
151151 < input type ="checkbox " id ="opt_hide_receivers ">
152152 </ div >
153153 </ div >
154+ < div class ="row option ">
155+ < span > < b > Highlight selected vehicle</ b > </ span >
156+ < div class ="switch off " id ="sw_hilight_vehicle ">
157+ < span class ="thumb "> </ span >
158+ < input type ="checkbox " id ="opt_hilight_vehicle ">
159+ </ div >
160+ </ div >
154161 < div class ="row option ">
155162 < span > < b > Availability offline</ b > </ span >
156163 < div class ="switch off " id ="sw_offline ">
Original file line number Diff line number Diff line change @@ -578,7 +578,8 @@ $(window).ready(function() {
578578 "#sw_haxis_hours" ,
579579 "#sw_daylight" ,
580580 "#sw_hide_receivers" ,
581- "#sw_hide_timebox"
581+ "#sw_hide_timebox" ,
582+ "#sw_hilight_vehicle"
582583 ] ;
583584
584585 // applies functionality when switches are toggled
@@ -606,8 +607,12 @@ $(window).ready(function() {
606607
607608 // execute functionality
608609 switch ( name ) {
609- case "opt_imperial" :;
610- case "opt_haxis_hours" :;
610+ case "opt_hilight_vehicle" :
611+ if ( on ) focusVehicle ( follow_vehicle ) ;
612+ else focusVehicle ( - 1 ) ;
613+ break ;
614+ case "opt_imperial" :
615+ case "opt_haxis_hours" :
611616 refreshUI ( ) ;
612617 break ;
613618 case "opt_daylight" :
Original file line number Diff line number Diff line change @@ -533,9 +533,33 @@ function updateZoom() {
533533 }
534534}
535535
536+ function focusVehicle ( index , ignoreOpt ) {
537+ if ( ! offline . get ( 'opt_hilight_vehicle' ) && ignoreOpt == undefined ) return ;
538+
539+ var opacityFocused = 0.8 ;
540+ var opacityOther = 0.1 ;
541+
542+ if ( index < 0 ) opacityOther = opacityFocused ;
543+
544+ for ( var i in vehicles ) {
545+ var vehicle = vehicles [ i ] ;
546+
547+ if ( i == index ) {
548+ if ( vehicle . horizon_circle ) vehicle . horizon_circle . setOptions ( { strokeOpacity :opacityFocused } ) ;
549+ if ( vehicle . subhorizon_circle ) vehicle . subhorizon_circle . setOptions ( { strokeOpacity :opacityFocused } ) ;
550+ for ( var j in vehicle . polyline ) vehicle . polyline [ j ] . setOptions ( { strokeOpacity :opacityFocused } ) ;
551+ }
552+ else {
553+ if ( vehicle . horizon_circle ) vehicle . horizon_circle . setOptions ( { strokeOpacity :opacityOther } ) ;
554+ if ( vehicle . subhorizon_circle ) vehicle . subhorizon_circle . setOptions ( { strokeOpacity :opacityOther } ) ;
555+ for ( var j in vehicle . polyline ) vehicle . polyline [ j ] . setOptions ( { strokeOpacity :opacityOther } ) ;
556+ }
557+ }
558+ }
536559
537560function stopFollow ( ) {
538561 if ( follow_vehicle != - 1 ) {
562+ focusVehicle ( - 1 ) ;
539563 // remove target mark
540564 $ ( "#main .row.follow" ) . removeClass ( "follow" ) ;
541565
@@ -555,6 +579,8 @@ function followVehicle(index) {
555579 if ( follow_vehicle != - 1 && vehicles . length ) vehicles [ follow_vehicle ] . follow = false ;
556580
557581 if ( follow_vehicle != index ) {
582+ focusVehicle ( index ) ;
583+
558584 follow_vehicle = index ;
559585 vehicles [ follow_vehicle ] . follow = true ;
560586
You can’t perform that action at this time.
0 commit comments