Jump to content

Documentation error in Graphics.draw.Ellipse


Professor
 Share

Recommended Posts

While working with Graphics.draw.Ellipse(), I believe I discovered an error in the documentation.

 

The four parameters (x, y, width, height) are stated to be the x/y coordinates of the upper-left corner of the framing rectangle of the ellipse, along with the width and height of the ellipse.

 

As currently implemented, x and y are actually the coordinates of the CENTER of the ellipse, width is the horizontal RADIUS (one/half the total width), and height is the vertical RADIUS (one-half the total height).

 

The function works fine otherwise.

 

- prof

 

 

Link to comment
Share on other sites

The documentation is fine. It's the upper-left corner of the framing rectangle of the ellipse, not the upper-left corner of the ellipse itself. But the x and y are indeed the center of the ellipse.

A graphic inherits from DisplayObjectContainer, you have to move the graphic to a new position if you want to see all the ellipse on the stage: http://jsfiddle.net/yX3T5/

Set the positions to 0, 0 on the jsfiddle and you'll see that the x and y are the upper-left corner of the framing rectangle AND the center of the ellipse :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...