@@ -251,6 +251,11 @@ class RouteDraw {
251251 }
252252 this . #saveState( ) ;
253253 DOM . $routeDrawCancel . classList . add ( "inactive" ) ;
254+ if ( this . data . isTrack ) {
255+ this . changeMode ( 0 ) ;
256+ } else {
257+ this . changeMode ( 1 ) ;
258+ }
254259 this . __updateRouteInfo ( this . data ) ;
255260 this . #updateSources( ) ;
256261 }
@@ -606,19 +611,17 @@ class RouteDraw {
606611 this . #updateSources( ) ;
607612 var promises = [ ] ;
608613 if ( index > 0 ) {
609- const mode = this . data . steps [ index - 1 ] ? this . data . steps [ index - 1 ] . properties . mode : this . mode ;
610- const computeBefore = this . #computeStep( index - 1 , mode , false ) ;
614+ const computeBefore = this . #computeStep( index - 1 , this . mode , false ) ;
611615 promises . push ( computeBefore ) ;
612- if ( this . mode === 1 && this . data . steps [ index - 1 ] . properties . mode === 0 && index > 1 ) {
613- computeBefore . then ( ( ) => promises . push ( this . #computeStep( index - 2 , this . data . steps [ index - 2 ] . properties . mode , false ) ) ) ;
616+ if ( this . mode === 1 && index > 1 ) {
617+ computeBefore . then ( ( ) => promises . push ( this . #computeStep( index - 2 , 0 , false ) ) ) ;
614618 }
615619 }
616620 if ( index < this . data . points . length - 1 ) {
617- const mode = this . data . steps [ index ] ? this . data . steps [ index ] . properties . mode : this . mode ;
618- const computeAfter = this . #computeStep( index , mode , false ) ;
621+ const computeAfter = this . #computeStep( index , this . mode , false ) ;
619622 promises . push ( computeAfter ) ;
620- if ( this . mode === 1 && index < this . data . points . length - 2 && this . data . steps [ index ] . properties . mode === 0 ) {
621- computeAfter . then ( ( ) => promises . push ( this . #computeStep( index + 1 , this . data . steps [ index + 1 ] . properties . mode , false ) ) ) ;
623+ if ( this . mode === 1 && index < this . data . points . length - 2 ) {
624+ computeAfter . then ( ( ) => promises . push ( this . #computeStep( index + 1 , 0 , false ) ) ) ;
622625 }
623626 }
624627 Promise . all ( promises ) . then ( ( ) => {
0 commit comments