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

Ellipse radiuses, width, height problems #1062

Closed
Ifko opened this issue Dec 20, 2013 · 5 comments
Closed

Ellipse radiuses, width, height problems #1062

Ifko opened this issue Dec 20, 2013 · 5 comments
Labels

Comments

@Ifko
Copy link

Ifko commented Dec 20, 2013

If ellipse exists and rx or ry is set, the width and height is not set. On the opposite side, if width and height is set, the rx and ry stay on their same values. I think it is a bug. These properties should influence each other otherwise the object does not carry the proper information (either bounding box or radiuses are badly set) I fixed it in the class derived from ellipse, but I think I am not alone with this problem. This discussion addresse the problem as well: https://groups.google.com/forum/#!topic/fabricjs/lt6p-936Ko4

@asturur asturur self-assigned this Sep 22, 2014
@asturur
Copy link
Member

asturur commented Sep 24, 2014

in the ellipse class we can add something like that:

    _set: function(key, value) {
      this.callSuper('_set', key, value);

      switch (key) {
        case 'rx':
          this.rx = value;
          this.width = value * 2;
          break;

        case 'ry':
          this.ry = value;
          this.height = value * 2;
          break;

        case 'width':
          this.rx = value / 2;
          this.width = value;
          break;
      }

      return this;
    },

Pluse the getRx and getRy methods to behave like circle more or less.

@asturur
Copy link
Member

asturur commented Sep 25, 2014

PR #1699 if we need this, circle has it, so it may have even ellipse.
I don't think it should be both way, rx should update width , but width should not update rx. at least in Circle they implemented in this way.
just my two cents.
If we do not need this let's close issue and PR.

@Ifko
Copy link
Author

Ifko commented Sep 25, 2014

if think the problem is that rx should be only 'get' accessor. If there is width, why we need to set rx? Or width 'setter' should update rx and rx 'setter' should update width. The same for ry and height

@asturur
Copy link
Member

asturur commented Sep 25, 2014

@Ifko Sorry a typo in my first comment made my comment meaningless.
Before modify the ellipse tests, i wait to see if kangax agree with this functionality.

@asturur
Copy link
Member

asturur commented Sep 26, 2014

@kangax what do you think about this?
the PR #1699 ( to be completed with tests ) has been done copying from circle structure.
Do you think is good to implement like that?
Do you think it should work even set width -> update rx ?
To do so we should not call the set method but update the proerties directly otherways width will trigger rx that will trigger width and so on.

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

No branches or pull requests

2 participants