import { RGBATupleToString } from '../../../../../common/color_library_wrappers' ; import { Circle , Fill , Stroke } from '../../../../../geoms/types' ; import { withContext } from '../../../../../renderers/canvas' ; import { degToRad } from '../../../../../utils/common' ; import { PointShape } from '../../../../../utils/themes/theme' ; import { ShapeRendererFn } from '../../shapes_paths' ; import { MIN_STROKE_WIDTH } from './line' ; internal export function renderShape ( ctx , shape , { x , y , radius } , { color : fillColor } , { width , dash , color : strokeColor } ) { withContext ( ctx , ( ) => { const [ pathFn , rotation ] = ShapeRendererFn [ shape ] ; ctx . translate ( x , y ) ; ctx . rotate ( degToRad ( rotation ) ) ; ctx . beginPath ( ) ; const path = new Path2D ( pathFn ( radius ) ) ; ctx . fillStyle = RGBATupleToString ( fillColor ) ; ctx . fill ( path ) ; if ( width > MIN_STROKE_WIDTH ) { ctx . strokeStyle = RGBATupleToString ( strokeColor ) ; ctx . lineWidth = width ; ctx . setLineDash ( dash ?? [ ] ) ; ctx . stroke ( path ) ; } } ) ; }