@@ -267,6 +267,7 @@ private void updateVertexBuffer()
267267 Line ? segmentToDraw = null ;
268268 SegmentStartLocation location = SegmentStartLocation . Outside ;
269269 SegmentStartLocation modifiedLocation = SegmentStartLocation . Outside ;
270+ SegmentStartLocation nextLocation = SegmentStartLocation . End ;
270271 SegmentWithThickness ? lastDrawnSegment = null ;
271272
272273 for ( int i = 0 ; i < segments . Count ; i ++ )
@@ -286,18 +287,24 @@ private void updateVertexBuffer()
286287 Vector2 closest = segmentToDraw . Value . At ( progress ) ;
287288
288289 // Expand segment if next end point is located within a line passing through it
289- if ( Precision . AlmostEquals ( closest , segments [ i ] . EndPoint , 0.1f ) )
290+ if ( Precision . AlmostEquals ( closest , segments [ i ] . EndPoint , 0.01f ) )
290291 {
291292 if ( progress < 0 )
292293 {
293294 // expand segment backwards
294295 segmentToDraw = new Line ( segments [ i ] . EndPoint , segmentToDraw . Value . EndPoint ) ;
295296 modifiedLocation = SegmentStartLocation . Outside ;
297+ nextLocation = SegmentStartLocation . Start ;
296298 }
297299 else if ( progress > 1 )
298300 {
299301 // or forward
300302 segmentToDraw = new Line ( segmentToDraw . Value . StartPoint , segments [ i ] . EndPoint ) ;
303+ nextLocation = SegmentStartLocation . End ;
304+ }
305+ else
306+ {
307+ nextLocation = SegmentStartLocation . Middle ;
301308 }
302309 }
303310 else // Otherwise draw the expanded segment
@@ -307,11 +314,9 @@ private void updateVertexBuffer()
307314 connect ( s , lastDrawnSegment , texRect ) ;
308315
309316 lastDrawnSegment = s ;
310-
311- // Figure out at which point within currently drawn segment the new one starts
312- float p = progressFor ( segmentToDraw . Value , segmentToDrawLength , segments [ i ] . StartPoint ) ;
313317 segmentToDraw = segments [ i ] ;
314- location = modifiedLocation = Precision . AlmostEquals ( p , 1f ) ? SegmentStartLocation . End : Precision . AlmostEquals ( p , 0f ) ? SegmentStartLocation . Start : SegmentStartLocation . Middle ;
318+ location = modifiedLocation = nextLocation ;
319+ nextLocation = SegmentStartLocation . End ;
315320 }
316321 }
317322 else
0 commit comments