-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ellipse #118
base: main
Are you sure you want to change the base?
Add ellipse #118
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include tests, ideally testing normal drawing and with FILLED
mode.
Look at the ARC
tests for examples.
} | ||
|
||
if (width === height) { | ||
this.canvas_ctx.beginPath(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at the ARC implementation to see how filling
needs to be tested - there are two different modes (drawing and filling).
|
||
if (width === height) { | ||
this.canvas_ctx.beginPath(); | ||
this.canvas_ctx.arc(x, y, width / 2, 0, 2 * Math.PI, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use CanvasRenderingContext2D.ellipse()
} else { | ||
this.canvas_ctx.beginPath(); | ||
this.canvas_ctx.moveTo(x, y - height/2); // A | ||
this.canvas_ctx.bezierCurveTo( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use CanvasRenderingContext2D.ellipse() - no need for a special case here.
Adding Ellipse command to the Turtle