@@ -1191,13 +1191,11 @@ let MeasureTool = {
11911191
11921192function recomputeLineOfSight ( ) {
11931193 MeasureTool . lineOfSight = [ ]
1194- if ( LOS . on ) {
1195- F_ . chunkArray ( profileData , steps ) . forEach ( ( chunk ) => {
1196- MeasureTool . lineOfSight = MeasureTool . lineOfSight . concat (
1197- F_ . lineOfSight1D ( chunk , LOS . observerHeight , LOS . targetHeight )
1198- )
1199- } )
1200- }
1194+ F_ . chunkArray ( profileData , steps ) . forEach ( ( chunk ) => {
1195+ MeasureTool . lineOfSight = MeasureTool . lineOfSight . concat (
1196+ F_ . lineOfSight1D ( chunk , LOS . observerHeight , LOS . targetHeight )
1197+ )
1198+ } )
12011199}
12021200
12031201// Takes non-linear x-axis profileData and makes it fit linearly. (Only for display purposes)
@@ -1349,20 +1347,18 @@ function makeMeasureToolLayer() {
13491347
13501348 // draw latlngs as a great circle arc
13511349 if ( mode === 'segment' && clickedLatLngs . length > 1 ) {
1352- MeasureTool . polylineMeasure . seed ( [ clickedLatLngsPoly ] )
1350+ MeasureTool . polylineMeasure . options . fixedLine . weight = 3
1351+ if ( clickedLatLngs . length > 1 ) {
1352+ MeasureTool . polylineMeasure . seed ( [ clickedLatLngsPoly ] )
1353+ }
1354+ } else {
1355+ MeasureTool . polylineMeasure . options . fixedLine . weight = 0
13531356 }
13541357
13551358 const segments = [ ]
13561359 recomputeLineOfSight ( )
13571360
1358- // Don't show polyline with LOS
1359- if ( LOS . on ) {
1360- MeasureTool . polylineMeasure . options . fixedLine . weight = 0
1361- } else {
1362- MeasureTool . polylineMeasure . options . fixedLine . weight = 3
1363- }
1364-
1365- if ( LOS . on && MeasureTool . lineOfSight . length > 0 ) {
1361+ if ( MeasureTool . lineOfSight . length > 0 ) {
13661362 let currentVis = MeasureTool . lineOfSight [ 0 ]
13671363 F_ . chunkArray ( MeasureTool . lineOfSight , steps ) . forEach (
13681364 ( chunk , chunkIdx ) => {
@@ -1395,15 +1391,23 @@ function makeMeasureToolLayer() {
13951391 ] ,
13961392 {
13971393 color :
1398- currentVis === 0
1399- ? 'black'
1394+ LOS . on
1395+ ? currentVis === 0
1396+ ? 'black'
1397+ : mode === 'continuous_color'
1398+ ? MeasureTool . getColor ( chunkIdx )
1399+ : mode === 'continuous'
1400+ ? ( chunkIdx + 1 ) % 2
1401+ ? '#ff002f'
1402+ : '#ff5070'
1403+ : '#ff002f'
14001404 : mode === 'continuous_color'
1401- ? MeasureTool . getColor ( chunkIdx )
1402- : mode === 'continuous'
1403- ? ( chunkIdx + 1 ) % 2
1404- ? '#ff002f'
1405- : '#ff5070'
1406- : '#ff002f' ,
1405+ ? MeasureTool . getColor ( chunkIdx )
1406+ : mode === 'continuous'
1407+ ? ( chunkIdx + 1 ) % 2
1408+ ? '#ff002f'
1409+ : '#ff5070'
1410+ : '#ff002f' ,
14071411 weight : 3 ,
14081412 }
14091413 )
@@ -1414,23 +1418,6 @@ function makeMeasureToolLayer() {
14141418 } )
14151419 }
14161420 )
1417- } else {
1418- for ( let i = 1 ; i < polylinePoints . length ; i ++ ) {
1419- segments . push (
1420- new L . Polyline ( [ polylinePoints [ i - 1 ] , polylinePoints [ i ] ] , {
1421- color :
1422- mode === 'continuous_color'
1423- ? MeasureTool . getColor ( i - 1 )
1424- : mode === 'continuous'
1425- ? i % 2
1426- ? '#ff002f'
1427- : '#ff5070'
1428- : '#ff002f' ,
1429- weight :
1430- mode === 'segment' ? 1 : 0
1431- } )
1432- )
1433- }
14341421 }
14351422
14361423 pointsAndPathArr . unshift ( ...segments )
0 commit comments