mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Add #set() function to Point, Rectangle and Size (Matrix has it already).
This commit is contained in:
parent
b03ad9b090
commit
700f4aeb6a
3 changed files with 17 additions and 0 deletions
|
@ -33,6 +33,11 @@ var Point = Base.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
set: function(x, y) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a copy of the point.
|
* Returns a copy of the point.
|
||||||
* This is useful as the following code only generates a flat copy:
|
* This is useful as the following code only generates a flat copy:
|
||||||
|
|
|
@ -46,6 +46,13 @@ Rectangle = Base.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
set: function(x, y, width, height) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
},
|
||||||
|
|
||||||
getPoint: function() {
|
getPoint: function() {
|
||||||
return new Point(this.x, this.y);
|
return new Point(this.x, this.y);
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,6 +26,11 @@ var Size = Base.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
set: function(width, height) {
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
},
|
||||||
|
|
||||||
add: function() {
|
add: function() {
|
||||||
var size = Size.read(arguments);
|
var size = Size.read(arguments);
|
||||||
return new Size(this.width + size.width, this.height + size.height);
|
return new Size(this.width + size.width, this.height + size.height);
|
||||||
|
|
Loading…
Reference in a new issue