@@ -139,19 +139,13 @@ export default class CanvasPaintBackend implements PaintBackend {
139
139
// TODO: pass in border-radius
140
140
edge ( x : number , y : number , length : number , side : 'top' | 'right' | 'bottom' | 'left' ) {
141
141
const { r, g, b, a} = this . strokeColor ;
142
- const lw2 = this . lineWidth / 2 ;
143
- const rx = Math . round ( x - lw2 ) + lw2 ;
144
- const ry = Math . round ( y - lw2 ) + lw2 ;
145
142
this . ctx . beginPath ( ) ;
146
143
this . ctx . strokeStyle = `rgba(${ r } , ${ g } , ${ b } , ${ a } )` ;
147
144
this . ctx . lineWidth = this . lineWidth ;
148
- this . ctx . moveTo (
149
- side === 'left' || side === 'right' ? rx : Math . round ( x ) ,
150
- side === 'top' || side === 'bottom' ? ry : Math . round ( y )
151
- ) ;
145
+ this . ctx . moveTo ( x , y ) ;
152
146
this . ctx . lineTo (
153
- side === 'top' || side === 'bottom' ? Math . round ( x + length ) : rx ,
154
- side === 'left' || side === 'right' ? Math . round ( y + length ) : ry
147
+ side === 'top' || side === 'bottom' ? x + length : x ,
148
+ side === 'left' || side === 'right' ? y + length : y
155
149
) ;
156
150
this . ctx . stroke ( ) ;
157
151
}
@@ -242,15 +236,9 @@ export default class CanvasPaintBackend implements PaintBackend {
242
236
243
237
rect ( x : number , y : number , w : number , h : number ) {
244
238
const { r, g, b, a} = this . fillColor ;
245
- const rx = Math . round ( x ) ;
246
- const ry = Math . round ( y ) ;
247
- const right = Math . round ( x + w ) ;
248
- const bottom = Math . round ( y + h ) ;
249
- const rw = right - rx ;
250
- const rh = bottom - ry ;
251
239
this . ctx . beginPath ( ) ;
252
240
this . ctx . fillStyle = `rgba(${ r } , ${ g } , ${ b } , ${ a } )` ;
253
- this . ctx . fillRect ( rx , ry , rw , rh ) ;
241
+ this . ctx . fillRect ( x , y , w , h ) ;
254
242
}
255
243
256
244
pushClip ( x : number , y : number , w : number , h : number ) {
0 commit comments