@@ -238,6 +238,18 @@ export class ScreenCanvasDrawController implements DrawController {
238238 this . context . moveTo ( screenStartPoint . x , this . canvasSize . y - screenStartPoint . y ) ;
239239 this . context . lineTo ( screenEndPoint . x , this . canvasSize . y - screenEndPoint . y ) ;
240240 this . context . stroke ( ) ;
241+
242+ const lineWidth = this . context . lineWidth ;
243+ const style = this . context . strokeStyle as string ;
244+ this . _drawRoundedEndpoint ( screenStartPoint , lineWidth , style ) ;
245+ this . _drawRoundedEndpoint ( screenEndPoint , lineWidth , style ) ;
246+ }
247+
248+ private _drawRoundedEndpoint ( screenPoint : Point , lineWidth : number , style : string ) : void {
249+ this . context . fillStyle = style ;
250+ this . context . beginPath ( ) ;
251+ this . context . arc ( screenPoint . x , this . canvasSize . y - screenPoint . y , lineWidth / 2 , 0 , 2 * Math . PI ) ;
252+ this . context . fill ( ) ;
241253 }
242254
243255 /**
@@ -283,6 +295,23 @@ export class ScreenCanvasDrawController implements DrawController {
283295 counterClockWise ,
284296 ) ;
285297 this . context . stroke ( ) ;
298+
299+ const lineWidth = this . context . lineWidth ;
300+ const style = this . context . strokeStyle as string ;
301+
302+ // Calculate arc endpoints
303+ const startScreenX = screenCenterPoint . x + screenRadius * Math . cos ( startAngle ) ;
304+ // Y is inverted in canvas, but also for the arc angles, so we subtract from canvasSize.y and then add sin
305+ const startScreenY = ( this . canvasSize . y - screenCenterPoint . y ) + screenRadius * Math . sin ( startAngle ) ;
306+ const endScreenX = screenCenterPoint . x + screenRadius * Math . cos ( endAngle ) ;
307+ const endScreenY = ( this . canvasSize . y - screenCenterPoint . y ) + screenRadius * Math . sin ( endAngle ) ;
308+
309+ // Convert back to Point objects, note that _drawRoundedEndpoint expects y to be from top of canvas
310+ const arcStartPoint = new Point ( startScreenX , this . canvasSize . y - startScreenY ) ;
311+ const arcEndPoint = new Point ( endScreenX , this . canvasSize . y - endScreenY ) ;
312+
313+ this . _drawRoundedEndpoint ( arcStartPoint , lineWidth , style ) ;
314+ this . _drawRoundedEndpoint ( arcEndPoint , lineWidth , style ) ;
286315 }
287316
288317 /**
0 commit comments