@@ -41,23 +41,22 @@ export function renderWrappedPartitionCanvas2d(
4141
4242 const fWidth = x1 - x0 ;
4343 const fPadding = Math . min ( padding , MAX_PADDING_RATIO * fWidth ) ;
44- const paintedWidth = fWidth - fPadding ;
45- const paintedHeight = y1 - y0 - padding ;
46- const cornerRadius = 2 * cornerRatio * Math . min ( paintedWidth , paintedHeight ) ;
47- const halfRadius = cornerRadius / 2 ;
44+ const w = fWidth - fPadding ;
45+ const h = y1 - y0 - padding ;
46+ const x = x0 + fPadding ;
47+ const y = y0 + padding / 2 ;
48+ const r = cornerRatio * Math . min ( w , h ) ;
4849
4950 ctx . fillStyle = fillColor ;
50- ctx . strokeStyle = fillColor ;
51- ctx . lineWidth = cornerRadius ;
51+
5252 ctx . beginPath ( ) ;
53- ctx . rect (
54- x0 + fPadding + halfRadius ,
55- y0 + padding / 2 + halfRadius ,
56- paintedWidth - cornerRadius ,
57- paintedHeight - cornerRadius ,
58- ) ;
53+ ctx . moveTo ( x + r , y ) ;
54+ ctx . arcTo ( x + w , y , x + w , y + h , r ) ;
55+ ctx . arcTo ( x + w , y + h , x , y + h , r ) ;
56+ ctx . arcTo ( x , y + h , x , y , r ) ;
57+ ctx . arcTo ( x , y , x + w , y , r ) ;
58+ ctx . closePath ( ) ;
5959 ctx . fill ( ) ;
60- ctx . stroke ( ) ;
6160 } ) ;
6261
6362 ctx . restore ( ) ;
0 commit comments