Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add ellipse #118

wants to merge 1 commit into from

Conversation

uriwald
Copy link

@uriwald uriwald commented Oct 25, 2019

Adding Ellipse command to the Turtle

Copy link
Owner

@inexorabletash inexorabletash left a 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();
Copy link
Owner

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);
Copy link
Owner

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(
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants