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

Geom Rectangle Property Right #849

Closed
brenton-thomas opened this issue May 26, 2014 · 1 comment
Closed

Geom Rectangle Property Right #849

brenton-thomas opened this issue May 26, 2014 · 1 comment

Comments

@brenton-thomas
Copy link

The property "right" seems to be wrong or I am misinterpreting the intent. Currently when value (the right coordinate) is input it sets width to be

this.width = this.x + value;

when I would expect width to be

this.width = value - this.x;

Original code below

/**

  • The sum of the x and width properties. Changing the right property of a Rectangle object has no effect on the x, y and height properties, however it does affect the width property.

  • @name Phaser.Rectangle#right

  • @Property {number} right - The sum of the x and width properties.
    */
    Object.defineProperty(Phaser.Rectangle.prototype, "right", {

    get: function () {
    return this.x + this.width;
    },

    set: function (value) {
    if (value <= this.x) {
    this.width = 0;
    } else {
    this.width = this.x + value;
    }
    }

});

photonstorm added a commit that referenced this issue Jul 2, 2014
…the value given. However the value given should be a new Right coordinate, so the width calculation has been adjusted to compensate (thanks @cryptonomicon, #849)
@photonstorm
Copy link
Collaborator

Yes you're right, the Right value given should be the new "right" coordinate.

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

No branches or pull requests

2 participants