import { RGBATupleToString } from '../../../../../common/color_library_wrappers' ; import { Line , Stroke } from '../../../../../geoms/types' ; import { withContext } from '../../../../../renderers/canvas' ; internal export const MIN_STROKE_WIDTH = 0.001 ; internal export function renderMultiLine ( ctx , lines , stroke ) { if ( stroke . width < MIN_STROKE_WIDTH || lines . length === 0 ) { return ; } withContext ( ctx , ( ) => { ctx . strokeStyle = RGBATupleToString ( stroke . color ) ; ctx . lineJoin = 'round' ; ctx . lineWidth = stroke . width ; if ( stroke . dash ) { ctx . setLineDash ( stroke . dash ) ; } ctx . beginPath ( ) ; for ( const line of lines ) { if ( typeof line === 'string' ) { ctx . stroke ( new Path2D ( line ) ) ; } else { ctx . moveTo ( line . x1 , line . y1 ) ; ctx . lineTo ( line . x2 , line . y2 ) ; } } ctx . stroke ( ) ; } ) ; }