Skip to content

Commit

Permalink
Adding corner/midpoint getters/setters to Node. fixes #201
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Mar 13, 2014
1 parent 1dfb61b commit 6b87880
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions js/nodes/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,86 @@ define( function( require ) {
return this; // allow chaining
},

getLeftTop: function() {
return this.getBounds().getLeftTop();
},

setLeftTop: function( leftTop ) {
assert && assert( leftTop instanceof Vector2 );

this.translate( leftTop.minus( this.getLeftTop() ), true );
},

getCenterTop: function() {
return this.getBounds().getCenterTop();
},

setCenterTop: function( centerTop ) {
assert && assert( centerTop instanceof Vector2 );

this.translate( centerTop.minus( this.getCenterTop() ), true );
},

getRightTop: function() {
return this.getBounds().getRightTop();
},

setRightTop: function( rightTop ) {
assert && assert( rightTop instanceof Vector2 );

this.translate( rightTop.minus( this.getRightTop() ), true );
},

getLeftCenter: function() {
return this.getBounds().getLeftCenter();
},

setLeftCenter: function( leftCenter ) {
assert && assert( leftCenter instanceof Vector2 );

this.translate( leftCenter.minus( this.getLeftCenter() ), true );
},

getRightCenter: function() {
return this.getBounds().getRightCenter();
},

setRightCenter: function( rightCenter ) {
assert && assert( rightCenter instanceof Vector2 );

this.translate( rightCenter.minus( this.getRightCenter() ), true );
},

getLeftBottom: function() {
return this.getBounds().getLeftBottom();
},

setLeftBottom: function( leftBottom ) {
assert && assert( leftBottom instanceof Vector2 );

this.translate( leftBottom.minus( this.getLeftBottom() ), true );
},

getCenterBottom: function() {
return this.getBounds().getCenterBottom();
},

setCenterBottom: function( centerBottom ) {
assert && assert( centerBottom instanceof Vector2 );

this.translate( centerBottom.minus( this.getCenterBottom() ), true );
},

getRightBottom: function() {
return this.getBounds().getRightBottom();
},

setRightBottom: function( rightBottom ) {
assert && assert( rightBottom instanceof Vector2 );

this.translate( rightBottom.minus( this.getRightBottom() ), true );
},

getWidth: function() {
return this.getBounds().getWidth();
},
Expand Down Expand Up @@ -2081,6 +2161,23 @@ define( function( require ) {
set centerY( value ) { this.setCenterY( value ); },
get centerY() { return this.getCenterY(); },

set leftTop( value ) { this.setLeftTop( value ); },
get leftTop() { return this.getLeftTop(); },
set centerTop( value ) { this.setCenterTop( value ); },
get centerTop() { return this.getCenterTop(); },
set rightTop( value ) { this.setRightTop( value ); },
get rightTop() { return this.getRightTop(); },
set leftCenter( value ) { this.setLeftCenter( value ); },
get leftCenter() { return this.getLeftCenter(); },
set rightCenter( value ) { this.setRightCenter( value ); },
get rightCenter() { return this.getRightCenter(); },
set leftBottom( value ) { this.setLeftBottom( value ); },
get leftBottom() { return this.getLeftBottom(); },
set centerBottom( value ) { this.setCenterBottom( value ); },
get centerBottom() { return this.getCenterBottom(); },
set rightBottom( value ) { this.setRightBottom( value ); },
get rightBottom() { return this.getRightBottom(); },

set children( value ) { this.setChildren( value ); },
get children() { return this.getChildren(); },

Expand Down

0 comments on commit 6b87880

Please sign in to comment.