mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-03-14 08:49:50 -04:00
Move Path.Circle constructor above Path.Rectangle.
This commit is contained in:
parent
0bf19d02bd
commit
7ade053dea
1 changed files with 26 additions and 26 deletions
|
@ -115,6 +115,32 @@ Path.inject({ statics: new function() {
|
||||||
).set(Base.getNamed(arguments));
|
).set(Base.getNamed(arguments));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a circle shaped Path Item.
|
||||||
|
*
|
||||||
|
* @param {Point} center the center point of the circle
|
||||||
|
* @param {Number} radius the radius of the circle
|
||||||
|
* @return {Path} the newly created path
|
||||||
|
*
|
||||||
|
* @example {@paperscript}
|
||||||
|
* var path = new Path.Circle(new Point(80, 50), 30);
|
||||||
|
* path.strokeColor = 'black';
|
||||||
|
*
|
||||||
|
* @example {@paperscript} // Using object notation
|
||||||
|
* var path = new Path.Circle({
|
||||||
|
* center: [80, 50],
|
||||||
|
* radius: 30,
|
||||||
|
* strokeColor: 'black'
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
Circle: function(/* center, radius */) {
|
||||||
|
var center = Point.readNamed(arguments, 'center'),
|
||||||
|
radius = Base.readNamed(arguments, 'radius');
|
||||||
|
return createEllipse(new Rectangle(center.subtract(radius),
|
||||||
|
new Size(radius * 2, radius * 2)))
|
||||||
|
.set(Base.getNamed(arguments));
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a rectangle shaped Path Item from the passed point and size.
|
* Creates a rectangle shaped Path Item from the passed point and size.
|
||||||
*
|
*
|
||||||
|
@ -252,32 +278,6 @@ Path.inject({ statics: new function() {
|
||||||
*/
|
*/
|
||||||
Oval: createEllipse,
|
Oval: createEllipse,
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a circle shaped Path Item.
|
|
||||||
*
|
|
||||||
* @param {Point} center the center point of the circle
|
|
||||||
* @param {Number} radius the radius of the circle
|
|
||||||
* @return {Path} the newly created path
|
|
||||||
*
|
|
||||||
* @example {@paperscript}
|
|
||||||
* var path = new Path.Circle(new Point(80, 50), 30);
|
|
||||||
* path.strokeColor = 'black';
|
|
||||||
*
|
|
||||||
* @example {@paperscript} // Using object notation
|
|
||||||
* var path = new Path.Circle({
|
|
||||||
* center: [80, 50],
|
|
||||||
* radius: 30,
|
|
||||||
* strokeColor: 'black'
|
|
||||||
* });
|
|
||||||
*/
|
|
||||||
Circle: function(/* center, radius */) {
|
|
||||||
var center = Point.readNamed(arguments, 'center'),
|
|
||||||
radius = Base.readNamed(arguments, 'radius');
|
|
||||||
return createEllipse(new Rectangle(center.subtract(radius),
|
|
||||||
new Size(radius * 2, radius * 2)))
|
|
||||||
.set(Base.getNamed(arguments));
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a circular arc shaped Path Item.
|
* Creates a circular arc shaped Path Item.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue