mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-07-24 12:49:22 -04:00
A whole lot of documentation clean-up.
This commit is contained in:
parent
0d8deb4a9e
commit
b541088c6f
28 changed files with 265 additions and 246 deletions
src
basic
core
item
path
CompoundPath.jsCurve.jsPath.Constructors.jsPath.jsPathItem.Boolean.jsPathItem.jsPathIterator.jsSegment.js
project
style
svg
util
view
|
@ -158,6 +158,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
|||
/**
|
||||
* Attempts to apply the matrix to the content of item that it belongs to,
|
||||
* meaning its transformation is baked into the item's content or children.
|
||||
*
|
||||
* @param {Boolean} recursively controls whether to apply transformations
|
||||
* recursively on children
|
||||
* @return {Boolean} {@true if the matrix was applied}
|
||||
|
@ -483,7 +484,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
|||
* @param {Number[]} dst the array into which to store the transformed
|
||||
* point pairs
|
||||
* @param {Number} count the number of points to transform
|
||||
* @return {Number[]} the dst array, containing the transformed coordinates.
|
||||
* @return {Number[]} the dst array, containing the transformed coordinates
|
||||
*/
|
||||
transform: function(/* point | */ src, dst, count) {
|
||||
return arguments.length < 3
|
||||
|
@ -594,7 +595,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
|||
* an object with these properties if it succeeded, {@code null} otherwise.
|
||||
*
|
||||
* @return {Object} the decomposed matrix, or {@code null} if decomposition
|
||||
* is not possible.
|
||||
* is not possible
|
||||
*/
|
||||
decompose: function() {
|
||||
// http://dev.w3.org/csswg/css3-2d-transforms/#matrix-decomposition
|
||||
|
|
|
@ -410,7 +410,7 @@ var Point = Base.extend(/** @lends Point# */{
|
|||
*
|
||||
* @param {Point} point
|
||||
* @param {Boolean} [squared=false] Controls whether the distance should
|
||||
* remain squared, or its square root should be calculated.
|
||||
* remain squared, or its square root should be calculated
|
||||
* @return {Number}
|
||||
*/
|
||||
getDistance: function(/* point, squared */) {
|
||||
|
|
|
@ -37,7 +37,7 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
|||
*
|
||||
* @name Rectangle#initialize
|
||||
* @param {Object} object an object containing properties to be set on the
|
||||
* rectangle.
|
||||
* rectangle
|
||||
*
|
||||
* @example // Create a rectangle between {x: 20, y: 20} and {x: 80, y:80}
|
||||
* var rectangle = new Rectangle({
|
||||
|
@ -709,7 +709,7 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
|||
*
|
||||
* @param {Rectangle} rect the rectangle to be combined with this rectangle
|
||||
* @return {Rectangle} the smallest rectangle containing both the specified
|
||||
* rectangle and this rectangle.
|
||||
* rectangle and this rectangle
|
||||
*/
|
||||
unite: function(/* rect */) {
|
||||
var rect = Rectangle.read(arguments),
|
||||
|
|
|
@ -47,9 +47,15 @@ Base.inject(/** @lends Base# */{
|
|||
},
|
||||
|
||||
/**
|
||||
* Serializes this object to a JSON string.
|
||||
* Exports (serializes) this object to a JSON data object or string.
|
||||
*
|
||||
* @param {Object} [options={ asString: true, precision: 5 }]
|
||||
* @option [options.asString=true] {Boolean} whether the JSON is returned as
|
||||
* a {@code Object} or a {@code String}
|
||||
* @option [options.precision=5] {Number} the amount of fractional digits in
|
||||
* numbers used in JSON data
|
||||
*
|
||||
* @param {Object} [options] the serialization options
|
||||
* @return {String} the exported JSON data
|
||||
*/
|
||||
exportJSON: function(options) {
|
||||
return Base.exportJSON(this, options);
|
||||
|
@ -65,8 +71,7 @@ Base.inject(/** @lends Base# */{
|
|||
* literal describing all the properties to be set on the created instance.
|
||||
*
|
||||
* @param {Object} props an object describing the properties to set
|
||||
* @param {Object} [exclude=undefined] a lookup table listing properties to
|
||||
* exclude
|
||||
* @param {Object} [exclude] a lookup table listing properties to exclude
|
||||
* @param {Boolean} [dontCheck=false] whether to perform a
|
||||
* Base.isPlainObject() check on props or not
|
||||
* @return {Boolean} {@true if the object is a plain object}
|
||||
|
@ -156,11 +161,12 @@ Base.inject(/** @lends Base# */{
|
|||
* the subclass from the passed arguments list or array, at the given
|
||||
* index, up to the specified length.
|
||||
* When called directly on Base, it reads any value without conversion
|
||||
* from the apssed arguments list or array.
|
||||
* from the passed arguments list or array.
|
||||
* This is used in argument conversion, e.g. by all basic types (Point,
|
||||
* Size, Rectangle) and also higher classes such as Color and Segment.
|
||||
*
|
||||
* @param {Array} list the list to read from, either an arguments object
|
||||
* or a normal array.
|
||||
* or a normal array
|
||||
* @param {Number} start the index at which to start reading in the list
|
||||
* @param {Number} length the amount of elements that can be read
|
||||
* @param {Object} options {@code options.readNull} controls whether
|
||||
|
@ -204,8 +210,9 @@ Base.inject(/** @lends Base# */{
|
|||
/**
|
||||
* Allows peeking ahead in reading of values and objects from arguments
|
||||
* list through Base.read().
|
||||
*
|
||||
* @param {Array} list the list to read from, either an arguments object
|
||||
* or a normal array.
|
||||
* or a normal array
|
||||
* @param {Number} start the index at which to start reading in the list
|
||||
*/
|
||||
peek: function(list, start) {
|
||||
|
@ -222,8 +229,9 @@ Base.inject(/** @lends Base# */{
|
|||
/**
|
||||
* Reads all readable arguments from the list, handling nested arrays
|
||||
* separately.
|
||||
*
|
||||
* @param {Array} list the list to read from, either an arguments object
|
||||
* or a normal array.
|
||||
* or a normal array
|
||||
* @param {Number} start the index at which to start reading in the list
|
||||
* @param {Object} options {@code options.readNull} controls whether
|
||||
* null is returned or converted. {@code options.clone} controls whether
|
||||
|
@ -247,10 +255,11 @@ Base.inject(/** @lends Base# */{
|
|||
* Base.readNamed() can read both from such named properties and normal
|
||||
* unnamed arguments through Base.read(). In use for example for the
|
||||
* various Path.Constructors.
|
||||
*
|
||||
* @param {Array} list the list to read from, either an arguments object
|
||||
* or a normal array.
|
||||
* or a normal array
|
||||
* @param {Number} start the index at which to start reading in the list
|
||||
* @param {String} name the property name to read from.
|
||||
* @param {String} name the property name to read from
|
||||
*/
|
||||
readNamed: function(list, name, start, options, length) {
|
||||
var value = this.getNamed(list, name),
|
||||
|
@ -275,8 +284,8 @@ Base.inject(/** @lends Base# */{
|
|||
/**
|
||||
* @return the named value if the list provides an arguments object,
|
||||
* {@code null} if the named value is {@code null} or {@code undefined},
|
||||
* and {@code undefined} if there is no arguments object.
|
||||
* If no name is provided, it returns the whole arguments object.
|
||||
* and {@code undefined} if there is no arguments object
|
||||
* If no name is provided, it returns the whole arguments object
|
||||
*/
|
||||
getNamed: function(list, name) {
|
||||
var arg = list[0];
|
||||
|
|
|
@ -121,9 +121,9 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{
|
|||
* @name PaperScope#settings
|
||||
* @type Object
|
||||
*
|
||||
* @option settings.applyMatrix {Boolean}
|
||||
* @option settings.handleSize {Number}
|
||||
* @option settings.hitTolerance {Number}
|
||||
* @option [settings.applyMatrix=true] {Boolean}
|
||||
* @option [settings.handleSize=4] {Number}
|
||||
* @option [settings.hitTolerance=0] {Number}
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -99,9 +99,9 @@ Base.exports.PaperScript = (function() {
|
|||
*
|
||||
* @name PaperScript.compile
|
||||
* @function
|
||||
* @param {String} code the PaperScript code.
|
||||
* @param {String} url the url of the source, for source-map debugging.
|
||||
* @return {String} the compiled PaperScript as JavaScript code.
|
||||
* @param {String} code the PaperScript code
|
||||
* @param {String} url the url of the source, for source-map debugging
|
||||
* @return {String} the compiled PaperScript as JavaScript code
|
||||
*/
|
||||
function compile(code, url, options) {
|
||||
if (!code)
|
||||
|
@ -330,9 +330,9 @@ Base.exports.PaperScript = (function() {
|
|||
*
|
||||
* @name PaperScript.execute
|
||||
* @function
|
||||
* @param {String} code the PaperScript code.
|
||||
* @param {PaperScope} scope the scope for which the code is executed.
|
||||
* @param {String} url the url of the source, for source-map debugging.
|
||||
* @param {String} code the PaperScript code
|
||||
* @param {PaperScope} scope the scope for which the code is executed
|
||||
* @param {String} url the url of the source, for source-map debugging
|
||||
*/
|
||||
function execute(code, scope, url, options) {
|
||||
// Set currently active scope.
|
||||
|
@ -506,9 +506,9 @@ Base.exports.PaperScript = (function() {
|
|||
* @name PaperScript.load
|
||||
* @function
|
||||
* @param {HTMLScriptElement} [script=null] the script to load. If none is
|
||||
* provided, all scripts of the HTML document are iterated over and loaded.
|
||||
* provided, all scripts of the HTML document are iterated over and loaded
|
||||
* @return {PaperScope} the scope produced for the passed {@code script}, or
|
||||
* {@code undefined} of multiple scripts area loaded.
|
||||
* {@code undefined} of multiple scripts area loaded
|
||||
*/
|
||||
function load(script) {
|
||||
return script ? loadScript(script) : loadAll();
|
||||
|
|
|
@ -32,7 +32,7 @@ var Group = Item.extend(/** @lends Group# */{
|
|||
*
|
||||
* @name Group#initialize
|
||||
* @param {Item[]} [children] An array of children that will be added to the
|
||||
* newly created group.
|
||||
* newly created group
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* // Create a group containing two paths:
|
||||
|
@ -74,7 +74,7 @@ var Group = Item.extend(/** @lends Group# */{
|
|||
*
|
||||
* @name Group#initialize
|
||||
* @param {Object} object an object literal containing the properties to be
|
||||
* set on the group.
|
||||
* set on the group
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* var path = new Path([100, 100], [100, 200]);
|
||||
|
|
117
src/item/Item.js
117
src/item/Item.js
|
@ -231,7 +231,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* Private notifier that is called whenever a change occurs in this item or
|
||||
* its sub-elements, such as Segments, Curves, Styles, etc.
|
||||
*
|
||||
* @param {ChangeFlag} flags describes what exactly has changed.
|
||||
* @param {ChangeFlag} flags describes what exactly has changed
|
||||
*/
|
||||
_changed: function(flags) {
|
||||
var symbol = this._parentSymbol,
|
||||
|
@ -284,8 +284,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* Sets those properties of the passed object literal on this item to
|
||||
* the values defined in the object literal, if the item has property of the
|
||||
* given name (or a setter defined for it).
|
||||
*
|
||||
* @param {Object} props
|
||||
* @return {Item} the item itself.
|
||||
* @return {Item} the item itself
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* // Setting properties through an object literal
|
||||
|
@ -1463,7 +1464,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
*
|
||||
* @param {Boolean} [insert=true] specifies whether the copy should be
|
||||
* inserted into the DOM. When set to {@code true}, it is inserted above the
|
||||
* original.
|
||||
* original
|
||||
* @return {Item} the newly cloned item
|
||||
*
|
||||
* @example {@paperscript}
|
||||
|
@ -1492,7 +1493,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
*
|
||||
* @param {Boolean} [insert=true] specifies whether the copy should be
|
||||
* inserted into the DOM. When set to {@code true}, it is inserted above the
|
||||
* original.
|
||||
* original
|
||||
* @return {Item} the newly cloned item
|
||||
*/
|
||||
_clone: function(copy, insert, includeMatrix) {
|
||||
|
@ -1630,7 +1631,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* }
|
||||
* }
|
||||
*
|
||||
* @param {Point} point The point to check for.
|
||||
* @param {Point} point The point to check for
|
||||
*/
|
||||
contains: function(/* point */) {
|
||||
// See CompoundPath#_contains() for the reason for !!
|
||||
|
@ -1697,30 +1698,29 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* The options object allows you to control the specifics of the hit-test
|
||||
* and may contain a combination of the following values:
|
||||
*
|
||||
* @option options.tolerance {Number} the tolerance of the hit-test in
|
||||
* points. Can also be controlled through
|
||||
* {@link PaperScope#settings}{@code .hitTolerance}.
|
||||
* @option [options.tolerance={@link PaperScope#settings}.hitTolerance]
|
||||
* {Number} the tolerance of the hit-test in points
|
||||
* @option options.class {Function} only hit-test again a certain item class
|
||||
* and its sub-classes: {@code Group, Layer, Path, CompoundPath,
|
||||
* Shape, Raster, PlacedSymbol, PointText}, etc.
|
||||
* @option options.fill {Boolean} hit-test the fill of items.
|
||||
* Shape, Raster, PlacedSymbol, PointText}, etc
|
||||
* @option options.fill {Boolean} hit-test the fill of items
|
||||
* @option options.stroke {Boolean} hit-test the stroke of path items,
|
||||
* taking into account the setting of stroke color and width.
|
||||
* taking into account the setting of stroke color and width
|
||||
* @option options.segments {Boolean} hit-test for {@link Segment#point} of
|
||||
* {@link Path} items.
|
||||
* {@link Path} items
|
||||
* @option options.curves {Boolean} hit-test the curves of path items,
|
||||
* without taking the stroke color or width into account.
|
||||
* @option options.handles {Boolean} hit-test for the handles.
|
||||
* ({@link Segment#handleIn} / {@link Segment#handleOut}) of path segments.
|
||||
* without taking the stroke color or width into account
|
||||
* @option options.handles {Boolean} hit-test for the handles
|
||||
* ({@link Segment#handleIn} / {@link Segment#handleOut}) of path segments
|
||||
* @option options.ends {Boolean} only hit-test for the first or last
|
||||
* segment points of open path items.
|
||||
* segment points of open path items
|
||||
* @option options.bounds {Boolean} hit-test the corners and side-centers of
|
||||
* the bounding rectangle of items ({@link Item#bounds}).
|
||||
* the bounding rectangle of items ({@link Item#bounds})
|
||||
* @option options.center {Boolean} hit-test the {@link Rectangle#center} of
|
||||
* the bounding rectangle of items ({@link Item#bounds}).
|
||||
* the bounding rectangle of items ({@link Item#bounds})
|
||||
* @option options.guides {Boolean} hit-test items that have
|
||||
* {@link Item#guide} set to {@code true}.
|
||||
* @option options.selected {Boolean} only hit selected items.
|
||||
* {@link Item#guide} set to {@code true}
|
||||
* @option options.selected {Boolean} only hit selected items
|
||||
*
|
||||
* @param {Point} point The point where the hit-test should be performed
|
||||
* @param {Object} [options={ fill: true, stroke: true, segments: true,
|
||||
|
@ -1845,8 +1845,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* @name Item#matches
|
||||
* @function
|
||||
*
|
||||
* @param {Object} match the criteria to match against.
|
||||
* @return {@true if the item matches all the criteria}
|
||||
* @param {Object} match the criteria to match against
|
||||
* @return {Boolean} {@true if the item matches all the criteria}
|
||||
* @see #getItems(match)
|
||||
*/
|
||||
/**
|
||||
|
@ -1863,10 +1863,10 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* @name Item#matches
|
||||
* @function
|
||||
*
|
||||
* @param {String} name the name of the state to match against.
|
||||
* @param {String} name the name of the state to match against
|
||||
* @param {Object} compare the value, function or regular expression to
|
||||
* compare against.
|
||||
* @return {@true if the item matches the state}
|
||||
* compare against
|
||||
* @return {Boolean} {@true if the item matches the state}
|
||||
* @see #getItems(match)
|
||||
*/
|
||||
matches: function(name, compare) {
|
||||
|
@ -1941,12 +1941,12 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* examples.
|
||||
*
|
||||
* @option match.inside {Rectangle} the rectangle in which the items need to
|
||||
* be fully contained.
|
||||
* be fully contained
|
||||
* @option match.overlapping {Rectangle} the rectangle with which the items
|
||||
* need to at least partly overlap.
|
||||
* need to at least partly overlap
|
||||
*
|
||||
* @param {Object} match the criteria to match against.
|
||||
* @return {Item[]} the list of matching descendant items.
|
||||
* @param {Object} match the criteria to match against
|
||||
* @return {Item[]} the list of matching descendant items
|
||||
* @see #matches(match)
|
||||
*/
|
||||
getItems: function(match) {
|
||||
|
@ -1964,8 +1964,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* See {@link Project#getItems(match)} for a selection of illustrated
|
||||
* examples.
|
||||
*
|
||||
* @param {Object} match the criteria to match against.
|
||||
* @return {Item} the first descendant item matching the given criteria.
|
||||
* @param {Object} match the criteria to match against
|
||||
* @return {Item} the first descendant item matching the given criteria
|
||||
* @see #getItems(match)
|
||||
*/
|
||||
getItem: function(match) {
|
||||
|
@ -2043,13 +2043,12 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* @name Item#exportJSON
|
||||
* @function
|
||||
*
|
||||
* @option options.asString {Boolean} whether the JSON is returned as a
|
||||
* {@code Object} or a {@code String}.
|
||||
* @option options.precision {Number} the amount of fractional digits in
|
||||
* numbers used in JSON data.
|
||||
* @option [options.asString=true] {Boolean} whether the JSON is returned as a
|
||||
* {@code Object} or a {@code String}
|
||||
* @option [options.precision=5] {Number} the amount of fractional digits in
|
||||
* numbers used in JSON data
|
||||
*
|
||||
* @param {Object} [options={ asString: true, precision: 5 }] the
|
||||
* serialization options
|
||||
* @param {Object} [options] the serialization options
|
||||
* @return {String} the exported JSON data
|
||||
*/
|
||||
|
||||
|
@ -2060,7 +2059,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* to this item's {@link Item#children} list. Note that not all type of
|
||||
* items can have children.
|
||||
*
|
||||
* @param {String} json the JSON data to import from.
|
||||
* @param {String} json the JSON data to import from
|
||||
*/
|
||||
importJSON: function(json) {
|
||||
// Try importing into `this`. If another item is returned, try adding
|
||||
|
@ -2078,15 +2077,15 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* @name Item#exportSVG
|
||||
* @function
|
||||
*
|
||||
* @option options.asString {Boolean} whether a SVG node or a {@code String}
|
||||
* is to be returned.
|
||||
* @option options.precision {Number} the amount of fractional digits in
|
||||
* numbers used in SVG data.
|
||||
* @option options.matchShapes {Boolean} whether path items should tried to
|
||||
* be converted to shape items, if their geometries can be made to match.
|
||||
* @option [options.asString=false] {Boolean} whether a SVG node or a
|
||||
* {@code String} is to be returned
|
||||
* @option [options.precision=5] {Number} the amount of fractional digits in
|
||||
* numbers used in SVG data
|
||||
* @option [options.matchShapes=false] {Boolean} whether path items should
|
||||
* tried to be converted to shape items, if their geometries can be made to
|
||||
* match
|
||||
*
|
||||
* @param {Object} [options={ asString: false, precision: 5,
|
||||
* matchShapes: false }] the export options.
|
||||
* @param {Object} [options] the export options
|
||||
* @return {SVGElement} the item converted to an SVG node
|
||||
*/
|
||||
|
||||
|
@ -2100,11 +2099,11 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* @name Item#importSVG
|
||||
* @function
|
||||
*
|
||||
* @option options.expandShapes {Boolean} whether imported shape items
|
||||
* should be expanded to path items.
|
||||
* @option [options.expandShapes=false] {Boolean} whether imported shape
|
||||
* items should be expanded to path items
|
||||
*
|
||||
* @param {SVGElement|String} svg the SVG content to import
|
||||
* @param {Object} [options={ expandShapes: false }] the import options
|
||||
* @param {Object} [options] the import options
|
||||
* @return {Item} the imported Paper.js parent item
|
||||
*/
|
||||
|
||||
|
@ -2116,7 +2115,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
*
|
||||
* @param {Item} item the item to be added as a child
|
||||
* @return {Item} the added item, or {@code null} if adding was not
|
||||
* possible.
|
||||
* possible
|
||||
*/
|
||||
addChild: function(item, _preserve) {
|
||||
return this.insertChild(undefined, item, _preserve);
|
||||
|
@ -2130,7 +2129,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* @param {Number} index
|
||||
* @param {Item} item the item to be inserted as a child
|
||||
* @return {Item} the inserted item, or {@code null} if inserting was not
|
||||
* possible.
|
||||
* possible
|
||||
*/
|
||||
insertChild: function(index, item, _preserve) {
|
||||
var res = item ? this.insertChildren(index, [item], _preserve) : null;
|
||||
|
@ -2144,7 +2143,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
*
|
||||
* @param {Item[]} items The items to be added as children
|
||||
* @return {Item[]} the added items, or {@code null} if adding was not
|
||||
* possible.
|
||||
* possible
|
||||
*/
|
||||
addChildren: function(items, _preserve) {
|
||||
return this.insertChildren(this._children.length, items, _preserve);
|
||||
|
@ -2158,7 +2157,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* @param {Number} index
|
||||
* @param {Item[]} items The items to be appended as children
|
||||
* @return {Item[]} the inserted items, or {@code null} if inserted was not
|
||||
* possible.
|
||||
* possible
|
||||
*/
|
||||
insertChildren: function(index, items, _preserve, _proto) {
|
||||
// CompoundPath#insertChildren() requires _preserve and _type:
|
||||
|
@ -2223,7 +2222,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
*
|
||||
* @param {Item} item the item above which it should be inserted
|
||||
* @return {Item} the inserted item, or {@code null} if inserting was not
|
||||
* possible.
|
||||
* possible
|
||||
*/
|
||||
insertAbove: function(item, _preserve) {
|
||||
return item._insertSibling(item._index + 1, this, _preserve);
|
||||
|
@ -2234,7 +2233,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
*
|
||||
* @param {Item} item the item below which it should be inserted
|
||||
* @return {Item} the inserted item, or {@code null} if inserting was not
|
||||
* possible.
|
||||
* possible
|
||||
*/
|
||||
insertBelow: function(item, _preserve) {
|
||||
return item._insertSibling(item._index, this, _preserve);
|
||||
|
@ -3046,7 +3045,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
/**
|
||||
* Transform the item.
|
||||
*
|
||||
* @param {Matrix} matrix the matrix by which the item shall be transformed.
|
||||
* @param {Matrix} matrix the matrix by which the item shall be transformed
|
||||
*/
|
||||
// TODO: Implement flags:
|
||||
// @param {String[]} flags Array of any of the following: 'objects',
|
||||
|
@ -3281,11 +3280,11 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* the frame event:
|
||||
*
|
||||
* @option event.count {Number} the number of times the frame event was
|
||||
* fired.
|
||||
* fired
|
||||
* @option event.time {Number} the total amount of time passed since the
|
||||
* first frame event in seconds.
|
||||
* first frame event in seconds
|
||||
* @option event.delta {Number} the time passed in seconds since the last
|
||||
* frame event.
|
||||
* frame event
|
||||
*
|
||||
* @see View#onFrame
|
||||
* @example {@paperscript}
|
||||
|
|
|
@ -36,7 +36,7 @@ var Layer = Group.extend(/** @lends Layer# */{
|
|||
*
|
||||
* @name Layer#initialize
|
||||
* @param {Item[]} [children] An array of items that will be added to the
|
||||
* newly created layer.
|
||||
* newly created layer
|
||||
*
|
||||
* @example
|
||||
* var layer = new Layer();
|
||||
|
@ -48,7 +48,7 @@ var Layer = Group.extend(/** @lends Layer# */{
|
|||
*
|
||||
* @name Layer#initialize
|
||||
* @param {Object} object an object literal containing the properties to be
|
||||
* set on the layer.
|
||||
* set on the layer
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* var path = new Path([100, 100], [100, 200]);
|
||||
|
|
|
@ -484,7 +484,7 @@ var Raster = Item.extend(/** @lends Raster# */{
|
|||
*
|
||||
* @param {Path|Rectangle|Point} object
|
||||
* @return {Color} the average color contained in the area covered by the
|
||||
* specified path, rectangle or point.
|
||||
* specified path, rectangle or point
|
||||
*/
|
||||
getAverageColor: function(object) {
|
||||
var bounds, path;
|
||||
|
|
|
@ -163,9 +163,9 @@ var Shape = Item.extend(/** @lends Shape# */{
|
|||
*
|
||||
* @param {Boolean} [insert=true] specifies whether the new path should be
|
||||
* inserted into the DOM. When set to {@code true}, it is inserted above the
|
||||
* shape item.
|
||||
* shape item
|
||||
* @return {Shape} the newly created path item with the same geometry as
|
||||
* this shape item.
|
||||
* this shape item
|
||||
* @see Path#toShape(insert)
|
||||
*/
|
||||
toPath: function(insert) {
|
||||
|
@ -407,7 +407,7 @@ statics: new function() {
|
|||
*
|
||||
* @name Shape.Rectangle
|
||||
* @param {Rectangle} rectangle the rectangle object describing the
|
||||
* geometry of the rectangular shape to be created.
|
||||
* geometry of the rectangular shape to be created
|
||||
* @param {Size} [radius=null] the size of the rounded corners
|
||||
* @return {Shape} the newly created shape
|
||||
*
|
||||
|
|
|
@ -29,7 +29,7 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
|||
/**
|
||||
* Creates a new compound path item and places it in the active layer.
|
||||
*
|
||||
* @param {Path[]} [paths] the paths to place within the compound path.
|
||||
* @param {Path[]} [paths] the paths to place within the compound path
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* // Create a circle shaped path with a hole in it:
|
||||
|
@ -80,7 +80,7 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
|||
*
|
||||
* @name CompoundPath#initialize
|
||||
* @param {String} pathData the SVG path-data that describes the geometry
|
||||
* of this path.
|
||||
* of this path
|
||||
* @return {CompoundPath} the newly created path
|
||||
*
|
||||
* @example {@paperscript}
|
||||
|
|
|
@ -336,7 +336,7 @@ var Curve = Base.extend(/** @lends Curve# */{
|
|||
* @param {Number} [offset=0.5] the offset on the curve at which to split,
|
||||
* or the curve time parameter if {@code isParameter} is {@code true}
|
||||
* @param {Boolean} [isParameter=false] pass {@code true} if {@code offset}
|
||||
* is a curve time parameter.
|
||||
* is a curve time parameter
|
||||
* @return {Curve} the second part of the divided curve
|
||||
*/
|
||||
// TODO: Rename to divideAt()?
|
||||
|
@ -402,7 +402,7 @@ var Curve = Base.extend(/** @lends Curve# */{
|
|||
* @param {Number} [offset=0.5] the offset on the curve at which to split,
|
||||
* or the curve time parameter if {@code isParameter} is {@code true}
|
||||
* @param {Boolean} [isParameter=false] pass {@code true} if {@code offset}
|
||||
* is a curve time parameter.
|
||||
* is a curve time parameter
|
||||
* @return {Path} the newly created path after splitting, if any
|
||||
* @see Path#split(index, parameter)
|
||||
*/
|
||||
|
@ -825,9 +825,10 @@ statics: {
|
|||
* the parameter is searched to the left of the start parameter. If no start
|
||||
* parameter is provided, a default of {@code 0} for positive values of
|
||||
* {@code offset} and {@code 1} for negative values of {@code offset}.
|
||||
*
|
||||
* @param {Number} offset
|
||||
* @param {Number} [start]
|
||||
* @return {Number} the curve time parameter at the specified offset.
|
||||
* @return {Number} the curve time parameter at the specified offset
|
||||
*/
|
||||
getParameterAt: function(offset, start) {
|
||||
return Curve.getParameterAt(this.getValues(), offset, start);
|
||||
|
@ -836,8 +837,9 @@ statics: {
|
|||
/**
|
||||
* Returns the curve time parameter of the specified point if it lies on the
|
||||
* curve, {@code null} otherwise.
|
||||
* @param {Point} point the point on the curve.
|
||||
* @return {Number} the curve time parameter of the specified point.
|
||||
*
|
||||
* @param {Point} point the point on the curve
|
||||
* @return {Number} the curve time parameter of the specified point
|
||||
*/
|
||||
getParameterOf: function(/* point */) {
|
||||
var point = Point.read(arguments);
|
||||
|
@ -847,11 +849,12 @@ statics: {
|
|||
/**
|
||||
* Calculates the curve location at the specified offset or curve time
|
||||
* parameter.
|
||||
*
|
||||
* @param {Number} offset the offset on the curve, or the curve time
|
||||
* parameter if {@code isParameter} is {@code true}
|
||||
* @param {Boolean} [isParameter=false] pass {@code true} if {@code offset}
|
||||
* is a curve time parameter.
|
||||
* @return {CurveLocation} the curve location at the specified the offset.
|
||||
* is a curve time parameter
|
||||
* @return {CurveLocation} the curve location at the specified the offset
|
||||
*/
|
||||
getLocationAt: function(offset, isParameter) {
|
||||
if (!isParameter)
|
||||
|
@ -864,8 +867,9 @@ statics: {
|
|||
/**
|
||||
* Returns the curve location of the specified point if it lies on the
|
||||
* curve, {@code null} otherwise.
|
||||
* @param {Point} point the point on the curve.
|
||||
* @return {CurveLocation} the curve location of the specified point.
|
||||
*
|
||||
* @param {Point} point the point on the curve
|
||||
* @return {CurveLocation} the curve location of the specified point
|
||||
*/
|
||||
getLocationOf: function(/* point */) {
|
||||
return this.getLocationAt(this.getParameterOf(Point.read(arguments)),
|
||||
|
@ -875,8 +879,9 @@ statics: {
|
|||
/**
|
||||
* Returns the length of the path from its beginning up to up to the
|
||||
* specified point if it lies on the path, {@code null} otherwise.
|
||||
* @param {Point} point the point on the path.
|
||||
* @return {Number} the length of the path up to the specified point.
|
||||
*
|
||||
* @param {Point} point the point on the path
|
||||
* @return {Number} the length of the path up to the specified point
|
||||
*/
|
||||
getOffsetOf: function(/* point */) {
|
||||
var loc = this.getLocationOf.apply(this, arguments);
|
||||
|
@ -928,8 +933,8 @@ statics: {
|
|||
* @param {Number} offset the offset on the curve, or the curve time
|
||||
* parameter if {@code isParameter} is {@code true}
|
||||
* @param {Boolean} [isParameter=false] pass {@code true} if {@code offset}
|
||||
* is a curve time parameter.
|
||||
* @return {Point} the point on the curve at the specified offset.
|
||||
* is a curve time parameter
|
||||
* @return {Point} the point on the curve at the specified offset
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -940,8 +945,8 @@ statics: {
|
|||
* @param {Number} offset the offset on the curve, or the curve time
|
||||
* parameter if {@code isParameter} is {@code true}
|
||||
* @param {Boolean} [isParameter=false] pass {@code true} if {@code offset}
|
||||
* is a curve time parameter.
|
||||
* @return {Point} the tangent of the curve at the specified offset.
|
||||
* is a curve time parameter
|
||||
* @return {Point} the tangent of the curve at the specified offset
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -952,8 +957,8 @@ statics: {
|
|||
* @param {Number} offset the offset on the curve, or the curve time
|
||||
* parameter if {@code isParameter} is {@code true}
|
||||
* @param {Boolean} [isParameter=false] pass {@code true} if {@code offset}
|
||||
* is a curve time parameter.
|
||||
* @return {Point} the normal of the curve at the specified offset.
|
||||
* is a curve time parameter
|
||||
* @return {Point} the normal of the curve at the specified offset
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -967,8 +972,8 @@ statics: {
|
|||
* @param {Number} offset the offset on the curve, or the curve time
|
||||
* parameter if {@code isParameter} is {@code true}
|
||||
* @param {Boolean} [isParameter=false] pass {@code true} if {@code offset}
|
||||
* is a curve time parameter.
|
||||
* @return {Number} the curvature of the curve at the specified offset.
|
||||
* is a curve time parameter
|
||||
* @return {Number} the curvature of the curve at the specified offset
|
||||
*/
|
||||
}),
|
||||
new function() { // Scope for methods that require numerical integration
|
||||
|
|
|
@ -124,7 +124,7 @@ Path.inject({ statics: new function() {
|
|||
*
|
||||
* @name Path.Rectangle
|
||||
* @param {Rectangle} rectangle the rectangle object describing the
|
||||
* geometry of the rectangular path to be created.
|
||||
* geometry of the rectangular path to be created
|
||||
* @param {Size} [radius=null] the size of the rounded corners
|
||||
* @return {Path} the newly created path
|
||||
*
|
||||
|
|
|
@ -75,9 +75,10 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
* Creates a new path item from SVG path-data and places it at the top of
|
||||
* the active layer.
|
||||
*
|
||||
* @param
|
||||
* @name Path#initialize
|
||||
* @param {String} pathData the SVG path-data that describes the geometry
|
||||
* of this path.
|
||||
* of this path
|
||||
* @return {Path} the newly created path
|
||||
*
|
||||
* @example {@paperscript}
|
||||
|
@ -488,7 +489,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
*
|
||||
* @param {Segment|Point} segment the segment or point to be added.
|
||||
* @return {Segment} the added segment. This is not necessarily the same
|
||||
* object, e.g. if the segment to be added already belongs to another path.
|
||||
* object, e.g. if the segment to be added already belongs to another path
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* // Adding segments to a path using point objects:
|
||||
|
@ -560,10 +561,10 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
* Inserts one or more segments at a given index in the list of this path's
|
||||
* segments.
|
||||
*
|
||||
* @param {Number} index the index at which to insert the segment.
|
||||
* @param {Number} index the index at which to insert the segment
|
||||
* @param {Segment|Point} segment the segment or point to be inserted.
|
||||
* @return {Segment} the added segment. This is not necessarily the same
|
||||
* object, e.g. if the segment to be added already belongs to another path.
|
||||
* object, e.g. if the segment to be added already belongs to another path
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* // Inserting a segment:
|
||||
|
@ -615,7 +616,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
* @param {Segment[]} segments
|
||||
* @return {Segment[]} an array of the added segments. These segments are
|
||||
* not necessarily the same objects, e.g. if the segment to be added already
|
||||
* belongs to another path.
|
||||
* belongs to another path
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* // Adding an array of Point objects:
|
||||
|
@ -658,11 +659,11 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
* Inserts an array of segments at a given index in the path's
|
||||
* {@link #segments} array.
|
||||
*
|
||||
* @param {Number} index the index at which to insert the segments.
|
||||
* @param {Segment[]} segments the segments to be inserted.
|
||||
* @param {Number} index the index at which to insert the segments
|
||||
* @param {Segment[]} segments the segments to be inserted
|
||||
* @return {Segment[]} an array of the added segments. These segments are
|
||||
* not necessarily the same objects, e.g. if the segment to be added already
|
||||
* belongs to another path.
|
||||
* belongs to another path
|
||||
*/
|
||||
insertSegments: function(index, segments) {
|
||||
return this._add(Segment.readAll(segments), index);
|
||||
|
@ -1362,9 +1363,9 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
*
|
||||
* @param {Boolean} [insert=true] specifies whether the new shape should be
|
||||
* inserted into the DOM. When set to {@code true}, it is inserted above the
|
||||
* path item.
|
||||
* path item
|
||||
* @return {Shape} the newly created shape item with the same geometry as
|
||||
* this path item if it can be matched, {@code null} otherwise.
|
||||
* this path item if it can be matched, {@code null} otherwise
|
||||
* @see Shape#toPath(insert)
|
||||
*/
|
||||
toShape: function(insert) {
|
||||
|
@ -1640,8 +1641,9 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
*
|
||||
* Returns the curve location of the specified point if it lies on the
|
||||
* path, {@code null} otherwise.
|
||||
* @param {Point} point the point on the path.
|
||||
* @return {CurveLocation} the curve location of the specified point.
|
||||
*
|
||||
* @param {Point} point the point on the path
|
||||
* @return {CurveLocation} the curve location of the specified point
|
||||
*/
|
||||
getLocationOf: function(/* point */) {
|
||||
var point = Point.read(arguments),
|
||||
|
@ -1657,8 +1659,9 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
/**
|
||||
* Returns the length of the path from its beginning up to up to the
|
||||
* specified point if it lies on the path, {@code null} otherwise.
|
||||
* @param {Point} point the point on the path.
|
||||
* @return {Number} the length of the path up to the specified point.
|
||||
*
|
||||
* @param {Point} point the point on the path
|
||||
* @return {Number} the length of the path up to the specified point
|
||||
*/
|
||||
getOffsetOf: function(/* point */) {
|
||||
var loc = this.getLocationOf.apply(this, arguments);
|
||||
|
@ -1669,7 +1672,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
* Returns the curve location of the specified offset on the path.
|
||||
*
|
||||
* @param {Number} offset the offset on the path, where {@code 0} is at
|
||||
* the beginning of the path and {@link Path#length} at the end.
|
||||
* the beginning of the path and {@link Path#length} at the end
|
||||
* @param {Boolean} [isParameter=false]
|
||||
* @return {CurveLocation} the curve location at the specified offset
|
||||
*/
|
||||
|
@ -1704,7 +1707,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
* @name Path#getPointAt
|
||||
* @function
|
||||
* @param {Number} offset the offset on the path, where {@code 0} is at
|
||||
* the beginning of the path and {@link Path#length} at the end.
|
||||
* the beginning of the path and {@link Path#length} at the end
|
||||
* @param {Boolean} [isParameter=false]
|
||||
* @return {Point} the point at the given offset
|
||||
*
|
||||
|
@ -1767,7 +1770,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
* @name Path#getTangentAt
|
||||
* @function
|
||||
* @param {Number} offset the offset on the path, where {@code 0} is at
|
||||
* the beginning of the path and {@link Path#length} at the end.
|
||||
* the beginning of the path and {@link Path#length} at the end
|
||||
* @param {Boolean} [isParameter=false]
|
||||
* @return {Point} the tangent vector at the given offset
|
||||
*
|
||||
|
@ -1838,7 +1841,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
* @name Path#getNormalAt
|
||||
* @function
|
||||
* @param {Number} offset the offset on the path, where {@code 0} is at
|
||||
* the beginning of the path and {@link Path#length} at the end.
|
||||
* the beginning of the path and {@link Path#length} at the end
|
||||
* @param {Boolean} [isParameter=false]
|
||||
* @return {Point} the normal vector at the given offset
|
||||
*
|
||||
|
@ -1912,7 +1915,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
* @name Path#getCurvatureAt
|
||||
* @function
|
||||
* @param {Number} offset the offset on the path, where {@code 0} is at
|
||||
* the beginning of the path and {@link Path#length} at the end.
|
||||
* the beginning of the path and {@link Path#length} at the end
|
||||
* @param {Boolean} [isParameter=false]
|
||||
* @return {Number} the normal vector at the given offset
|
||||
*
|
||||
|
@ -2181,8 +2184,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
* Solves a tri-diagonal system for one of coordinates (x or y) of first
|
||||
* bezier control points.
|
||||
*
|
||||
* @param rhs right hand side vector.
|
||||
* @return Solution vector.
|
||||
* @param rhs right hand side vector
|
||||
* @return Solution vector
|
||||
*/
|
||||
function getFirstControlPoints(rhs) {
|
||||
var n = rhs.length,
|
||||
|
|
|
@ -185,6 +185,7 @@ PathItem.inject(new function() {
|
|||
* Private method for splitting a PathItem at the given intersections.
|
||||
* The routine works for both self intersections and intersections
|
||||
* between PathItems.
|
||||
*
|
||||
* @param {CurveLocation[]} intersections Array of CurveLocation objects
|
||||
*/
|
||||
function splitPath(intersections) {
|
||||
|
@ -486,7 +487,7 @@ PathItem.inject(new function() {
|
|||
* part of a horizontal curve
|
||||
* @param {Boolean} testContains whether we need to consider this point
|
||||
* as part of stationary points on the curve itself, used when checking
|
||||
* the winding about a point.
|
||||
* the winding about a point
|
||||
* @return {Number} the winding number
|
||||
*/
|
||||
_getWinding: function(point, horizontal, testContains) {
|
||||
|
|
|
@ -482,7 +482,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
|||
* @function
|
||||
* @param {Point} to the point where the arc should end
|
||||
* @param {Boolean} [clockwise=true] specifies whether the arc should be
|
||||
* drawn in clockwise direction.
|
||||
* drawn in clockwise direction
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* var path = new Path();
|
||||
|
@ -530,7 +530,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
|||
* @name PathItem#closePath
|
||||
* @function
|
||||
* @param {Boolean} join controls whether the method should attempt to merge
|
||||
* the first segment with the last if they lie in the same location.
|
||||
* the first segment with the last if they lie in the same location
|
||||
* @see Path#closed
|
||||
*/
|
||||
|
||||
|
@ -552,7 +552,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
|||
* @name PathItem#lineBy
|
||||
* @function
|
||||
* @param {Point} to the vector which is added to the position of the last
|
||||
* segment of the path, to get to the position of the new segment.
|
||||
* segment of the path, to get to the position of the new segment
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* var path = new Path();
|
||||
|
|
|
@ -21,15 +21,15 @@ var PathIterator = Base.extend({
|
|||
/**
|
||||
* Creates a path iterator for the given path.
|
||||
*
|
||||
* @param {Path} path the path to iterate over.
|
||||
* @param {Path} path the path to iterate over
|
||||
* @param {Number} [maxRecursion=32] the maximum amount of recursion in
|
||||
* curve subdivision when mapping offsets to curve parameters.
|
||||
* curve subdivision when mapping offsets to curve parameters
|
||||
* @param {Number} [tolerance=0.25] the error tolerance at which the
|
||||
* recursion is interrupted before the maximum number of iterations is
|
||||
* reached.
|
||||
* reached
|
||||
* @param {Matrix} [matrix] the matrix by which to transform the path's
|
||||
* coordinates without modifying the actual path.
|
||||
* @return {PathIterator} the newly created path iterator.
|
||||
* @return {PathIterator} the newly created path iterator
|
||||
*/
|
||||
initialize: function(path, maxRecursion, tolerance, matrix) {
|
||||
// Instead of relying on path.curves, we only use segments here and
|
||||
|
|
|
@ -33,10 +33,10 @@ var Segment = Base.extend(/** @lends Segment# */{
|
|||
* @param {Point} [point={x: 0, y: 0}] the anchor point of the segment
|
||||
* @param {Point} [handleIn={x: 0, y: 0}] the handle point relative to the
|
||||
* anchor point of the segment that describes the in tangent of the
|
||||
* segment.
|
||||
* segment
|
||||
* @param {Point} [handleOut={x: 0, y: 0}] the handle point relative to the
|
||||
* anchor point of the segment that describes the out tangent of the
|
||||
* segment.
|
||||
* segment
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* var handleIn = new Point(-80, -100);
|
||||
|
@ -56,7 +56,7 @@ var Segment = Base.extend(/** @lends Segment# */{
|
|||
*
|
||||
* @name Segment#initialize
|
||||
* @param {Object} object an object literal containing properties to
|
||||
* be set on the segment.
|
||||
* be set on the segment
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* // Creating segments using object notation:
|
||||
|
@ -80,18 +80,18 @@ var Segment = Base.extend(/** @lends Segment# */{
|
|||
*
|
||||
* @param {Number} x the x coordinate of the segment point
|
||||
* @param {Number} y the y coordinate of the segment point
|
||||
* @param {Number} inX the x coordinate of the the handle point relative
|
||||
* to the anchor point of the segment that describes the in tangent
|
||||
* of the segment.
|
||||
* @param {Number} inY the y coordinate of the the handle point relative
|
||||
* to the anchor point of the segment that describes the in tangent
|
||||
* of the segment.
|
||||
* @param {Number} outX the x coordinate of the the handle point relative
|
||||
* to the anchor point of the segment that describes the out tangent
|
||||
* of the segment.
|
||||
* @param {Number} outY the y coordinate of the the handle point relative
|
||||
* to the anchor point of the segment that describes the out tangent
|
||||
* of the segment.
|
||||
* @param {Number} inX the x coordinate of the the handle point relative to
|
||||
* the anchor point of the segment that describes the in tangent of the
|
||||
* segment
|
||||
* @param {Number} inY the y coordinate of the the handle point relative to
|
||||
* the anchor point of the segment that describes the in tangent of the
|
||||
* segment
|
||||
* @param {Number} outX the x coordinate of the the handle point relative to
|
||||
* the anchor point of the segment that describes the out tangent of the
|
||||
* segment
|
||||
* @param {Number} outY the y coordinate of the the handle point relative to
|
||||
* the anchor point of the segment that describes the out tangent of the
|
||||
* segment
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* var inX = -80;
|
||||
|
|
|
@ -303,30 +303,29 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
* The options object allows you to control the specifics of the hit-test
|
||||
* and may contain a combination of the following values:
|
||||
*
|
||||
* @option options.tolerance {Number} the tolerance of the hit-test in
|
||||
* points. Can also be controlled through
|
||||
* {@link PaperScope#settings}{@code .hitTolerance}.
|
||||
* @option [options.tolerance={@link PaperScope#settings}.hitTolerance]
|
||||
* {Number} the tolerance of the hit-test in points
|
||||
* @option options.class {Function} only hit-test again a certain item class
|
||||
* and its sub-classes: {@code Group, Layer, Path, CompoundPath,
|
||||
* Shape, Raster, PlacedSymbol, PointText}, etc.
|
||||
* @option options.fill {Boolean} hit-test the fill of items.
|
||||
* Shape, Raster, PlacedSymbol, PointText}, etc
|
||||
* @option options.fill {Boolean} hit-test the fill of items
|
||||
* @option options.stroke {Boolean} hit-test the stroke of path items,
|
||||
* taking into account the setting of stroke color and width.
|
||||
* taking into account the setting of stroke color and width
|
||||
* @option options.segments {Boolean} hit-test for {@link Segment#point} of
|
||||
* {@link Path} items.
|
||||
* {@link Path} items
|
||||
* @option options.curves {Boolean} hit-test the curves of path items,
|
||||
* without taking the stroke color or width into account.
|
||||
* @option options.handles {Boolean} hit-test for the handles.
|
||||
* without taking the stroke color or width into account
|
||||
* @option options.handles {Boolean} hit-test for the handles
|
||||
* ({@link Segment#handleIn} / {@link Segment#handleOut}) of path segments.
|
||||
* @option options.ends {Boolean} only hit-test for the first or last
|
||||
* segment points of open path items.
|
||||
* segment points of open path items
|
||||
* @option options.bounds {Boolean} hit-test the corners and side-centers of
|
||||
* the bounding rectangle of items ({@link Item#bounds}).
|
||||
* the bounding rectangle of items ({@link Item#bounds})
|
||||
* @option options.center {Boolean} hit-test the {@link Rectangle#center} of
|
||||
* the bounding rectangle of items ({@link Item#bounds}).
|
||||
* the bounding rectangle of items ({@link Item#bounds})
|
||||
* @option options.guides {Boolean} hit-test items that have
|
||||
* {@link Item#guide} set to {@code true}.
|
||||
* @option options.selected {Boolean} only hit selected items.
|
||||
* {@link Item#guide} set to {@code true}
|
||||
* @option options.selected {Boolean} only hit selected items
|
||||
*
|
||||
* @param {Point} point the point where the hit-test should be performed
|
||||
* @param {Object} [options={ fill: true, stroke: true, segments: true,
|
||||
|
@ -364,9 +363,9 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
* contained.
|
||||
*
|
||||
* @option match.inside {Rectangle} the rectangle in which the items need to
|
||||
* be fully contained.
|
||||
* be fully contained
|
||||
* @option match.overlapping {Rectangle} the rectangle with which the items
|
||||
* need to at least partly overlap.
|
||||
* need to at least partly overlap
|
||||
*
|
||||
* @example {@paperscript} // Fetch all selected path items:
|
||||
* var path1 = new Path.Circle({
|
||||
|
@ -573,8 +572,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
*
|
||||
* @see Item#matches(match)
|
||||
* @see Item#getItems(match)
|
||||
* @param {Object} match the criteria to match against.
|
||||
* @return {Item[]} the list of matching items contained in the project.
|
||||
* @param {Object} match the criteria to match against
|
||||
* @return {Item[]} the list of matching items contained in the project
|
||||
*/
|
||||
getItems: function(match) {
|
||||
return Item._getItems(this.layers, match);
|
||||
|
@ -590,8 +589,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
* does work for {@link Item#data}.
|
||||
* See {@link #getItems(match)} for a selection of illustrated examples.
|
||||
*
|
||||
* @param {Object} match the criteria to match against.
|
||||
* @return {Item} the first item in the project matching the given criteria.
|
||||
* @param {Object} match the criteria to match against
|
||||
* @return {Item} the first item in the project matching the given criteria
|
||||
*/
|
||||
getItem: function(match) {
|
||||
return Item._getItems(this.layers, match, null, null, true)[0] || null;
|
||||
|
@ -601,18 +600,17 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
* {@grouptitle Importing / Exporting JSON and SVG}
|
||||
*
|
||||
* Exports (serializes) the project with all its layers and child items to
|
||||
* a JSON data string.
|
||||
* a JSON data object or string.
|
||||
*
|
||||
* @name Project#exportJSON
|
||||
* @function
|
||||
*
|
||||
* @option options.asString {Boolean} whether the JSON is returned as a
|
||||
* {@code Object} or a {@code String}.
|
||||
* @option options.precision {Number} the amount of fractional digits in
|
||||
* numbers used in JSON data.
|
||||
* @option [options.asString=true] {Boolean} whether the JSON is returned as
|
||||
* a {@code Object} or a {@code String}
|
||||
* @option [options.precision=5] {Number} the amount of fractional digits in
|
||||
* numbers used in JSON data
|
||||
*
|
||||
* @param {Object} [options={ asString: true, precision: 5 }] the
|
||||
* serialization options
|
||||
* @param {Object} [options] the serialization options
|
||||
* @return {String} the exported JSON data
|
||||
*/
|
||||
|
||||
|
@ -621,7 +619,7 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
* Note that the project is not cleared first. You can call
|
||||
* {@link Project#clear()} to do so.
|
||||
*
|
||||
* @param {String} json the JSON data to import from.
|
||||
* @param {String} json the JSON data to import from
|
||||
*/
|
||||
importJSON: function(json) {
|
||||
this.activate();
|
||||
|
@ -638,15 +636,15 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
* @name Project#exportSVG
|
||||
* @function
|
||||
*
|
||||
* @option options.asString {Boolean} whether a SVG node or a {@code String}
|
||||
* is to be returned.
|
||||
* @option options.precision {Number} the amount of fractional digits in
|
||||
* numbers used in SVG data.
|
||||
* @option options.matchShapes {Boolean} whether path items should tried to
|
||||
* be converted to shape items, if their geometries can be made to match.
|
||||
* @option [options.asString=false] {Boolean} whether a SVG node or a
|
||||
* {@code String} is to be returned
|
||||
* @option [options.precision=5] {Number} the amount of fractional digits in
|
||||
* numbers used in SVG data
|
||||
* @option [options.matchShapes=false] {Boolean} whether path items should
|
||||
* tried to be converted to shape items, if their geometries can be made to
|
||||
* match
|
||||
*
|
||||
* @param {Object} [options={ asString: false, precision: 5,
|
||||
* matchShapes: false }] the export options.
|
||||
* @param {Object} [options] the export options
|
||||
* @return {SVGElement} the project converted to an SVG node
|
||||
*/
|
||||
|
||||
|
@ -660,11 +658,14 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
* @name Project#importSVG
|
||||
* @function
|
||||
*
|
||||
* @option options.expandShapes {Boolean} whether imported shape items
|
||||
* should be expanded to path items.
|
||||
* @option [options.expandShapes=false] {Boolean} whether imported shape
|
||||
* items should be expanded to path items
|
||||
* @option [options.applyMatrix={@link PaperScope#settings}.applyMatrix]
|
||||
* {Boolean} whether imported items should have
|
||||
* their transformation matrices applied to their contents or not
|
||||
*
|
||||
* @param {SVGElement|String} svg the SVG content to import
|
||||
* @param {Object} [options={ expandShapes: false }] the import options
|
||||
* @param {Object} [options] the import options
|
||||
* @return {Item} the imported Paper.js parent item
|
||||
*/
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ var Symbol = Base.extend(/** @lends Symbol# */{
|
|||
* Private notifier that is called whenever a change occurs in this symbol's
|
||||
* definition.
|
||||
*
|
||||
* @param {ChangeFlag} flags describes what exactly has changed.
|
||||
* @param {ChangeFlag} flags describes what exactly has changed
|
||||
*/
|
||||
_changed: function(flags) {
|
||||
if (flags & /*#=*/ChangeFlag.GEOMETRY) {
|
||||
|
@ -133,7 +133,7 @@ var Symbol = Base.extend(/** @lends Symbol# */{
|
|||
/**
|
||||
* Places in instance of the symbol in the project.
|
||||
*
|
||||
* @param [position] The position of the placed symbol.
|
||||
* @param [position] The position of the placed symbol
|
||||
* @return {PlacedSymbol}
|
||||
*/
|
||||
place: function(position) {
|
||||
|
|
|
@ -366,7 +366,7 @@ var Color = Base.extend(new function() {
|
|||
*
|
||||
* @name Color#initialize
|
||||
* @param {Object} object an object describing the components and
|
||||
* properties of the color.
|
||||
* properties of the color
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* // Creating a HSB Color:
|
||||
|
@ -797,7 +797,7 @@ var Color = Base.extend(new function() {
|
|||
*
|
||||
* @param {Boolean} hex whether to return the color in hexadecial
|
||||
* representation or as a CSS RGB / RGBA string.
|
||||
* @return {String} a CSS string representation of the color.
|
||||
* @return {String} a CSS string representation of the color
|
||||
*/
|
||||
toCSS: function(hex) {
|
||||
// TODO: Support HSL / HSLA CSS3 colors directly, without conversion
|
||||
|
|
|
@ -24,7 +24,7 @@ var GradientStop = Base.extend(/** @lends GradientStop# */{
|
|||
*
|
||||
* @param {Color} [color=new Color(0, 0, 0)] the color of the stop
|
||||
* @param {Number} [rampPoint=0] the position of the stop on the gradient
|
||||
* ramp as a value between 0 and 1.
|
||||
* ramp as a value between 0 and 1
|
||||
*/
|
||||
initialize: function GradientStop(arg0, arg1) {
|
||||
if (arg0) {
|
||||
|
|
|
@ -509,8 +509,8 @@ new function() {
|
|||
* Converts various SVG styles and attributes into Paper.js styles and
|
||||
* attributes and applies them to the passed item.
|
||||
*
|
||||
* @param {SVGElement} node an SVG node to read style and attributes from.
|
||||
* @param {Item} item the item to apply the style and attributes to.
|
||||
* @param {SVGElement} node an SVG node to read style and attributes from
|
||||
* @param {Item} item the item to apply the style and attributes to
|
||||
*/
|
||||
function applyAttributes(item, node, isRoot) {
|
||||
// SVG attributes can be set both as styles and direct node attributes,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
var Formatter = Base.extend(/** @lends Formatter# */{
|
||||
/**
|
||||
* @param {Number} [precision=5] the amount of fractional digits.
|
||||
* @param {Number} [precision=5] the amount of fractional digits
|
||||
*/
|
||||
initialize: function(precision) {
|
||||
this.precision = precision || 5;
|
||||
|
|
|
@ -161,12 +161,12 @@ var Numerical = new function() {
|
|||
* http://www.cs.berkeley.edu/~wkahan/Math128/Cubic.pdf
|
||||
* Blinn J. - "How to solve a Quadratic Equation"
|
||||
*
|
||||
* @param {Number} a The quadratic term.
|
||||
* @param {Number} b The linear term.
|
||||
* @param {Number} c The constant term.
|
||||
* @param {Number[]} roots The array to store the roots in.
|
||||
* @param {Number} a The quadratic term
|
||||
* @param {Number} b The linear term
|
||||
* @param {Number} c The constant term
|
||||
* @param {Number[]} roots The array to store the roots in
|
||||
* @return {Number} The number of real roots found, or -1 if there are
|
||||
* infinite solutions.
|
||||
* infinite solutions
|
||||
*
|
||||
* @author Harikrishnan Gopalakrishnan
|
||||
*/
|
||||
|
@ -254,10 +254,10 @@ var Numerical = new function() {
|
|||
* @param {Number} a The cubic term (x³ term).
|
||||
* @param {Number} b The quadratic term (x² term).
|
||||
* @param {Number} c The linear term (x term).
|
||||
* @param {Number} d The constant term.
|
||||
* @param {Number[]} roots The array to store the roots in.
|
||||
* @param {Number} d The constant term
|
||||
* @param {Number[]} roots The array to store the roots in
|
||||
* @return {Number} The number of real roots found, or -1 if there are
|
||||
* infinite solutions.
|
||||
* infinite solutions
|
||||
*
|
||||
* @author Harikrishnan Gopalakrishnan
|
||||
*/
|
||||
|
|
|
@ -267,7 +267,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
|||
* Private notifier that is called whenever a change occurs in this view.
|
||||
* Used only by Matrix for now.
|
||||
*
|
||||
* @param {ChangeFlag} flags describes what exactly has changed.
|
||||
* @param {ChangeFlag} flags describes what exactly has changed
|
||||
*/
|
||||
_changed: function(flags) {
|
||||
if (flags & /*#=*/ChangeFlag.APPEARANCE)
|
||||
|
@ -413,7 +413,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
|||
* Checks whether the view is currently visible within the current browser
|
||||
* viewport.
|
||||
*
|
||||
* @return {Boolean} whether the view is visible.
|
||||
* @return {Boolean} whether the view is visible
|
||||
*/
|
||||
isVisible: function() {
|
||||
return DomElement.isInView(this._element);
|
||||
|
@ -504,11 +504,11 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
|||
* the frame event:
|
||||
*
|
||||
* @option event.count {Number} the number of times the frame event was
|
||||
* fired.
|
||||
* fired
|
||||
* @option event.time {Number} the total amount of time passed since the
|
||||
* first frame event in seconds.
|
||||
* @code event.delta {Number} the time passed in seconds since the last
|
||||
* frame event.
|
||||
* first frame event in seconds
|
||||
* @option event.delta {Number} the time passed in seconds since the last
|
||||
* frame event
|
||||
*
|
||||
* @example {@paperscript}
|
||||
* // Creating an animation:
|
||||
|
@ -578,7 +578,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
|||
* @name View#on
|
||||
* @function
|
||||
* @param {Object} param an object literal containing one or more of the
|
||||
* following properties: {@code frame, resize}.
|
||||
* following properties: {@code frame, resize}
|
||||
* @return {View} this view itself, so calls can be chained
|
||||
*
|
||||
* @example {@paperscript}
|
||||
|
@ -644,7 +644,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
|||
* @function
|
||||
* @param {String('frame', 'resize')} type the event type
|
||||
* @param {Object} event an object literal containing properties describing
|
||||
* the event.
|
||||
* the event
|
||||
* @return {Boolean} {@true if the event had listeners}
|
||||
*/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue