Merge remote-tracking branch 'source/master'

This commit is contained in:
Jonathan Puckey 2011-08-02 10:53:25 +02:00
commit 820ef43f56
68 changed files with 5456 additions and 2712 deletions

View file

@ -56,10 +56,11 @@ You will then find the built library inside the `dist` folder, named `paper.js`.
commented Preprocessed but still formated and commented
stripped Formated but without comments (default)
compressed No comments and no whitespaces
uglified Uses UglifyJS to further reduce file size
compressed Uses UglifyJS to reduce file size
In order for UglifyJS to work when building Paper.js, it needs to be located in a folder name `uglifyjs` on the same level as your `paper.js` project folder. Alternatively you can also adjust the path in `build/preprocess.sh`
In order for UglifyJS to work when building Paper.js, it needs to be located in a folder name `uglifyjs` on the same level as your `paper.js` project folder. Alternatively you can also adjust the path in `build/preprocess.sh`. You also need to make sure that node will find the uglifyjs library by making a symbolic link to it from `~/.node_libraries/uglify-js`, e.g.
ln -s ~/Development/JavaScript/uglifyjs ~/.node_libraries/uglify-js
### Building the Documentation

View file

@ -30,7 +30,7 @@ cd jsdoc-toolkit
java -jar jsrun.jar app/run.js -c=conf/$MODE.conf -D="renderMode:$MODE"
cd ..
if [ $MODE == "docs" ]
if [ $MODE = "docs" ]
then
# Build paper.js library for documentation
./preprocess.sh stripped ../src/paper.js ../dist/docs/resources/js/paper.js\

@ -1 +1 @@
Subproject commit 0bf4e2d0a1b4f887fbe0058b3299fc26dded4501
Subproject commit 17d8366c4f91ce9fa98e948755a63590a7871378

View file

@ -17,4 +17,4 @@
# through the seperate source files in the src directory. Very useful during
# development of the library itself.
./preprocess.sh ../lib/parse-js.js ../lib/parse-js-min.js "" uglified
./preprocess.sh compressed ../lib/parse-js.js ../lib/parse-js-min.js '{}'

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CharacterStyle</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Color</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CompoundPath</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -2554,6 +2555,83 @@ raster.scale(5);
</div>
</div>
</div>
</div>
<div id="hittest-point-member" class="member">
<div id="hittest-point-link" class="member-link">
<a name="hittest-point" href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
<div id="hittest-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('hittest-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Perform a hit test on the item (and its children, if it is a
<a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point.</p>
<p>The optional options object allows you to control the specifics of the
hit test and may contain a combination of the following values:</p>
<p><b>tolerance:</b> <tt>Number</tt> - The tolerance of the hit test in
points.</p>
<p><b>options.type:</b> Only hit test again a certain item
type: <a href="../classes/PathItem.html"><tt>PathItem</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/TextItem.html"><tt>TextItem</tt></a>, etc.</p>
<p><b>options.fill:</b> <tt>Boolean</tt> - Hit test the fill of items.</p>
<p><b>options.stroke:</b> <tt>Boolean</tt> - Hit test the curves of path items,
taking into account stroke width.</p>
<p><b>options.segment:</b> <tt>Boolean</tt> - Hit test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of
<a href="../classes/Path.html"><tt>Path</tt></a> items.</p>
<p><b>options.handles:</b> <tt>Boolean</tt> - Hit test for the handles
(<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</p>
<p><b>options.ends:</b> <tt>Boolean</tt> - Only hit test for the first or last
segment points of open path items.</p>
<p><b>options.bounds:</b> <tt>Boolean</tt> - Hit test the corners and side-centers
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.center:</b> <tt>Boolean</tt> - Hit test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a>
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.guide:</b> <tt>Boolean</tt> - Hit test items that have
<a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <tt>true</tt>.</p>
<p><b>options.selected:</b> <tt>Boolean</tt> - Only hit selected items.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point where the hit test should be performed
</li>
<li>
<tt>options:</tt>
<tt>Object</tt>
&mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true,
tolerance: 2 }</tt>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;A hit result object that contains more
information about what exactly was hit or <tt>null</tt> if nothing was
hit.
</li>
</ul>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Curve</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CurveLocation</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Event</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Gradient</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>GradientColor</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>GradientStop</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>GrayColor</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Group</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -1759,6 +1760,83 @@ raster.scale(5);
</div>
</div>
</div>
</div>
<div id="hittest-point-member" class="member">
<div id="hittest-point-link" class="member-link">
<a name="hittest-point" href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
<div id="hittest-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('hittest-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Perform a hit test on the item (and its children, if it is a
<a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point.</p>
<p>The optional options object allows you to control the specifics of the
hit test and may contain a combination of the following values:</p>
<p><b>tolerance:</b> <tt>Number</tt> - The tolerance of the hit test in
points.</p>
<p><b>options.type:</b> Only hit test again a certain item
type: <a href="../classes/PathItem.html"><tt>PathItem</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/TextItem.html"><tt>TextItem</tt></a>, etc.</p>
<p><b>options.fill:</b> <tt>Boolean</tt> - Hit test the fill of items.</p>
<p><b>options.stroke:</b> <tt>Boolean</tt> - Hit test the curves of path items,
taking into account stroke width.</p>
<p><b>options.segment:</b> <tt>Boolean</tt> - Hit test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of
<a href="../classes/Path.html"><tt>Path</tt></a> items.</p>
<p><b>options.handles:</b> <tt>Boolean</tt> - Hit test for the handles
(<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</p>
<p><b>options.ends:</b> <tt>Boolean</tt> - Only hit test for the first or last
segment points of open path items.</p>
<p><b>options.bounds:</b> <tt>Boolean</tt> - Hit test the corners and side-centers
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.center:</b> <tt>Boolean</tt> - Hit test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a>
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.guide:</b> <tt>Boolean</tt> - Hit test items that have
<a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <tt>true</tt>.</p>
<p><b>options.selected:</b> <tt>Boolean</tt> - Only hit selected items.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point where the hit test should be performed
</li>
<li>
<tt>options:</tt>
<tt>Object</tt>
&mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true,
tolerance: 2 }</tt>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;A hit result object that contains more
information about what exactly was hit or <tt>null</tt> if nothing was
hit.
</li>
</ul>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HSBColor</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HSLColor</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -92,8 +93,8 @@ between <tt>0</tt> and <tt>1</tt>
var circle = new Path.Circle(new Point(80, 50), 30);
// Create an HSLColor with a hue of 90 degrees, a saturation
// 100% and a lightness of 100%:
circle.fillColor = new HSLColor(90, 1, 1);
// 100% and a lightness of 50%:
circle.fillColor = new HSLColor(90, 1, 0.5);
</script>
<div class="canvas"><canvas width="516" height="100" id="canvas-0"></canvas></div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HitResult</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -16,9 +17,9 @@
<div class="reference-class">
<h1>HitResult</h1>
<p> Extends <b><a href="../classes/CurveLocation.html"><tt>CurveLocation</tt></a></b></p>
<p>A HitResult object contains information about the results of a hit
test. It is returned by <a href="../classes/Item.html#hittest-point"><tt>item.hitTest(point)</tt></a> and
<a href="../classes/Project.html#hittest-point"><tt>project.hitTest(point)</tt></a>.</p>
</div>
@ -26,15 +27,142 @@
<div class="reference-members"><h2>Properties</h2>
<div id="type-member" class="member">
<div id="type-link" class="member-link">
<a name="type" href="#" onClick="return toggleMember('type', false);"><tt><b>type</b></tt></a>
</div>
<div id="type-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('type', false);"><tt><b>type</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('type', false);"></div>
<div class="clear"></div>
</div>
<!-- =========================== inherited properties ====================== -->
<div class="reference-members"><h2>Properties inherited from <a href="../classes/CurveLocation.html"><tt>CurveLocation</tt></a></h2>
<div class="member-text">
<p>Describes the type of the hit result. For example, if you hit a segment
point, the type would be 'segment'.</p>
<ul><b>Type:</b>
<li>
<tt>String('segment', 'handle-in', 'handle-out', 'stroke', 'fill',
'bounds', 'center')</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="name-member" class="member">
<div id="name-link" class="member-link">
<a name="name" href="#" onClick="return toggleMember('name', false);"><tt><b>name</b></tt></a>
</div>
<div id="name-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('name', false);"><tt><b>name</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('name', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>If the HitResult has a <a href="../classes/HitResult.html#type"><tt>hitResult.type</tt></a> of 'bounds', this property
describes which corner of the bounding rectangle was hit.</p>
<ul><b>Type:</b>
<li>
<tt>String('top-left', 'top-right', 'bottom-left', 'bottom-right',
'left-center', 'top-center', 'right-center', 'bottom-center')</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="item-member" class="member">
<div id="item-link" class="member-link">
<a name="item" href="#" onClick="return toggleMember('item', false);"><tt><b>item</b></tt></a>
</div>
<div id="item-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('item', false);"><tt><b>item</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('item', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The item that was hit.</p>
<ul><b>Type:</b>
<li>
<a href="../classes/Item.html"><tt>Item</tt></a>
</li>
</ul>
</div>
</div>
</div>
<div id="location-member" class="member">
<div id="location-link" class="member-link">
<a name="location" href="#" onClick="return toggleMember('location', false);"><tt><b>location</b></tt></a>
</div>
<div id="location-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('location', false);"><tt><b>location</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('location', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>If the HitResult has a type of 'stroke', this property gives more
information about the exact position that was hit on the path.</p>
<ul><b>Type:</b>
<li>
<a href="../classes/CurveLocation.html"><tt>CurveLocation</tt></a>
</li>
</ul>
</div>
</div>
</div>
<div id="segment-member" class="member">
<div id="segment-link" class="member-link">
<a name="segment" href="#" onClick="return toggleMember('segment', false);"><tt><b>segment</b></tt></a>
@ -51,7 +179,9 @@
</div>
<div class="member-text">
<p>The segment of the curve which is closer to the described location.</p>
<p>If the HitResult has a type of 'stroke', 'segment', 'handle-in' or
'handle-out', this property refers to the Segment that was hit or that
is closest to the hitResult.location on the curve.</p>
<ul><b>Type:</b>
@ -65,205 +195,8 @@
</div>
</div>
<div id="curve-member" class="member">
<div id="curve-link" class="member-link">
<a name="curve" href="#" onClick="return toggleMember('curve', false);"><tt><b>curve</b></tt></a>
</div>
<div id="curve-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('curve', false);"><tt><b>curve</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('curve', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The curve by which the location is defined.</p>
<ul><b>Type:</b>
<li>
<a href="../classes/Curve.html"><tt>Curve</tt></a>
</li>
</ul>
</div>
</div>
</div>
<div id="path-member" class="member">
<div id="path-link" class="member-link">
<a name="path" href="#" onClick="return toggleMember('path', false);"><tt><b>path</b></tt></a>
</div>
<div id="path-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('path', false);"><tt><b>path</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('path', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The path this curve belongs to, if any.</p>
<ul><b>Type:</b>
<li>
<a href="../classes/Item.html"><tt>Item</tt></a>
</li>
</ul>
</div>
</div>
</div>
<div id="index-member" class="member">
<div id="index-link" class="member-link">
<a name="index" href="#" onClick="return toggleMember('index', false);"><tt><b>index</b></tt></a>
</div>
<div id="index-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('index', false);"><tt><b>index</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('index', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The index of the curve within the <a href="../classes/Path.html#curves"><tt>path.curves</tt></a> list, if the
curve is part of a <a href="../classes/Path.html"><tt>Path</tt></a> item.</p>
<ul><b>Type:</b>
<li>
<tt>Index</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="offset-member" class="member">
<div id="offset-link" class="member-link">
<a name="offset" href="#" onClick="return toggleMember('offset', false);"><tt><b>offset</b></tt></a>
</div>
<div id="offset-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('offset', false);"><tt><b>offset</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('offset', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The length of the path from its beginning up to the location described
by this object.</p>
<ul><b>Type:</b>
<li>
<tt>Number</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="curveoffset-member" class="member">
<div id="curveoffset-link" class="member-link">
<a name="curveoffset" href="#" onClick="return toggleMember('curveoffset', false);"><tt><b>curveOffset</b></tt></a>
</div>
<div id="curveoffset-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('curveoffset', false);"><tt><b>curveOffset</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('curveoffset', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The length of the curve from its beginning up to the location described
by this object.</p>
<ul><b>Type:</b>
<li>
<tt>Number</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="parameter-member" class="member">
<div id="parameter-link" class="member-link">
<a name="parameter" href="#" onClick="return toggleMember('parameter', false);"><tt><b>parameter</b></tt></a>
</div>
<div id="parameter-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('parameter', false);"><tt><b>parameter</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('parameter', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The curve parameter, as used by various bezier curve calculations. It is
value between <tt>0</tt> (beginning of the curve) and <tt>1</tt> (end of
the curve).</p>
<ul><b>Type:</b>
<li>
<tt>Number</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="point-member" class="member">
<div id="point-link" class="member-link">
<a name="point" href="#" onClick="return toggleMember('point', false);"><tt><b>point</b></tt></a>
@ -280,8 +213,7 @@ the curve).</p>
</div>
<div class="member-text">
<p>The point which is defined by the <a href="../classes/CurveLocation.html#curve" onclick="return toggleMember('curve', true);"><tt>curve</tt></a> and
<a href="../classes/CurveLocation.html#parameter" onclick="return toggleMember('parameter', true);"><tt>parameter</tt></a>.</p>
<p>The hit point.</p>
<ul><b>Type:</b>
@ -295,208 +227,11 @@ the curve).</p>
</div>
</div>
<div id="tangent-member" class="member">
<div id="tangent-link" class="member-link">
<a name="tangent" href="#" onClick="return toggleMember('tangent', false);"><tt><b>tangent</b></tt></a>
</div>
<div id="tangent-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('tangent', false);"><tt><b>tangent</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('tangent', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The tangential vector to the <a href="../classes/CurveLocation.html#curve" onclick="return toggleMember('curve', true);"><tt>curve</tt></a> at the given location.</p>
<ul><b>Type:</b>
<li>
<a href="../classes/Point.html"><tt>Point</tt></a>
</li>
</ul>
</div>
</div>
</div>
<div id="normal-member" class="member">
<div id="normal-link" class="member-link">
<a name="normal" href="#" onClick="return toggleMember('normal', false);"><tt><b>normal</b></tt></a>
</div>
<div id="normal-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('normal', false);"><tt><b>normal</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('normal', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The normal vector to the <a href="../classes/CurveLocation.html#curve" onclick="return toggleMember('curve', true);"><tt>curve</tt></a> at the given location.</p>
<ul><b>Type:</b>
<li>
<a href="../classes/Point.html"><tt>Point</tt></a>
</li>
</ul>
</div>
</div>
</div>
<div id="distance-member" class="member">
<div id="distance-link" class="member-link">
<a name="distance" href="#" onClick="return toggleMember('distance', false);"><tt><b>distance</b></tt></a>
</div>
<div id="distance-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('distance', false);"><tt><b>distance</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('distance', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The distance from the queried point to the returned location.</p>
<ul><b>Type:</b>
<li>
<tt>Number</tt>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- =========================== inherited methods ========================= -->
<div class="reference-members"><h2>Methods inherited from <a href="../classes/CurveLocation.html"><tt>CurveLocation</tt></a></h2>
<div id="curvelocation-curve-parameter-point-distance-member" class="member">
<div id="curvelocation-curve-parameter-point-distance-link" class="member-link">
<a name="curvelocation-curve-parameter-point-distance" href="#" onClick="return toggleMember('curvelocation-curve-parameter-point-distance', false);"><tt><b>initialize</b>(curve, parameter, point, distance)</tt></a>
</div>
<div id="curvelocation-curve-parameter-point-distance-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('curvelocation-curve-parameter-point-distance', false);"><tt><b>initialize</b>(curve, parameter, point, distance)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('curvelocation-curve-parameter-point-distance', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Creates a new CurveLocation object.</p>
<ul><b>Parameters:</b>
<li>
<tt>curve:</tt>
<a href="../classes/Curve.html"><tt>Curve</tt></a>
</li>
<li>
<tt>parameter:</tt>
<tt>Number</tt>
</li>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
</li>
<li>
<tt>distance:</tt>
</div>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/CurveLocation.html"><tt>CurveLocation</tt></a></tt>
</li>
</ul>
</div>
</div>
</div>
<div id="tostring-member" class="member">
<div id="tostring-link" class="member-link">
<a name="tostring" href="#" onClick="return toggleMember('tostring', false);"><tt><b>toString</b>()</tt></a>
</div>
<div id="tostring-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('tostring', false);"><tt><b>toString</b>()</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('tostring', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<ul><b>Returns:</b>
<li>
<tt><tt>String</tt></tt>&nbsp;&mdash;&nbsp;A string representation of the curve location.
</li>
</ul>
</div>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Item</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -1624,6 +1625,83 @@ raster.scale(5);
</div>
</div>
</div>
</div>
<div id="hittest-point-member" class="member">
<div id="hittest-point-link" class="member-link">
<a name="hittest-point" href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
<div id="hittest-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('hittest-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Perform a hit test on the item (and its children, if it is a
<a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point.</p>
<p>The optional options object allows you to control the specifics of the
hit test and may contain a combination of the following values:</p>
<p><b>tolerance:</b> <tt>Number</tt> - The tolerance of the hit test in
points.</p>
<p><b>options.type:</b> Only hit test again a certain item
type: <a href="../classes/PathItem.html"><tt>PathItem</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/TextItem.html"><tt>TextItem</tt></a>, etc.</p>
<p><b>options.fill:</b> <tt>Boolean</tt> - Hit test the fill of items.</p>
<p><b>options.stroke:</b> <tt>Boolean</tt> - Hit test the curves of path items,
taking into account stroke width.</p>
<p><b>options.segment:</b> <tt>Boolean</tt> - Hit test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of
<a href="../classes/Path.html"><tt>Path</tt></a> items.</p>
<p><b>options.handles:</b> <tt>Boolean</tt> - Hit test for the handles
(<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</p>
<p><b>options.ends:</b> <tt>Boolean</tt> - Only hit test for the first or last
segment points of open path items.</p>
<p><b>options.bounds:</b> <tt>Boolean</tt> - Hit test the corners and side-centers
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.center:</b> <tt>Boolean</tt> - Hit test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a>
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.guide:</b> <tt>Boolean</tt> - Hit test items that have
<a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <tt>true</tt>.</p>
<p><b>options.selected:</b> <tt>Boolean</tt> - Only hit selected items.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point where the hit test should be performed
</li>
<li>
<tt>options:</tt>
<tt>Object</tt>
&mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true,
tolerance: 2 }</tt>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;A hit result object that contains more
information about what exactly was hit or <tt>null</tt> if nothing was
hit.
</li>
</ul>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Key</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>KeyEvent</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Layer</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -1718,6 +1719,83 @@ raster.scale(5);
</div>
</div>
</div>
</div>
<div id="hittest-point-member" class="member">
<div id="hittest-point-link" class="member-link">
<a name="hittest-point" href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
<div id="hittest-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('hittest-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Perform a hit test on the item (and its children, if it is a
<a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point.</p>
<p>The optional options object allows you to control the specifics of the
hit test and may contain a combination of the following values:</p>
<p><b>tolerance:</b> <tt>Number</tt> - The tolerance of the hit test in
points.</p>
<p><b>options.type:</b> Only hit test again a certain item
type: <a href="../classes/PathItem.html"><tt>PathItem</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/TextItem.html"><tt>TextItem</tt></a>, etc.</p>
<p><b>options.fill:</b> <tt>Boolean</tt> - Hit test the fill of items.</p>
<p><b>options.stroke:</b> <tt>Boolean</tt> - Hit test the curves of path items,
taking into account stroke width.</p>
<p><b>options.segment:</b> <tt>Boolean</tt> - Hit test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of
<a href="../classes/Path.html"><tt>Path</tt></a> items.</p>
<p><b>options.handles:</b> <tt>Boolean</tt> - Hit test for the handles
(<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</p>
<p><b>options.ends:</b> <tt>Boolean</tt> - Only hit test for the first or last
segment points of open path items.</p>
<p><b>options.bounds:</b> <tt>Boolean</tt> - Hit test the corners and side-centers
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.center:</b> <tt>Boolean</tt> - Hit test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a>
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.guide:</b> <tt>Boolean</tt> - Hit test items that have
<a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <tt>true</tt>.</p>
<p><b>options.selected:</b> <tt>Boolean</tt> - Only hit selected items.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point where the hit test should be performed
</li>
<li>
<tt>options:</tt>
<tt>Object</tt>
&mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true,
tolerance: 2 }</tt>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;A hit result object that contains more
information about what exactly was hit or <tt>null</tt> if nothing was
hit.
</li>
</ul>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Line</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Matrix</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -25,9 +26,9 @@ transforms source coordinates (x,y) into destination coordinates (x',y')
by considering them to be a column vector and multiplying the coordinate
vector by the matrix according to the following process:</p>
<pre class="code">
[ x'] [ m00 m01 m02 ] [ x ] [ m00x + m01y + m02 ]
[ y'] = [ m10 m11 m12 ] [ y ] = [ m10x + m11y + m12 ]
[ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
[ x ] [ a b tx ] [ x ] [ a * x + b * y + tx ]
[ y ] = [ c d ty ] [ y ] = [ c * x + d * y + ty ]
[ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
</pre>
<p>This class is optimized for speed and minimizes calculations based on its
knowledge of the underlying matrix (as opposed to say simply performing
@ -39,18 +40,18 @@ matrix multiplication).</p>
<div class="reference-members"><h2>Constructors</h2>
<div id="matrix-m00-m10-m01-m11-m02-m12-member" class="member">
<div id="matrix-m00-m10-m01-m11-m02-m12-link" class="member-link">
<a name="matrix-m00-m10-m01-m11-m02-m12" href="#" onClick="return toggleMember('matrix-m00-m10-m01-m11-m02-m12', false);"><tt><b>Matrix</b>(m00, m10, m01, m11, m02, m12)</tt></a>
<div id="matrix-a-c-b-d-tx-ty-member" class="member">
<div id="matrix-a-c-b-d-tx-ty-link" class="member-link">
<a name="matrix-a-c-b-d-tx-ty" href="#" onClick="return toggleMember('matrix-a-c-b-d-tx-ty', false);"><tt><b>Matrix</b>(a, c, b, d, tx, ty)</tt></a>
</div>
<div id="matrix-m00-m10-m01-m11-m02-m12-description" class="member-description hidden">
<div id="matrix-a-c-b-d-tx-ty-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('matrix-m00-m10-m01-m11-m02-m12', false);"><tt><b>Matrix</b>(m00, m10, m01, m11, m02, m12)</tt></a>
<a href="#" onClick="return toggleMember('matrix-a-c-b-d-tx-ty', false);"><tt><b>Matrix</b>(a, c, b, d, tx, ty)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('matrix-m00-m10-m01-m11-m02-m12', false);"></div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('matrix-a-c-b-d-tx-ty', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
@ -59,44 +60,44 @@ matrix multiplication).</p>
<ul><b>Parameters:</b>
<li>
<tt>m00:</tt>
<tt>a:</tt>
<tt>Number</tt>
&mdash;&nbsp;The m00 coordinate of the transform.
&mdash;&nbsp;The scaleX coordinate of the transform
</li>
<li>
<tt>m10:</tt>
<tt>c:</tt>
<tt>Number</tt>
&mdash;&nbsp;The m10 coordinate of the transform.
&mdash;&nbsp;The shearY coordinate of the transform
</li>
<li>
<tt>m01:</tt>
<tt>b:</tt>
<tt>Number</tt>
&mdash;&nbsp;The m01 coordinate of the transform.
&mdash;&nbsp;The shearX coordinate of the transform
</li>
<li>
<tt>m11:</tt>
<tt>d:</tt>
<tt>Number</tt>
&mdash;&nbsp;The m11 coordinate of the transform.
&mdash;&nbsp;The scaleY coordinate of the transform
</li>
<li>
<tt>m02:</tt>
<tt>tx:</tt>
<tt>Number</tt>
&mdash;&nbsp;The m02 coordinate of the transform.
&mdash;&nbsp;The translateX coordinate of the transform
</li>
<li>
<tt>m12:</tt>
<tt>ty:</tt>
<tt>Number</tt>
&mdash;&nbsp;The m12 coordinate of the transform.
&mdash;&nbsp;The translateY coordinate of the transform
</li>
@ -115,6 +116,235 @@ matrix multiplication).</p>
<div class="reference-members"><h2>Properties</h2>
<div id="scalex-member" class="member">
<div id="scalex-link" class="member-link">
<a name="scalex" href="#" onClick="return toggleMember('scalex', false);"><tt><b>scaleX</b></tt></a>
</div>
<div id="scalex-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('scalex', false);"><tt><b>scaleX</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('scalex', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The scaling factor in the x-direction (<tt>a</tt>).</p>
<ul><b>Type:</b>
<li>
<tt>Number</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="scaley-member" class="member">
<div id="scaley-link" class="member-link">
<a name="scaley" href="#" onClick="return toggleMember('scaley', false);"><tt><b>scaleY</b></tt></a>
</div>
<div id="scaley-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('scaley', false);"><tt><b>scaleY</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('scaley', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The scaling factor in the y-direction (<tt>d</tt>).</p>
<ul><b>Type:</b>
<li>
<tt>Number</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="shearx-member" class="member">
<div id="shearx-link" class="member-link">
<a name="shearx" href="#" onClick="return toggleMember('shearx', false);"><tt><b>shearX</b></tt></a>
</div>
<div id="shearx-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('shearx', false);"><tt><b>shearX</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('shearx', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<ul><b>Type:</b>
<li>
<tt>Number</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="sheary-member" class="member">
<div id="sheary-link" class="member-link">
<a name="sheary" href="#" onClick="return toggleMember('sheary', false);"><tt><b>shearY</b></tt></a>
</div>
<div id="sheary-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('sheary', false);"><tt><b>shearY</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('sheary', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<ul><b>Type:</b>
<li>
<tt>Number</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="translatex-member" class="member">
<div id="translatex-link" class="member-link">
<a name="translatex" href="#" onClick="return toggleMember('translatex', false);"><tt><b>translateX</b></tt></a>
</div>
<div id="translatex-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('translatex', false);"><tt><b>translateX</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('translatex', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The translation in the x-direction (<tt>tx</tt>).</p>
<ul><b>Type:</b>
<li>
<tt>Number</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="translatey-member" class="member">
<div id="translatey-link" class="member-link">
<a name="translatey" href="#" onClick="return toggleMember('translatey', false);"><tt><b>translateY</b></tt></a>
</div>
<div id="translatey-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('translatey', false);"><tt><b>translateY</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('translatey', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The translation in the y-direction (<tt>ty</tt>).</p>
<ul><b>Type:</b>
<li>
<tt>Number</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="values-member" class="member">
<div id="values-link" class="member-link">
<a name="values" href="#" onClick="return toggleMember('values', false);"><tt><b>values</b></tt></a>
</div>
<div id="values-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('values', false);"><tt><b>values</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('values', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The transform values as an array, in the same sequence as they are passed
to {@link #initialize(a, c, b, d, tx, ty)}.</p>
<ul><b>Type:</b>
<li>
<tt>Number</tt>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- ============================== methods ================================ -->
@ -154,18 +384,18 @@ matrix multiplication).</p>
</div>
<div id="set-m00-m10-m01-m11-m02-m12-member" class="member">
<div id="set-m00-m10-m01-m11-m02-m12-link" class="member-link">
<a name="set-m00-m10-m01-m11-m02-m12" href="#" onClick="return toggleMember('set-m00-m10-m01-m11-m02-m12', false);"><tt><b>set</b>(m00, m10, m01, m11, m02, m12)</tt></a>
<div id="set-a-c-b-d-tx-ty-member" class="member">
<div id="set-a-c-b-d-tx-ty-link" class="member-link">
<a name="set-a-c-b-d-tx-ty" href="#" onClick="return toggleMember('set-a-c-b-d-tx-ty', false);"><tt><b>set</b>(a, c, b, d, tx, ty)</tt></a>
</div>
<div id="set-m00-m10-m01-m11-m02-m12-description" class="member-description hidden">
<div id="set-a-c-b-d-tx-ty-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('set-m00-m10-m01-m11-m02-m12', false);"><tt><b>set</b>(m00, m10, m01, m11, m02, m12)</tt></a>
<a href="#" onClick="return toggleMember('set-a-c-b-d-tx-ty', false);"><tt><b>set</b>(a, c, b, d, tx, ty)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('set-m00-m10-m01-m11-m02-m12', false);"></div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('set-a-c-b-d-tx-ty', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
@ -174,44 +404,44 @@ matrix multiplication).</p>
<ul><b>Parameters:</b>
<li>
<tt>m00:</tt>
<tt>a:</tt>
<tt>Number</tt>
&mdash;&nbsp;The m00 coordinate of the transform.
&mdash;&nbsp;The scaleX coordinate of the transform
</li>
<li>
<tt>m10:</tt>
<tt>c:</tt>
<tt>Number</tt>
&mdash;&nbsp;The m10 coordinate of the transform.
&mdash;&nbsp;The shearY coordinate of the transform
</li>
<li>
<tt>m01:</tt>
<tt>b:</tt>
<tt>Number</tt>
&mdash;&nbsp;The m01 coordinate of the transform.
&mdash;&nbsp;The shearX coordinate of the transform
</li>
<li>
<tt>m11:</tt>
<tt>d:</tt>
<tt>Number</tt>
&mdash;&nbsp;The m11 coordinate of the transform.
&mdash;&nbsp;The scaleY coordinate of the transform
</li>
<li>
<tt>m02:</tt>
<tt>tx:</tt>
<tt>Number</tt>
&mdash;&nbsp;The m02 coordinate of the transform.
&mdash;&nbsp;The translateX coordinate of the transform
</li>
<li>
<tt>m12:</tt>
<tt>ty:</tt>
<tt>Number</tt>
&mdash;&nbsp;The m12 coordinate of the transform.
&mdash;&nbsp;The translateY coordinate of the transform
</li>
@ -221,7 +451,7 @@ matrix multiplication).</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -255,15 +485,14 @@ matrix multiplication).</p>
<li>
<tt>scale:</tt>
<tt>Number</tt>
&mdash;&nbsp;The scaling factor.
&mdash;&nbsp;The scaling factor
</li>
<li>
<tt>center:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The center for the scaling
transformation.
&mdash;&nbsp;The center for the scaling transformation
&mdash;&nbsp;optional
</li>
@ -273,7 +502,7 @@ transformation.
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -307,22 +536,21 @@ transformation.
<li>
<tt>hor:</tt>
<tt>Number</tt>
&mdash;&nbsp;The horizontal scaling factor.
&mdash;&nbsp;The horizontal scaling factor
</li>
<li>
<tt>ver:</tt>
<tt>Number</tt>
&mdash;&nbsp;The vertical scaling factor.
&mdash;&nbsp;The vertical scaling factor
</li>
<li>
<tt>center:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The center for the scaling
transformation.
&mdash;&nbsp;The center for the scaling transformation
&mdash;&nbsp;optional
</li>
@ -332,7 +560,7 @@ transformation.
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -366,7 +594,7 @@ transformation.
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The vector to translate by.
&mdash;&nbsp;The vector to translate by
</li>
@ -376,7 +604,7 @@ transformation.
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -410,14 +638,14 @@ transformation.
<li>
<tt>dx:</tt>
<tt>Number</tt>
&mdash;&nbsp;The distance to translate in the x direction.
&mdash;&nbsp;The distance to translate in the x direction
</li>
<li>
<tt>dy:</tt>
<tt>Number</tt>
&mdash;&nbsp;The distance to translate in the y direction.
&mdash;&nbsp;The distance to translate in the y direction
</li>
@ -427,7 +655,7 @@ transformation.
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -462,14 +690,14 @@ anchor point.</p>
<li>
<tt>angle:</tt>
<tt>Number</tt>
&mdash;&nbsp;The angle of rotation measured in degrees.
&mdash;&nbsp;The angle of rotation measured in degrees
</li>
<li>
<tt>center:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The anchor point to rotate around.
&mdash;&nbsp;The anchor point to rotate around
</li>
@ -479,7 +707,7 @@ anchor point.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -514,21 +742,21 @@ anchor point.</p>
<li>
<tt>angle:</tt>
<tt>Number</tt>
&mdash;&nbsp;The angle of rotation measured in degrees.
&mdash;&nbsp;The angle of rotation measured in degrees
</li>
<li>
<tt>x:</tt>
<tt>Number</tt>
&mdash;&nbsp;The x coordinate of the anchor point.
&mdash;&nbsp;The x coordinate of the anchor point
</li>
<li>
<tt>y:</tt>
<tt>Number</tt>
&mdash;&nbsp;The y coordinate of the anchor point.
&mdash;&nbsp;The y coordinate of the anchor point
</li>
@ -538,7 +766,7 @@ anchor point.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -572,14 +800,14 @@ anchor point.</p>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The shear factor in x and y direction.
&mdash;&nbsp;The shear factor in x and y direction
</li>
<li>
<tt>center:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The center for the shear transformation.
&mdash;&nbsp;The center for the shear transformation
&mdash;&nbsp;optional
</li>
@ -589,7 +817,7 @@ anchor point.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -623,21 +851,21 @@ anchor point.</p>
<li>
<tt>hor:</tt>
<tt>Number</tt>
&mdash;&nbsp;The horizontal shear factor.
&mdash;&nbsp;The horizontal shear factor
</li>
<li>
<tt>ver:</tt>
<tt>Number</tt>
&mdash;&nbsp;The vertical shear factor.
&mdash;&nbsp;The vertical shear factor
</li>
<li>
<tt>center:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The center for the shear transformation.
&mdash;&nbsp;The center for the shear transformation
&mdash;&nbsp;optional
</li>
@ -647,7 +875,7 @@ anchor point.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -714,7 +942,7 @@ anchor point.</p>
<li>
<tt>mx:</tt>
<a href="../classes/Matrix.html"><tt>Matrix</tt></a>
&mdash;&nbsp;The transform to concatenate.
&mdash;&nbsp;The transform to concatenate
</li>
@ -724,7 +952,7 @@ anchor point.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -758,7 +986,7 @@ anchor point.</p>
<li>
<tt>mx:</tt>
<a href="../classes/Matrix.html"><tt>Matrix</tt></a>
&mdash;&nbsp;The transform to preconcatenate.
&mdash;&nbsp;The transform to preconcatenate
</li>
@ -768,7 +996,7 @@ anchor point.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -804,7 +1032,7 @@ destination array.</p>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point to be transformed.
&mdash;&nbsp;The point to be transformed
</li>
@ -812,14 +1040,14 @@ destination array.</p>
<tt>src:</tt>
<tt>Number</tt>
&mdash;&nbsp;The array containing the source points
as x, y value pairs.
as x, y value pairs
</li>
<li>
<tt>srcOff:</tt>
<tt>Number</tt>
&mdash;&nbsp;The offset to the first point to be transformed.
&mdash;&nbsp;The offset to the first point to be transformed
</li>
@ -827,7 +1055,7 @@ destination array.</p>
<tt>dst:</tt>
<tt>Number</tt>
&mdash;&nbsp;The array into which to store the transformed
point pairs.
point pairs
</li>
@ -835,14 +1063,14 @@ destination array.</p>
<tt>dstOff:</tt>
<tt>Number</tt>
&mdash;&nbsp;The offset of the location of the first
transformed point in the destination array.
transformed point in the destination array
</li>
<li>
<tt>numPts:</tt>
<tt>Number</tt>
&mdash;&nbsp;The number of points to tranform.
&mdash;&nbsp;The number of points to tranform
</li>
@ -877,7 +1105,7 @@ destination array.</p>
<ul><b>Returns:</b>
<li>
<tt><tt>Number</tt></tt>&nbsp;&mdash;&nbsp;The determinant of this transform.
<tt><tt>Number</tt></tt>&nbsp;&mdash;&nbsp;The determinant of this transform
</li>
</ul>
@ -904,16 +1132,16 @@ destination array.</p>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Returns the rotation angle of the matrix. If a non-uniform
rotation is applied as a result of a shear() or scale() command,
undefined is returned, as the resulting transformation cannot be
expressed in one rotation angle</p>
<ul><b>Returns:</b>
<li>
<tt><tt>Number</tt></tt>&nbsp;&mdash;&nbsp;The rotation angle of the matrix. If a non-uniform
rotation is applied as a result of a shear() or scale() command,
undefined is returned, as the resulting transformation cannot be
expressed in one rotation angle.
<tt><tt>Number</tt></tt>&nbsp;&mdash;&nbsp;The rotation angle of the matrix
</li>
</ul>
@ -946,7 +1174,7 @@ expressed in one rotation angle.
<ul><b>Returns:</b>
<li>
<tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;Whether this transform is the identity transform.
<tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;Whether this transform is the identity transform
</li>
</ul>
@ -980,7 +1208,7 @@ invertible if the determinant is 0 or any value is non-finite or NaN.</p>
<ul><b>Returns:</b>
<li>
<tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;Whether the transform is invertible.
<tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;Whether the transform is invertible
</li>
</ul>
@ -1014,7 +1242,7 @@ inverted.</p>
<ul><b>Returns:</b>
<li>
<tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;Whether the matrix is singular.
<tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;Whether the matrix is singular
</li>
</ul>
@ -1041,14 +1269,16 @@ inverted.</p>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Inverts the transformation of the matrix. If the matrix is not invertible
(in which case <a href="../classes/Matrix.html#issingular" onclick="return toggleMember('issingular', true);"><tt>isSingular</tt></a>() returns true), <tt>null </tt> is
returned.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;An Matrix object representing the inverse
transformation.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;The inverted matrix, or <tt>null </tt>, if the matrix is
singular
</li>
</ul>
@ -1082,14 +1312,14 @@ inverted.</p>
<li>
<tt>hor:</tt>
<tt>Number</tt>
&mdash;&nbsp;The horizontal scaling factor.
&mdash;&nbsp;The horizontal scaling factor
</li>
<li>
<tt>ver:</tt>
<tt>Number</tt>
&mdash;&nbsp;The vertical scaling factor.
&mdash;&nbsp;The vertical scaling factor
</li>
@ -1099,7 +1329,7 @@ inverted.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -1133,14 +1363,14 @@ inverted.</p>
<li>
<tt>dx:</tt>
<tt>Number</tt>
&mdash;&nbsp;The distance to translate in the x direction.
&mdash;&nbsp;The distance to translate in the x direction
</li>
<li>
<tt>dy:</tt>
<tt>Number</tt>
&mdash;&nbsp;The distance to translate in the y direction.
&mdash;&nbsp;The distance to translate in the y direction
</li>
@ -1150,7 +1380,7 @@ inverted.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -1184,14 +1414,14 @@ inverted.</p>
<li>
<tt>hor:</tt>
<tt>Number</tt>
&mdash;&nbsp;The horizontal shear factor.
&mdash;&nbsp;The horizontal shear factor
</li>
<li>
<tt>ver:</tt>
<tt>Number</tt>
&mdash;&nbsp;The vertical shear factor.
&mdash;&nbsp;The vertical shear factor
</li>
@ -1201,7 +1431,7 @@ inverted.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -1235,21 +1465,21 @@ inverted.</p>
<li>
<tt>angle:</tt>
<tt>Number</tt>
&mdash;&nbsp;The angle of rotation measured in degrees.
&mdash;&nbsp;The angle of rotation measured in degrees
</li>
<li>
<tt>x:</tt>
<tt>Number</tt>
&mdash;&nbsp;The x coordinate of the anchor point.
&mdash;&nbsp;The x coordinate of the anchor point
</li>
<li>
<tt>y:</tt>
<tt>Number</tt>
&mdash;&nbsp;The y coordinate of the anchor point.
&mdash;&nbsp;The y coordinate of the anchor point
</li>
@ -1259,7 +1489,7 @@ inverted.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;This affine transform
</li>
</ul>
@ -1341,14 +1571,14 @@ inverted.</p>
<li>
<tt>hor:</tt>
<tt>Number</tt>
&mdash;&nbsp;The horizontal scaling factor.
&mdash;&nbsp;The horizontal scaling factor
</li>
<li>
<tt>ver:</tt>
<tt>Number</tt>
&mdash;&nbsp;The vertical scaling factor.
&mdash;&nbsp;The vertical scaling factor
</li>
@ -1359,7 +1589,7 @@ inverted.</p>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;A transform representing a scaling
transformation.
transformation
</li>
</ul>
@ -1393,14 +1623,14 @@ inverted.</p>
<li>
<tt>dx:</tt>
<tt>Number</tt>
&mdash;&nbsp;The distance to translate in the x direction.
&mdash;&nbsp;The distance to translate in the x direction
</li>
<li>
<tt>dy:</tt>
<tt>Number</tt>
&mdash;&nbsp;The distance to translate in the y direction.
&mdash;&nbsp;The distance to translate in the y direction
</li>
@ -1411,7 +1641,7 @@ inverted.</p>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;A transform representing a translation
transformation.
transformation
</li>
</ul>
@ -1445,14 +1675,14 @@ inverted.</p>
<li>
<tt>hor:</tt>
<tt>Number</tt>
&mdash;&nbsp;The horizontal shear factor.
&mdash;&nbsp;The horizontal shear factor
</li>
<li>
<tt>ver:</tt>
<tt>Number</tt>
&mdash;&nbsp;The vertical shear factor.
&mdash;&nbsp;The vertical shear factor
</li>
@ -1469,7 +1699,7 @@ inverted.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;A transform representing a shearing transformation.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;A transform representing a shearing transformation
</li>
</ul>
@ -1503,21 +1733,21 @@ inverted.</p>
<li>
<tt>angle:</tt>
<tt>Number</tt>
&mdash;&nbsp;The angle of rotation measured in degrees.
&mdash;&nbsp;The angle of rotation measured in degrees
</li>
<li>
<tt>x:</tt>
<tt>Number</tt>
&mdash;&nbsp;The x coordinate of the anchor point.
&mdash;&nbsp;The x coordinate of the anchor point
</li>
<li>
<tt>y:</tt>
<tt>Number</tt>
&mdash;&nbsp;The y coordinate of the anchor point.
&mdash;&nbsp;The y coordinate of the anchor point
</li>
@ -1527,7 +1757,7 @@ inverted.</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;A transform representing a rotation transformation.
<tt><a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt>&nbsp;&mdash;&nbsp;A transform representing a rotation transformation
</li>
</ul>

475
dist/docs/classes/PaperScope.html vendored Normal file
View file

@ -0,0 +1,475 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PaperScope</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
<link rel="stylesheet" href="../resources/css/style.css" type="text/css">
<link rel="stylesheet" href="../resources/css/paperscript.css" type="text/css">
<link rel="stylesheet" href="../resources/css/codemirror.css" type="text/css">
<script src="../resources/js/bootstrap.js" type="text/javascript"></script>
<script src="../resources/js/paper.js" type="text/javascript"></script>
<script src="../resources/js/codemirror.js" type="text/javascript"></script>
<script src="../resources/js/reference.js" type="text/javascript"></script>
</head>
<body class="reference">
<div class="reference-class">
<h1>PaperScope</h1>
<p>The <tt>PaperScope</tt> class represents the scope associated with a
Paper context. When working with PaperScript, these scopes are automatically
created for us, and through clever scoping the properties and methods of the
active scope seem to become part of the global scope.</p>
<p>When working with normal JavaScript code, <tt>PaperScope</tt> objects need to
be manually created and handled.</p>
<p>Paper classes can only be accessed through <tt>PaperScope</tt> objects. Thus
in PaperScript they are global, while in JavaScript, they are available on
the global <a href="../classes/global.html#paper"><tt>paper</tt></a> object. For JavaScript you can use
<a href="../classes/PaperScope.html#install-scope"><tt>paperScope.install(scope)</tt></a> to install the Paper classes and objects
on the global scope. Note that when working with more than one scope, this
still works for classes, but not for objects like <a href="../classes/PaperScope.html#project"><tt>paperScope.project</tt></a>,
since they are not updated in the injected scope if scopes are switched.</p>
<p>The global <a href="../classes/global.html#paper"><tt>paper</tt></a> object is simply a reference to the currently active
<tt>PaperScope</tt>.</p>
</div>
<!-- ============================== constructors ========================= -->
<div class="reference-members"><h2>Constructors</h2>
<div id="paperscope-member" class="member">
<div id="paperscope-link" class="member-link">
<a name="paperscope" href="#" onClick="return toggleMember('paperscope', false);"><tt><b>PaperScope</b>()</tt></a>
</div>
<div id="paperscope-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('paperscope', false);"><tt><b>PaperScope</b>()</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('paperscope', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Creates a PaperScope object.</p>
</div>
</div>
</div>
</div>
<div class="reference-members"><h2>Properties</h2>
<div id="version-member" class="member">
<div id="version-link" class="member-link">
<a name="version" href="#" onClick="return toggleMember('version', false);"><tt><b>version</b></tt></a>
</div>
<div id="version-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('version', false);"><tt><b>version</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('version', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The version of Paper.js, as a float number.</p>
<ul><b>Type:</b>
<li>
<tt>Number</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="project-member" class="member">
<div id="project-link" class="member-link">
<a name="project" href="#" onClick="return toggleMember('project', false);"><tt><b>project</b></tt></a>
</div>
<div id="project-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('project', false);"><tt><b>project</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('project', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The currently active project.</p>
<ul><b>Type:</b>
<li>
<a href="../classes/Project.html"><tt>Project</tt></a>
</li>
</ul>
</div>
</div>
</div>
<div id="projects-member" class="member">
<div id="projects-link" class="member-link">
<a name="projects" href="#" onClick="return toggleMember('projects', false);"><tt><b>projects</b></tt></a>
</div>
<div id="projects-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('projects', false);"><tt><b>projects</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('projects', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The list of all open projects within the current Paper.js context.</p>
<ul><b>Type:</b>
<li>
Array of <a href="../classes/Project.html"><tt>Project</tt></a> objects
</li>
</ul>
</div>
</div>
</div>
<div id="view-member" class="member">
<div id="view-link" class="member-link">
<a name="view" href="#" onClick="return toggleMember('view', false);"><tt><b>view</b></tt></a>
</div>
<div id="view-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('view', false);"><tt><b>view</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('view', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The active view of the active project.</p>
<ul><b>Type:</b>
<li>
<a href="../classes/View.html"><tt>View</tt></a>
</li>
</ul>
</div>
</div>
</div>
<div id="views-member" class="member">
<div id="views-link" class="member-link">
<a name="views" href="#" onClick="return toggleMember('views', false);"><tt><b>views</b></tt></a>
</div>
<div id="views-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('views', false);"><tt><b>views</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('views', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The list of view of the active project.</p>
<ul><b>Type:</b>
<li>
Array of <a href="../classes/View.html"><tt>View</tt></a> objects
</li>
</ul>
</div>
</div>
</div>
<div id="tool-member" class="member">
<div id="tool-link" class="member-link">
<a name="tool" href="#" onClick="return toggleMember('tool', false);"><tt><b>tool</b></tt></a>
</div>
<div id="tool-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('tool', false);"><tt><b>tool</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('tool', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The reference to the active tool.</p>
<ul><b>Type:</b>
<li>
<a href="../classes/Tool.html"><tt>Tool</tt></a>
</li>
</ul>
</div>
</div>
</div>
<div id="tools-member" class="member">
<div id="tools-link" class="member-link">
<a name="tools" href="#" onClick="return toggleMember('tools', false);"><tt><b>tools</b></tt></a>
</div>
<div id="tools-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('tools', false);"><tt><b>tools</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('tools', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The list of available tools.</p>
<ul><b>Type:</b>
<li>
Array of <a href="../classes/Tool.html"><tt>Tool</tt></a> objects
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- ============================== methods ================================ -->
<div class="reference-members"><h2>Methods</h2>
<div id="install-scope-member" class="member">
<div id="install-scope-link" class="member-link">
<a name="install-scope" href="#" onClick="return toggleMember('install-scope', false);"><tt><b>install</b>(scope)</tt></a>
</div>
<div id="install-scope-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('install-scope', false);"><tt><b>install</b>(scope)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('install-scope', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Injects the paper scope into any other given scope. Can be used for
examle to inject the currently active PaperScope into the window's global
scope, to emulate PaperScript-style globally accessible Paper classes and
objects:</p>
<ul><b>Parameters:</b>
<li>
<tt>scope:</tt>
</li>
</ul>
<p>
<b>Example</b>
</p>
<pre class="code">paper.install(window);</pre>
</div>
</div>
</div>
<div id="setup-canvas-member" class="member">
<div id="setup-canvas-link" class="member-link">
<a name="setup-canvas" href="#" onClick="return toggleMember('setup-canvas', false);"><tt><b>setup</b>(canvas)</tt></a>
</div>
<div id="setup-canvas-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('setup-canvas', false);"><tt><b>setup</b>(canvas)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('setup-canvas', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Sets up an empty project for us. If a canvas is provided, it also creates
a <a href="../classes/View.html"><tt>View</tt></a> for it, both linked to this scope.</p>
<ul><b>Parameters:</b>
<li>
<tt>canvas:</tt>
<tt>HTMLCanvasElement</tt>
&mdash;&nbsp;The canvas this scope should be
associated with.
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="reference-members"><h2>Static Methods</h2>
<div id="get-id-member" class="member">
<div id="get-id-link" class="member-link">
<a name="get-id" href="#" onClick="return toggleMember('get-id', false);"><tt><b>PaperScope.get</b>(id)</tt></a>
</div>
<div id="get-id-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('get-id', false);"><tt><b>PaperScope.get</b>(id)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('get-id', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Retrieves a PaperScope object with the given id or associated with
the passed canvas element.</p>
<ul><b>Parameters:</b>
<li>
<tt>id:</tt>
</li>
</ul>
</div>
</div>
</div>
<div id="each-iter-member" class="member">
<div id="each-iter-link" class="member-link">
<a name="each-iter" href="#" onClick="return toggleMember('each-iter', false);"><tt><b>PaperScope.each</b>(iter)</tt></a>
</div>
<div id="each-iter-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('each-iter', false);"><tt><b>PaperScope.each</b>(iter)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('each-iter', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Iterates over all active scopes and calls the passed iterator
function for each of them.</p>
<ul><b>Parameters:</b>
<li>
<tt>iter:</tt>
&mdash;&nbsp;the iterator function.
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- =========================== copyright notice ========================= -->
<p class="footer">Copyright &#169; 2011 <a href="http://www.lehni.org" target="_blank">J&uuml;rg Lehni</a> &amp; <a href="http://www.jonathanpuckey.com" target="_blank">Jonathan Puckey</a>. All Rights Reserved.</p>
<div class="content-end"></div>
</body>

137
dist/docs/classes/PaperScript.html vendored Normal file
View file

@ -0,0 +1,137 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PaperScript</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
<link rel="stylesheet" href="../resources/css/style.css" type="text/css">
<link rel="stylesheet" href="../resources/css/paperscript.css" type="text/css">
<link rel="stylesheet" href="../resources/css/codemirror.css" type="text/css">
<script src="../resources/js/bootstrap.js" type="text/javascript"></script>
<script src="../resources/js/paper.js" type="text/javascript"></script>
<script src="../resources/js/codemirror.js" type="text/javascript"></script>
<script src="../resources/js/reference.js" type="text/javascript"></script>
</head>
<body class="reference">
<div class="reference-class">
<h1>PaperScript</h1>
</div>
<div class="reference-members"><h2>Static Methods</h2>
<div id="compile-code-member" class="member">
<div id="compile-code-link" class="member-link">
<a name="compile-code" href="#" onClick="return toggleMember('compile-code', false);"><tt><b>PaperScript.compile</b>(code)</tt></a>
</div>
<div id="compile-code-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('compile-code', false);"><tt><b>PaperScript.compile</b>(code)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('compile-code', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Compiles PaperScript code into JavaScript code.</p>
<ul><b>Parameters:</b>
<li>
<tt>code:</tt>
<tt>String</tt>
&mdash;&nbsp;The PaperScript code.
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><tt>String</tt></tt>&nbsp;&mdash;&nbsp;The compiled PaperScript as JavaScript code.
</li>
</ul>
</div>
</div>
</div>
<div id="evaluate-code-scope-member" class="member">
<div id="evaluate-code-scope-link" class="member-link">
<a name="evaluate-code-scope" href="#" onClick="return toggleMember('evaluate-code-scope', false);"><tt><b>PaperScript.evaluate</b>(code, scope)</tt></a>
</div>
<div id="evaluate-code-scope-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('evaluate-code-scope', false);"><tt><b>PaperScript.evaluate</b>(code, scope)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('evaluate-code-scope', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Evaluates parsed PaperScript code in the passed <a href="../classes/PaperScope.html"><tt>PaperScope</tt></a>
object. It also installs handlers automatically for us.</p>
<ul><b>Parameters:</b>
<li>
<tt>code:</tt>
<tt>String</tt>
&mdash;&nbsp;The PaperScript code.
</li>
<li>
<tt>scope:</tt>
<a href="../classes/PaperScript.html"><tt>PaperScript</tt></a>
&mdash;&nbsp;The scope in which the code is executed.
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><tt>Object</tt></tt>&nbsp;&mdash;&nbsp;The result of the code evaluation.
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- =========================== copyright notice ========================= -->
<p class="footer">Copyright &#169; 2011 <a href="http://www.lehni.org" target="_blank">J&uuml;rg Lehni</a> &amp; <a href="http://www.jonathanpuckey.com" target="_blank">Jonathan Puckey</a>. All Rights Reserved.</p>
<div class="content-end"></div>
</body>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ParagraphStyle</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Path</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -2350,6 +2351,96 @@ for (var i = 0; i < amount + 1; i++) {
</div>
</div>
</div>
</div>
<div id="getnearestlocation-point-member" class="member">
<div id="getnearestlocation-point-link" class="member-link">
<a name="getnearestlocation-point" href="#" onClick="return toggleMember('getnearestlocation-point', false);"><tt><b>getNearestLocation</b>(point)</tt></a>
</div>
<div id="getnearestlocation-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('getnearestlocation-point', false);"><tt><b>getNearestLocation</b>(point)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('getnearestlocation-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Returns the nearest location on the path to the specified point.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
&mdash;&nbsp;{Point} The point for which we search the nearest location
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/CurveLocation.html"><tt>CurveLocation</tt></a></tt>&nbsp;&mdash;&nbsp;The location on the path that's the closest to
the specified point
</li>
</ul>
</div>
</div>
</div>
<div id="getnearestpoint-point-member" class="member">
<div id="getnearestpoint-point-link" class="member-link">
<a name="getnearestpoint-point" href="#" onClick="return toggleMember('getnearestpoint-point', false);"><tt><b>getNearestPoint</b>(point)</tt></a>
</div>
<div id="getnearestpoint-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('getnearestpoint-point', false);"><tt><b>getNearestPoint</b>(point)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('getnearestpoint-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Returns the nearest point on the path to the specified point.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
&mdash;&nbsp;{Point} The point for which we search the nearest point
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;The point on the path that's the closest to the specified
point
</li>
</ul>
</div>
</div>
</div>
@ -4780,6 +4871,83 @@ raster.scale(5);
</div>
</div>
</div>
</div>
<div id="hittest-point-member" class="member">
<div id="hittest-point-link" class="member-link">
<a name="hittest-point" href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
<div id="hittest-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('hittest-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Perform a hit test on the item (and its children, if it is a
<a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point.</p>
<p>The optional options object allows you to control the specifics of the
hit test and may contain a combination of the following values:</p>
<p><b>tolerance:</b> <tt>Number</tt> - The tolerance of the hit test in
points.</p>
<p><b>options.type:</b> Only hit test again a certain item
type: <a href="../classes/PathItem.html"><tt>PathItem</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/TextItem.html"><tt>TextItem</tt></a>, etc.</p>
<p><b>options.fill:</b> <tt>Boolean</tt> - Hit test the fill of items.</p>
<p><b>options.stroke:</b> <tt>Boolean</tt> - Hit test the curves of path items,
taking into account stroke width.</p>
<p><b>options.segment:</b> <tt>Boolean</tt> - Hit test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of
<a href="../classes/Path.html"><tt>Path</tt></a> items.</p>
<p><b>options.handles:</b> <tt>Boolean</tt> - Hit test for the handles
(<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</p>
<p><b>options.ends:</b> <tt>Boolean</tt> - Only hit test for the first or last
segment points of open path items.</p>
<p><b>options.bounds:</b> <tt>Boolean</tt> - Hit test the corners and side-centers
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.center:</b> <tt>Boolean</tt> - Hit test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a>
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.guide:</b> <tt>Boolean</tt> - Hit test items that have
<a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <tt>true</tt>.</p>
<p><b>options.selected:</b> <tt>Boolean</tt> - Only hit selected items.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point where the hit test should be performed
</li>
<li>
<tt>options:</tt>
<tt>Object</tt>
&mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true,
tolerance: 2 }</tt>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;A hit result object that contains more
information about what exactly was hit or <tt>null</tt> if nothing was
hit.
</li>
</ul>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PathItem</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -2451,6 +2452,83 @@ raster.scale(5);
</div>
</div>
</div>
</div>
<div id="hittest-point-member" class="member">
<div id="hittest-point-link" class="member-link">
<a name="hittest-point" href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
<div id="hittest-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('hittest-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Perform a hit test on the item (and its children, if it is a
<a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point.</p>
<p>The optional options object allows you to control the specifics of the
hit test and may contain a combination of the following values:</p>
<p><b>tolerance:</b> <tt>Number</tt> - The tolerance of the hit test in
points.</p>
<p><b>options.type:</b> Only hit test again a certain item
type: <a href="../classes/PathItem.html"><tt>PathItem</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/TextItem.html"><tt>TextItem</tt></a>, etc.</p>
<p><b>options.fill:</b> <tt>Boolean</tt> - Hit test the fill of items.</p>
<p><b>options.stroke:</b> <tt>Boolean</tt> - Hit test the curves of path items,
taking into account stroke width.</p>
<p><b>options.segment:</b> <tt>Boolean</tt> - Hit test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of
<a href="../classes/Path.html"><tt>Path</tt></a> items.</p>
<p><b>options.handles:</b> <tt>Boolean</tt> - Hit test for the handles
(<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</p>
<p><b>options.ends:</b> <tt>Boolean</tt> - Only hit test for the first or last
segment points of open path items.</p>
<p><b>options.bounds:</b> <tt>Boolean</tt> - Hit test the corners and side-centers
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.center:</b> <tt>Boolean</tt> - Hit test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a>
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.guide:</b> <tt>Boolean</tt> - Hit test items that have
<a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <tt>true</tt>.</p>
<p><b>options.selected:</b> <tt>Boolean</tt> - Only hit selected items.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point where the hit test should be performed
</li>
<li>
<tt>options:</tt>
<tt>Object</tt>
&mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true,
tolerance: 2 }</tt>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;A hit result object that contains more
information about what exactly was hit or <tt>null</tt> if nothing was
hit.
</li>
</ul>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PathStyle</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PlacedItem</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -1665,6 +1666,83 @@ raster.scale(5);
</div>
</div>
</div>
</div>
<div id="hittest-point-member" class="member">
<div id="hittest-point-link" class="member-link">
<a name="hittest-point" href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
<div id="hittest-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('hittest-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Perform a hit test on the item (and its children, if it is a
<a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point.</p>
<p>The optional options object allows you to control the specifics of the
hit test and may contain a combination of the following values:</p>
<p><b>tolerance:</b> <tt>Number</tt> - The tolerance of the hit test in
points.</p>
<p><b>options.type:</b> Only hit test again a certain item
type: <a href="../classes/PathItem.html"><tt>PathItem</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/TextItem.html"><tt>TextItem</tt></a>, etc.</p>
<p><b>options.fill:</b> <tt>Boolean</tt> - Hit test the fill of items.</p>
<p><b>options.stroke:</b> <tt>Boolean</tt> - Hit test the curves of path items,
taking into account stroke width.</p>
<p><b>options.segment:</b> <tt>Boolean</tt> - Hit test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of
<a href="../classes/Path.html"><tt>Path</tt></a> items.</p>
<p><b>options.handles:</b> <tt>Boolean</tt> - Hit test for the handles
(<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</p>
<p><b>options.ends:</b> <tt>Boolean</tt> - Only hit test for the first or last
segment points of open path items.</p>
<p><b>options.bounds:</b> <tt>Boolean</tt> - Hit test the corners and side-centers
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.center:</b> <tt>Boolean</tt> - Hit test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a>
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.guide:</b> <tt>Boolean</tt> - Hit test items that have
<a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <tt>true</tt>.</p>
<p><b>options.selected:</b> <tt>Boolean</tt> - Only hit selected items.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point where the hit test should be performed
</li>
<li>
<tt>options:</tt>
<tt>Object</tt>
&mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true,
tolerance: 2 }</tt>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;A hit result object that contains more
information about what exactly was hit or <tt>null</tt> if nothing was
hit.
</li>
</ul>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PlacedSymbol</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -1751,6 +1752,83 @@ raster.scale(5);
</div>
</div>
</div>
</div>
<div id="hittest-point-member" class="member">
<div id="hittest-point-link" class="member-link">
<a name="hittest-point" href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
<div id="hittest-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('hittest-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Perform a hit test on the item (and its children, if it is a
<a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point.</p>
<p>The optional options object allows you to control the specifics of the
hit test and may contain a combination of the following values:</p>
<p><b>tolerance:</b> <tt>Number</tt> - The tolerance of the hit test in
points.</p>
<p><b>options.type:</b> Only hit test again a certain item
type: <a href="../classes/PathItem.html"><tt>PathItem</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/TextItem.html"><tt>TextItem</tt></a>, etc.</p>
<p><b>options.fill:</b> <tt>Boolean</tt> - Hit test the fill of items.</p>
<p><b>options.stroke:</b> <tt>Boolean</tt> - Hit test the curves of path items,
taking into account stroke width.</p>
<p><b>options.segment:</b> <tt>Boolean</tt> - Hit test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of
<a href="../classes/Path.html"><tt>Path</tt></a> items.</p>
<p><b>options.handles:</b> <tt>Boolean</tt> - Hit test for the handles
(<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</p>
<p><b>options.ends:</b> <tt>Boolean</tt> - Only hit test for the first or last
segment points of open path items.</p>
<p><b>options.bounds:</b> <tt>Boolean</tt> - Hit test the corners and side-centers
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.center:</b> <tt>Boolean</tt> - Hit test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a>
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.guide:</b> <tt>Boolean</tt> - Hit test items that have
<a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <tt>true</tt>.</p>
<p><b>options.selected:</b> <tt>Boolean</tt> - Only hit selected items.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point where the hit test should be performed
</li>
<li>
<tt>options:</tt>
<tt>Object</tt>
&mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true,
tolerance: 2 }</tt>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;A hit result object that contains more
information about what exactly was hit or <tt>null</tt> if nothing was
hit.
</li>
</ul>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Point</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -1146,7 +1147,7 @@ is not modified!</p>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the transformed point
<tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;The transformed point
</li>
</ul>
@ -1160,18 +1161,18 @@ is not modified!</p>
<h3>Distance & Length</h3>
<div id="getdistance-point-member" class="member">
<div id="getdistance-point-link" class="member-link">
<a name="getdistance-point" href="#" onClick="return toggleMember('getdistance-point', false);"><tt><b>getDistance</b>(point)</tt></a>
<div id="getdistance-point-squared-member" class="member">
<div id="getdistance-point-squared-link" class="member-link">
<a name="getdistance-point-squared" href="#" onClick="return toggleMember('getdistance-point-squared', false);"><tt><b>getDistance</b>(point, squared)</tt></a>
</div>
<div id="getdistance-point-description" class="member-description hidden">
<div id="getdistance-point-squared-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('getdistance-point', false);"><tt><b>getDistance</b>(point)</tt></a>
<a href="#" onClick="return toggleMember('getdistance-point-squared', false);"><tt><b>getDistance</b>(point, squared)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('getdistance-point', false);"></div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('getdistance-point-squared', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
@ -1184,6 +1185,14 @@ is not modified!</p>
<a href="../classes/Point.html"><tt>Point</tt></a>
</li>
<li>
<tt>squared:</tt>
<tt>Boolean</tt>
&mdash;&nbsp;Controls whether the distance should remain
squared, or its square root should be calculated.
</li>
</ul>
@ -1229,7 +1238,7 @@ changing its angle and returns it as a new point. The optional
<li>
<tt>length:</tt>
<tt>Number</tt>
&mdash;&nbsp;the length of the normalized vector
&mdash;&nbsp;The length of the normalized vector
&mdash;&nbsp;optional, default: <tt>1</tt>
</li>
@ -1239,7 +1248,7 @@ changing its angle and returns it as a new point. The optional
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the normalized vector of the vector that is represented
<tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;The normalized vector of the vector that is represented
by this point's coordinates.
</li>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PointText</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -1714,6 +1715,83 @@ raster.scale(5);
</div>
</div>
</div>
</div>
<div id="hittest-point-member" class="member">
<div id="hittest-point-link" class="member-link">
<a name="hittest-point" href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
<div id="hittest-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('hittest-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Perform a hit test on the item (and its children, if it is a
<a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point.</p>
<p>The optional options object allows you to control the specifics of the
hit test and may contain a combination of the following values:</p>
<p><b>tolerance:</b> <tt>Number</tt> - The tolerance of the hit test in
points.</p>
<p><b>options.type:</b> Only hit test again a certain item
type: <a href="../classes/PathItem.html"><tt>PathItem</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/TextItem.html"><tt>TextItem</tt></a>, etc.</p>
<p><b>options.fill:</b> <tt>Boolean</tt> - Hit test the fill of items.</p>
<p><b>options.stroke:</b> <tt>Boolean</tt> - Hit test the curves of path items,
taking into account stroke width.</p>
<p><b>options.segment:</b> <tt>Boolean</tt> - Hit test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of
<a href="../classes/Path.html"><tt>Path</tt></a> items.</p>
<p><b>options.handles:</b> <tt>Boolean</tt> - Hit test for the handles
(<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</p>
<p><b>options.ends:</b> <tt>Boolean</tt> - Only hit test for the first or last
segment points of open path items.</p>
<p><b>options.bounds:</b> <tt>Boolean</tt> - Hit test the corners and side-centers
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.center:</b> <tt>Boolean</tt> - Hit test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a>
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.guide:</b> <tt>Boolean</tt> - Hit test items that have
<a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <tt>true</tt>.</p>
<p><b>options.selected:</b> <tt>Boolean</tt> - Only hit selected items.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point where the hit test should be performed
</li>
<li>
<tt>options:</tt>
<tt>Object</tt>
&mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true,
tolerance: 2 }</tt>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;A hit result object that contains more
information about what exactly was hit or <tt>null</tt> if nothing was
hit.
</li>
</ul>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Project</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -16,7 +17,7 @@
<div class="reference-class">
<h1>Project</h1>
<p>A Project object in Paper.js is what usually is refered to as the
<p>A Project object in Paper.js is what usually is referred to as the
document: The top level object that holds all the items contained in the
scene graph. As the term document is already taken in the browser context,
it is called Project.</p>
@ -25,10 +26,10 @@ created items, give access to the selected items, and will in future versions
offer ways to query for items in the scene graph defining specific
requirements, and means to persist and load from different formats, such as
SVG and PDF.</p>
<p>The currently active project can be accessed through the global
{@see _global_#project} variable.</p>
<p>An array of all open projects is accessible through the global
{@see _global_#projects} variable.</p>
<p>The currently active project can be accessed through the
<a href="../classes/PaperScope.html#project"><tt>paperScope.project</tt></a> variable.</p>
<p>An array of all open projects is accessible through the
<a href="../classes/PaperScope.html#projects"><tt>paperScope.projects</tt></a> variable.</p>
</div>
@ -53,7 +54,7 @@ SVG and PDF.</p>
<div class="member-text">
<p>Creates a Paper.js project.</p>
<p>When working with PaperScript, a project is automatically created for us
and the global {@see _global_#project} variable points to it.</p>
and the <a href="../classes/PaperScope.html#project"><tt>paperScope.project</tt></a> variable points to it.</p>
@ -158,7 +159,7 @@ var path2 = new Path.Circle(new Point(175, 50), 20);
</div>
<div class="member-text">
<p>The index of the project in the global projects array.</p>
<p>The index of the project in the <a href="../classes/PaperScope.html#projects"><tt>paperScope.projects</tt></a> list.</p>
<ul><b>Type:</b>
@ -417,7 +418,7 @@ in it.</p>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Removes this project from the global {@see _global_#projects} list.</p>
<p>Removes this project from the <a href="../classes/PaperScope.html#projects"><tt>paperScope.projects</tt></a> list.</p>
@ -472,6 +473,84 @@ in it.</p>
</div>
</div>
</div>
<div id="hittest-point-member" class="member">
<div id="hittest-point-link" class="member-link">
<a name="hittest-point" href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
<div id="hittest-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('hittest-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Perform a hit test on the items contained within the project at the
location of the specified point.</p>
<p>The optional options object allows you to control the specifics of the
hit test and may contain a combination of the following values:</p>
<p><b>options.tolerance:</b> <tt>Number</tt> - The tolerance of the hit test
in points.</p>
<p><b>options.type:</b> Only hit test again a certain item
type: <a href="../classes/PathItem.html"><tt>PathItem</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/TextItem.html"><tt>TextItem</tt></a>, etc.</p>
<p><b>options.fill:</b> <tt>Boolean</tt> - Hit test the fill of items.</p>
<p><b>options.stroke:</b> <tt>Boolean</tt> - Hit test the curves of path
items, taking into account stroke width.</p>
<p><b>options.segment:</b> <tt>Boolean</tt> - Hit test for
<a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of <a href="../classes/Path.html"><tt>Path</tt></a> items.</p>
<p><b>options.handles:</b> <tt>Boolean</tt> - Hit test for the handles
(<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</p>
<p><b>options.ends:</b> <tt>Boolean</tt> - Only hit test for the first or
last segment points of open path items.</p>
<p><b>options.bounds:</b> <tt>Boolean</tt> - Hit test the corners and
side-centers of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.center:</b> <tt>Boolean</tt> - Hit test the
<a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a> of the bounding rectangle of items
(<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.guide:</b> <tt>Boolean</tt> - Hit test items that have
<a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <tt>true</tt>.</p>
<p><b>options.selected:</b> <tt>Boolean</tt> - Only hit selected items.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point where the hit test should be performed
</li>
<li>
<tt>options:</tt>
<tt>Object</tt>
&mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true,
tolerance: true }</tt>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;A hit result object that contains more
information about what exactly was hit or <tt>null</tt> if nothing was
hit.
</li>
</ul>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>RGBColor</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Raster</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -2335,6 +2336,83 @@ raster.scale(5);
</div>
</div>
</div>
</div>
<div id="hittest-point-member" class="member">
<div id="hittest-point-link" class="member-link">
<a name="hittest-point" href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
<div id="hittest-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('hittest-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Perform a hit test on the item (and its children, if it is a
<a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point.</p>
<p>The optional options object allows you to control the specifics of the
hit test and may contain a combination of the following values:</p>
<p><b>tolerance:</b> <tt>Number</tt> - The tolerance of the hit test in
points.</p>
<p><b>options.type:</b> Only hit test again a certain item
type: <a href="../classes/PathItem.html"><tt>PathItem</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/TextItem.html"><tt>TextItem</tt></a>, etc.</p>
<p><b>options.fill:</b> <tt>Boolean</tt> - Hit test the fill of items.</p>
<p><b>options.stroke:</b> <tt>Boolean</tt> - Hit test the curves of path items,
taking into account stroke width.</p>
<p><b>options.segment:</b> <tt>Boolean</tt> - Hit test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of
<a href="../classes/Path.html"><tt>Path</tt></a> items.</p>
<p><b>options.handles:</b> <tt>Boolean</tt> - Hit test for the handles
(<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</p>
<p><b>options.ends:</b> <tt>Boolean</tt> - Only hit test for the first or last
segment points of open path items.</p>
<p><b>options.bounds:</b> <tt>Boolean</tt> - Hit test the corners and side-centers
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.center:</b> <tt>Boolean</tt> - Hit test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a>
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.guide:</b> <tt>Boolean</tt> - Hit test items that have
<a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <tt>true</tt>.</p>
<p><b>options.selected:</b> <tt>Boolean</tt> - Only hit selected items.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point where the hit test should be performed
</li>
<li>
<tt>options:</tt>
<tt>Object</tt>
&mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true,
tolerance: 2 }</tt>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;A hit result object that contains more
information about what exactly was hit or <tt>null</tt> if nothing was
hit.
</li>
</ul>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Rectangle</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Segment</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Size</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Symbol</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>TextItem</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -1772,6 +1773,83 @@ raster.scale(5);
</div>
</div>
</div>
</div>
<div id="hittest-point-member" class="member">
<div id="hittest-point-link" class="member-link">
<a name="hittest-point" href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
<div id="hittest-point-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('hittest-point', false);"><tt><b>hitTest</b>(point[, options])</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('hittest-point', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Perform a hit test on the item (and its children, if it is a
<a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point.</p>
<p>The optional options object allows you to control the specifics of the
hit test and may contain a combination of the following values:</p>
<p><b>tolerance:</b> <tt>Number</tt> - The tolerance of the hit test in
points.</p>
<p><b>options.type:</b> Only hit test again a certain item
type: <a href="../classes/PathItem.html"><tt>PathItem</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/TextItem.html"><tt>TextItem</tt></a>, etc.</p>
<p><b>options.fill:</b> <tt>Boolean</tt> - Hit test the fill of items.</p>
<p><b>options.stroke:</b> <tt>Boolean</tt> - Hit test the curves of path items,
taking into account stroke width.</p>
<p><b>options.segment:</b> <tt>Boolean</tt> - Hit test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of
<a href="../classes/Path.html"><tt>Path</tt></a> items.</p>
<p><b>options.handles:</b> <tt>Boolean</tt> - Hit test for the handles
(<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</p>
<p><b>options.ends:</b> <tt>Boolean</tt> - Only hit test for the first or last
segment points of open path items.</p>
<p><b>options.bounds:</b> <tt>Boolean</tt> - Hit test the corners and side-centers
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.center:</b> <tt>Boolean</tt> - Hit test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a>
of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>).</p>
<p><b>options.guide:</b> <tt>Boolean</tt> - Hit test items that have
<a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <tt>true</tt>.</p>
<p><b>options.selected:</b> <tt>Boolean</tt> - Only hit selected items.</p>
<ul><b>Parameters:</b>
<li>
<tt>point:</tt>
<a href="../classes/Point.html"><tt>Point</tt></a>
&mdash;&nbsp;The point where the hit test should be performed
</li>
<li>
<tt>options:</tt>
<tt>Object</tt>
&mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true,
tolerance: 2 }</tt>
</li>
</ul>
<ul><b>Returns:</b>
<li>
<tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;A hit result object that contains more
information about what exactly was hit or <tt>null</tt> if nothing was
hit.
</li>
</ul>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Tool</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -49,54 +50,6 @@ function onMouseDrag(event) {
</div>
<!-- ============================== constructors ========================= -->
<div class="reference-members"><h2>Constructors</h2>
<div id="tool-handlers-scope-member" class="member">
<div id="tool-handlers-scope-link" class="member-link">
<a name="tool-handlers-scope" href="#" onClick="return toggleMember('tool-handlers-scope', false);"><tt><b>Tool</b>(handlers, scope)</tt></a>
</div>
<div id="tool-handlers-scope-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('tool-handlers-scope', false);"><tt><b>Tool</b>(handlers, scope)</tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('tool-handlers-scope', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>Initializes the tool's settings, so a new tool can be assigned to it</p>
<ul><b>Parameters:</b>
<li>
<tt>handlers:</tt>
</li>
<li>
<tt>scope:</tt>
</li>
</ul>
</div>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ToolEvent</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -273,6 +274,41 @@ difference to the mousedown position is returned.</p>
</ul>
</div>
</div>
</div>
<div id="item-member" class="member">
<div id="item-link" class="member-link">
<a name="item" href="#" onClick="return toggleMember('item', false);"><tt><b>item</b></tt></a>
</div>
<div id="item-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('item', false);"><tt><b>item</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('item', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The item at the position of the mouse (if any).</p>
<p>If the item is contained within one or more <a href="../classes/Group.html"><tt>Group</tt></a> or
<a href="../classes/CompoundPath.html"><tt>CompoundPath</tt></a> items, the most top level group or compound path
that it is contained within is returned.</p>
<ul><b>Type:</b>
<li>
<a href="../classes/Item.html"><tt>Item</tt></a>
</li>
</ul>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>View</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>_global_</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -27,28 +28,28 @@
<div class="reference-members"><h2>Properties</h2>
<div id="version-member" class="member">
<div id="version-link" class="member-link">
<a name="version" href="#" onClick="return toggleMember('version', false);"><tt><b>version</b></tt></a>
<div id="paper-member" class="member">
<div id="paper-link" class="member-link">
<a name="paper" href="#" onClick="return toggleMember('paper', false);"><tt><b>paper</b></tt></a>
</div>
<div id="version-description" class="member-description hidden">
<div id="paper-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('version', false);"><tt><b>version</b></tt></a>
<a href="#" onClick="return toggleMember('paper', false);"><tt><b>paper</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('version', false);"></div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('paper', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The version of Paper.js, as a float number.</p>
<p>A reference to the currently active <a href="../classes/PaperScope.html"><tt>PaperScope</tt></a> object.</p>
<ul><b>Type:</b>
<li>
<tt>Number</tt>
<a href="../classes/PaperScope.html"><tt>PaperScope</tt></a>
</li>
</ul>
@ -59,6 +60,8 @@
</div>
<h3>Global PaperScope Properties (for PaperScript)</h3>
<div id="project-member" class="member">
<div id="project-link" class="member-link">
<a name="project" href="#" onClick="return toggleMember('project', false);"><tt><b>project</b></tt></a>
@ -171,12 +174,12 @@
</div>
<div class="member-text">
<p>The active view of the active project.</p>
<p>The list of view of the active project.</p>
<ul><b>Type:</b>
<li>
<a href="../classes/View.html"><tt>View</tt></a>
Array of <a href="../classes/View.html"><tt>View</tt></a> objects
</li>
</ul>
@ -203,7 +206,7 @@
</div>
<div class="member-text">
<p>The reference to the tool object.</p>
<p>The reference to the active tool.</p>
<ul><b>Type:</b>
@ -219,7 +222,39 @@
</div>
<h3>View Event Handlers</h3>
<div id="tools-member" class="member">
<div id="tools-link" class="member-link">
<a name="tools" href="#" onClick="return toggleMember('tools', false);"><tt><b>tools</b></tt></a>
</div>
<div id="tools-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('tools', false);"><tt><b>tools</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('tools', false);"></div>
<div class="clear"></div>
</div>
<div class="member-text">
<p>The list of available tools.</p>
<ul><b>Type:</b>
<li>
Array of <a href="../classes/Tool.html"><tt>Tool</tt></a> objects
</li>
</ul>
</div>
</div>
</div>
<h3>View Event Handlers (for PaperScript)</h3>
<div id="onframe-member" class="member">
<div id="onframe-link" class="member-link">
@ -285,7 +320,7 @@
</div>
<h3>Mouse Event Handlers</h3>
<h3>Mouse Event Handlers (for PaperScript)</h3>
<div id="onmousedown-member" class="member">
<div id="onmousedown-link" class="member-link">
@ -415,7 +450,7 @@
</div>
<h3>Keyboard Event Handlers</h3>
<h3>Keyboard Event Handlers (for PaperScript)</h3>
<div id="onkeydown-member" class="member">
<div id="onkeydown-link" class="member-link">
@ -477,25 +512,6 @@
</div>
</div>
</div>
<div id="style-member" class="member">
<div id="style-link" class="member-link">
<a name="style" href="#" onClick="return toggleMember('style', false);"><tt><b>Style</b></tt></a>
</div>
<div id="style-description" class="member-description hidden">
<div class="member-header">
<div class="member-title">
<div class="member-link">
<a href="#" onClick="return toggleMember('style', false);"><tt><b>Style</b></tt></a>
</div>
</div>
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('style', false);"></div>
<div class="clear"></div>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Paper.js</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
@ -29,6 +30,8 @@
<li><a href="../classes/PlacedItem.html">PlacedItem</a></li>
<li><a href="../classes/Raster.html">Raster</a></li>
<li><a href="../classes/PlacedSymbol.html">PlacedSymbol</a></li>
<li><hr /></li>
<li><a href="../classes/HitResult.html">HitResult</a></li>
</ul>
<li>
<h2>Paths</h2>
@ -55,6 +58,7 @@
<li><a href="../classes/RGBColor.html">RGBColor</a></li>
<li><a href="../classes/GrayColor.html">GrayColor</a></li>
<li><a href="../classes/HSBColor.html">HSBColor</a></li>
<li><a href="../classes/HSLColor.html">HSLColor</a></li>
</ul>
<li>
<h2>Gradients</h2>
@ -81,6 +85,12 @@
<li><a href="../classes/CharacterStyle.html">CharacterStyle</a></li>
<li><a href="../classes/ParagraphStyle.html">ParagraphStyle</a></li>
</ul>
<li>
<h2>JavaScript</h2>
<ul>
<li><a href="../classes/PaperScope.html">PaperScope</a></li>
<li><a href="../classes/PaperScript.html">PaperScript</a></li>
</ul>
</ul>
</body>
</html>

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>
Paper.js API
</title>

File diff suppressed because one or more lines are too long

View file

@ -119,10 +119,15 @@ PaperScript = HtmlElement.extend({
var scope = paper.PaperScope.get(script.$);
if (scope) {
// Update script to edited version
script.setText(editor.getValue());
var code = editor.getValue();
script.setText(code);
// Keep a reference to the used canvas, since we're going to
// fully clear the scope and initialize again with this canvas.
var canvas = scope.view.canvas;
// Clear scope first, then evaluate a new script.
scope.clear();
scope.evaluate(script.$);
scope.initialize(canvas);
scope.evaluate(code);
}
}

578
dist/paper.js vendored

File diff suppressed because one or more lines are too long

20
lib/parse-js-min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -362,6 +362,7 @@ function tokenizer($TEXT) {
case "0" : return "\0";
case "x" : return String.fromCharCode(hex_bytes(2));
case "u" : return String.fromCharCode(hex_bytes(4));
case "\n": return "";
default : return ch;
}
};
@ -382,7 +383,24 @@ function tokenizer($TEXT) {
var quote = next(), ret = "";
for (;;) {
var ch = next(true);
if (ch == "\\") ch = read_escaped_char();
if (ch == "\\") {
// read OctalEscapeSequence (XXX: deprecated if "strict mode")
// https://github.com/mishoo/UglifyJS/issues/178
var octal_len = 0, first = null;
ch = read_while(function(ch){
if (ch >= "0" && ch <= "7") {
if (!first) {
first = ch;
return ++octal_len;
}
else if (first <= "3" && octal_len <= 2) return ++octal_len;
else if (first >= "4" && octal_len <= 1) return ++octal_len;
}
return false;
});
if (octal_len > 0) ch = String.fromCharCode(parseInt(ch, 8));
else ch = read_escaped_char();
}
else if (ch == quote) break;
ret += ch;
}
@ -1200,6 +1218,47 @@ function parse($TEXT, exigent_mode, embed_tokens) {
};
/* -----[ Utilities ]----- */
function curry(f) {
var args = slice(arguments, 1);
return function() { return f.apply(this, args.concat(slice(arguments))); };
};
function prog1(ret) {
if (ret instanceof Function)
ret = ret();
for (var i = 1, n = arguments.length; --n > 0; ++i)
arguments[i]();
return ret;
};
function array_to_hash(a) {
var ret = {};
for (var i = 0; i < a.length; ++i)
ret[a[i]] = true;
return ret;
};
function slice(a, start) {
return Array.prototype.slice.call(a, start || 0);
};
function characters(str) {
return str.split("");
};
function member(name, array) {
for (var i = array.length; --i >= 0;)
if (array[i] === name)
return true;
return false;
};
function HOP(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/* -----[ helper for AST traversal ]----- */
function ast_walker() {
@ -1441,7 +1500,8 @@ function gen_code(ast, options) {
quote_keys : false,
space_colon : false,
beautify : false,
ascii_only : false
ascii_only : false,
inline_script: false
});
var beautify = !!options.beautify;
var indentation = 0,
@ -1449,7 +1509,10 @@ function gen_code(ast, options) {
space = beautify ? " " : "";
function encode_string(str) {
return make_string(str, options.ascii_only);
var ret = make_string(str, options.ascii_only);
if (options.inline_script)
ret = ret.replace(/<\x2fscript([>/\t\n\f\r ])/gi, "<\\/script$1");
return ret;
};
function make_name(name) {
@ -1705,6 +1768,10 @@ function gen_code(ast, options) {
!(rvalue[1] == operator && member(operator, [ "&&", "||", "*" ]))) {
right = "(" + right + ")";
}
else if (!beautify && options.inline_script && (operator == "<" || operator == "<<")
&& rvalue[0] == "regexp" && /^script/i.test(rvalue[1])) {
right = " " + right;
}
return add_spaces([ left, operator, right ]);
},
"unary-prefix": function(operator, expr) {
@ -1735,7 +1802,7 @@ function gen_code(ast, options) {
// body in p[1][3] and type ("get" / "set") in p[2].
return indent(make_function(p[0], p[1][2], p[1][3], p[2]));
}
var key = p[0], val = make(p[1]);
var key = p[0], val = parenthesize(p[1], "seq");
if (options.quote_keys) {
key = encode_string(key);
} else if ((typeof key == "number" || !beautify && +key + "" == key)
@ -1888,41 +1955,6 @@ function gen_code(ast, options) {
/* -----[ Utilities ]----- */
function curry(f) {
var args = slice(arguments, 1);
return function() { return f.apply(this, args.concat(slice(arguments))); };
};
function prog1(ret) {
if (ret instanceof Function)
ret = ret();
for (var i = 1, n = arguments.length; --n > 0; ++i)
arguments[i]();
return ret;
};
function array_to_hash(a) {
var ret = {};
for (var i = 0; i < a.length; ++i)
ret[a[i]] = true;
return ret;
};
function slice(a, start) {
return Array.prototype.slice.call(a, start || 0);
};
function characters(str) {
return str.split("");
};
function member(name, array) {
for (var i = array.length; --i >= 0;)
if (array[i] === name)
return true;
return false;
};
function repeat_string(str, i) {
return i < 1 ? "" : new Array(i + 1).join(str);
};
@ -1945,10 +1977,6 @@ function is_identifier(name) {
&& !HOP(KEYWORDS, name);
};
function HOP(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
function MAP(a, f, o) {
var ret = [];
for (var i = 0; i < a.length; ++i) {

View file

@ -342,6 +342,7 @@ function tokenizer($TEXT) {
case "0" : return "\0";
case "x" : return String.fromCharCode(hex_bytes(2));
case "u" : return String.fromCharCode(hex_bytes(4));
case "\n": return "";
default : return ch;
}
};
@ -1163,6 +1164,47 @@ function parse($TEXT, exigent_mode, embed_tokens) {
};
/* -----[ Utilities ]----- */
function curry(f) {
var args = slice(arguments, 1);
return function() { return f.apply(this, args.concat(slice(arguments))); };
};
function prog1(ret) {
if (ret instanceof Function)
ret = ret();
for (var i = 1, n = arguments.length; --n > 0; ++i)
arguments[i]();
return ret;
};
function array_to_hash(a) {
var ret = {};
for (var i = 0; i < a.length; ++i)
ret[a[i]] = true;
return ret;
};
function slice(a, start) {
return Array.prototype.slice.call(a, start || 0);
};
function characters(str) {
return str.split("");
};
function member(name, array) {
for (var i = array.length; --i >= 0;)
if (array[i] === name)
return true;
return false;
};
function HOP(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/* -----[ helper for AST traversal ]----- */
function ast_walker() {
@ -1832,41 +1874,6 @@ function gen_code(ast, options) {
/* -----[ Utilities ]----- */
function curry(f) {
var args = slice(arguments, 1);
return function() { return f.apply(this, args.concat(slice(arguments))); };
};
function prog1(ret) {
if (ret instanceof Function)
ret = ret();
for (var i = 1, n = arguments.length; --n > 0; ++i)
arguments[i]();
return ret;
};
function array_to_hash(a) {
var ret = {};
for (var i = 0; i < a.length; ++i)
ret[a[i]] = true;
return ret;
};
function slice(a, start) {
return Array.prototype.slice.call(a, start || 0);
};
function characters(str) {
return str.split("");
};
function member(name, array) {
for (var i = array.length; --i >= 0;)
if (array[i] === name)
return true;
return false;
};
function repeat_string(str, i) {
return i < 1 ? "" : new Array(i + 1).join(str);
};
@ -1889,10 +1896,6 @@ function is_identifier(name) {
&& !HOP(KEYWORDS, name);
};
function HOP(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
function MAP(a, f, o) {
var ret = [];
for (var i = 0; i < a.length; ++i) {

View file

@ -32,9 +32,9 @@
* by considering them to be a column vector and multiplying the coordinate
* vector by the matrix according to the following process:
* <pre>
* [ x ] [ m00 m01 m02 ] [ x ] [ m00 * x + m01 * y + m02 ]
* [ y ] = [ m10 m11 m12 ] [ y ] = [ m10 * x + m11 * y + m12 ]
* [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
* [ x ] [ a b tx ] [ x ] [ a * x + b * y + tx ]
* [ y ] = [ c d ty ] [ y ] = [ c * x + d * y + ty ]
* [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
* </pre>
*
* This class is optimized for speed and minimizes calculations based on its
@ -45,12 +45,12 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
/**
* Creates a 2D affine transform.
*
* @param {Number} m00 The m00 coordinate of the transform.
* @param {Number} m10 The m10 coordinate of the transform.
* @param {Number} m01 The m01 coordinate of the transform.
* @param {Number} m11 The m11 coordinate of the transform.
* @param {Number} m02 The m02 coordinate of the transform.
* @param {Number} m12 The m12 coordinate of the transform.
* @param {Number} a The scaleX coordinate of the transform
* @param {Number} c The shearY coordinate of the transform
* @param {Number} b The shearX coordinate of the transform
* @param {Number} d The scaleY coordinate of the transform
* @param {Number} tx The translateX coordinate of the transform
* @param {Number} ty The translateY coordinate of the transform
*/
initialize: function(arg) {
var count = arguments.length,
@ -59,16 +59,15 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
this.set.apply(this, arguments);
} else if (count == 1) {
if (arg instanceof Matrix) {
this.set(arg._m00, arg._m10, arg._m01,
arg._m11, arg._m02, arg._m12);
this.set(arg._a, arg._c, arg._b, arg._d, arg._tx, arg._ty);
} else if (Array.isArray(arg)) {
this.set.apply(this, arg);
} else {
ok = false;
}
} else if (count == 0) {
this._m00 = this._m11 = 1;
this._m10 = this._m01 = this._m02 = this._m12 = 0;
this._a = this._d = 1;
this._c = this._b = this._tx = this._ty = 0;
} else {
ok = false;
}
@ -80,28 +79,28 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
* @return {Matrix} A copy of this transform.
*/
clone: function() {
return Matrix.create(this._m00, this._m10, this._m01,
this._m11, this._m02, this._m12);
return Matrix.create(this._a, this._c, this._b, this._d,
this._tx, this._ty);
},
/**
* Sets this transform to the matrix specified by the 6 values.
*
* @param {Number} m00 The m00 coordinate of the transform.
* @param {Number} m10 The m10 coordinate of the transform.
* @param {Number} m01 The m01 coordinate of the transform.
* @param {Number} m11 The m11 coordinate of the transform.
* @param {Number} m02 The m02 coordinate of the transform.
* @param {Number} m12 The m12 coordinate of the transform.
* @return {Matrix} This affine transform.
* @param {Number} a The scaleX coordinate of the transform
* @param {Number} c The shearY coordinate of the transform
* @param {Number} b The shearX coordinate of the transform
* @param {Number} d The scaleY coordinate of the transform
* @param {Number} tx The translateX coordinate of the transform
* @param {Number} ty The translateY coordinate of the transform
* @return {Matrix} This affine transform
*/
set: function(m00, m10, m01, m11, m02, m12) {
this._m00 = m00;
this._m10 = m10;
this._m01 = m01;
this._m11 = m11;
this._m02 = m02;
this._m12 = m12;
set: function(a, c, b, d, tx, ty) {
this._a = a;
this._c = c;
this._b = b;
this._d = d;
this._tx = tx;
this._ty = ty;
return this;
},
@ -110,21 +109,19 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
*
* @name Matrix#scale
* @function
* @param {Number} scale The scaling factor.
* @param {Point} [center] The center for the scaling
* transformation.
* @return {Matrix} This affine transform.
* @param {Number} scale The scaling factor
* @param {Point} [center] The center for the scaling transformation
* @return {Matrix} This affine transform
*/
/**
* Concatentates this transform with a scaling transformation.
*
* @name Matrix#scale
* @function
* @param {Number} hor The horizontal scaling factor.
* @param {Number} ver The vertical scaling factor.
* @param {Point} [center] The center for the scaling
* transformation.
* @return {Matrix} This affine transform.
* @param {Number} hor The horizontal scaling factor
* @param {Number} ver The vertical scaling factor
* @param {Point} [center] The center for the scaling transformation
* @return {Matrix} This affine transform
*/
scale: function(hor, ver /* | scale */, center) {
if (arguments.length < 2 || typeof ver === 'object') {
@ -138,10 +135,10 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
}
if (center)
this.translate(center);
this._m00 *= hor;
this._m10 *= hor;
this._m01 *= ver;
this._m11 *= ver;
this._a *= hor;
this._c *= hor;
this._b *= ver;
this._d *= ver;
if (center)
this.translate(center.negate());
return this;
@ -152,23 +149,23 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
*
* @name Matrix#translate
* @function
* @param {Point} point The vector to translate by.
* @return {Matrix} This affine transform.
* @param {Point} point The vector to translate by
* @return {Matrix} This affine transform
*/
/**
* Concatentates this transform with a translate transformation.
*
* @name Matrix#translate
* @function
* @param {Number} dx The distance to translate in the x direction.
* @param {Number} dy The distance to translate in the y direction.
* @return {Matrix} This affine transform.
* @param {Number} dx The distance to translate in the x direction
* @param {Number} dy The distance to translate in the y direction
* @return {Matrix} This affine transform
*/
translate: function(point) {
point = Point.read(arguments);
var x = point.x, y = point.y;
this._m02 += x * this._m00 + y * this._m01;
this._m12 += x * this._m10 + y * this._m11;
this._tx += x * this._a + y * this._b;
this._ty += x * this._c + y * this._d;
return this;
},
@ -178,9 +175,9 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
*
* @name Matrix#rotate
* @function
* @param {Number} angle The angle of rotation measured in degrees.
* @param {Point} center The anchor point to rotate around.
* @return {Matrix} This affine transform.
* @param {Number} angle The angle of rotation measured in degrees
* @param {Point} center The anchor point to rotate around
* @return {Matrix} This affine transform
*/
/**
* Concatentates this transform with a rotation transformation around an
@ -188,10 +185,10 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
*
* @name Matrix#rotate
* @function
* @param {Number} angle The angle of rotation measured in degrees.
* @param {Number} x The x coordinate of the anchor point.
* @param {Number} y The y coordinate of the anchor point.
* @return {Matrix} This affine transform.
* @param {Number} angle The angle of rotation measured in degrees
* @param {Number} x The x coordinate of the anchor point
* @param {Number} y The y coordinate of the anchor point
* @return {Matrix} This affine transform
*/
rotate: function(angle, center) {
return this.concatenate(
@ -203,19 +200,19 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
*
* @name Matrix#shear
* @function
* @param {Point} point The shear factor in x and y direction.
* @param {Point} [center] The center for the shear transformation.
* @return {Matrix} This affine transform.
* @param {Point} point The shear factor in x and y direction
* @param {Point} [center] The center for the shear transformation
* @return {Matrix} This affine transform
*/
/**
* Concatentates this transform with a shear transformation.
*
* @name Matrix#shear
* @function
* @param {Number} hor The horizontal shear factor.
* @param {Number} ver The vertical shear factor.
* @param {Point} [center] The center for the shear transformation.
* @return {Matrix} This affine transform.
* @param {Number} hor The horizontal shear factor
* @param {Number} ver The vertical shear factor
* @param {Point} [center] The center for the shear transformation
* @return {Matrix} This affine transform
*/
shear: function(hor, ver, center) {
// See #scale() for explanation of this:
@ -227,12 +224,12 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
}
if (center)
this.translate(center);
var m00 = this._m00;
var m10 = this._m10;
this._m00 += ver * this._m01;
this._m10 += ver * this._m11;
this._m01 += hor * m00;
this._m11 += hor * m10;
var a = this._a,
c = this._c;
this._a += ver * this._b;
this._c += ver * this._d;
this._b += hor * a;
this._d += hor * c;
if (center)
this.translate(center.negate());
return this;
@ -243,96 +240,104 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
*/
toString: function() {
var format = Base.formatNumber;
return '[[' + [format(this._m00), format(this._m01),
format(this._m02)].join(', ') + '], ['
+ [format(this._m10), format(this._m11),
format(this._m12)].join(', ') + ']]';
return '[[' + [format(this._a), format(this._b),
format(this._tx)].join(', ') + '], ['
+ [format(this._c), format(this._d),
format(this._ty)].join(', ') + ']]';
},
/**
* The scaling factor in the x-direction (m00).
* The scaling factor in the x-direction ({@code a}).
*
* @name Matrix#scaleX
* @type Number
*/
/**
* The scaling factor in the y-direction (m11).
* The scaling factor in the y-direction ({@code d}).
*
* @name Matrix#scaleY
* @type Number
*/
/**
* The translation in the x-direction (m02).
*
* @name Matrix#translateX
* @type Number
*/
/**
* The translation in the y-direction (m12).
*
* @name Matrix#translateY
* @type Number
*/
/**
* @return {Number} The shear factor in the x-direction (m01).
* @return {Number} The shear factor in the x-direction ({@code b}).
*
* @name Matrix#shearX
* @type Number
*/
/**
* @return {Number} The shear factor in the y-direction (m10).
* @return {Number} The shear factor in the y-direction ({@code c}).
*
* @name Matrix#shearY
* @type Number
*/
/**
* The translation in the x-direction ({@code tx}).
*
* @name Matrix#translateX
* @type Number
*/
/**
* The translation in the y-direction ({@code ty}).
*
* @name Matrix#translateY
* @type Number
*/
/**
* The transform values as an array, in the same sequence as they are passed
* to {@link #initialize(a, c, b, d, tx, ty)}.
*
* @type Number[]
* @bean
*/
getValues: function() {
return [ this._a, this._c, this._b, this._d, this._tx, this._ty ];
},
/**
* Concatenates an affine transform to this transform.
*
* @param {Matrix} mx The transform to concatenate.
* @return {Matrix} This affine transform.
* @param {Matrix} mx The transform to concatenate
* @return {Matrix} This affine transform
*/
concatenate: function(mx) {
var m0 = this._m00,
m1 = this._m01;
this._m00 = mx._m00 * m0 + mx._m10 * m1;
this._m01 = mx._m01 * m0 + mx._m11 * m1;
this._m02 += mx._m02 * m0 + mx._m12 * m1;
m0 = this._m10;
m1 = this._m11;
this._m10 = mx._m00 * m0 + mx._m10 * m1;
this._m11 = mx._m01 * m0 + mx._m11 * m1;
this._m12 += mx._m02 * m0 + mx._m12 * m1;
var a = this._a,
b = this._b,
c = this._c,
d = this._d;
this._a = mx._a * a + mx._c * b;
this._b = mx._b * a + mx._d * b;
this._tx += mx._tx * a + mx._ty * b;
this._c = mx._a * c + mx._c * d;
this._d = mx._b * c + mx._d * d;
this._ty += mx._tx * c + mx._ty * d;
return this;
},
/**
* Pre-concatenates an affine transform to this transform.
*
* @param {Matrix} mx The transform to preconcatenate.
* @return {Matrix} This affine transform.
* @param {Matrix} mx The transform to preconcatenate
* @return {Matrix} This affine transform
*/
preConcatenate: function(mx) {
var m0 = this._m00,
m1 = this._m10;
this._m00 = mx._m00 * m0 + mx._m01 * m1;
this._m10 = mx._m10 * m0 + mx._m11 * m1;
m0 = this._m01;
m1 = this._m11;
this._m01 = mx._m00 * m0 + mx._m01 * m1;
this._m11 = mx._m10 * m0 + mx._m11 * m1;
m0 = this._m02;
m1 = this._m12;
this._m02 = mx._m00 * m0 + mx._m01 * m1 + mx._m02;
this._m12 = mx._m10 * m0 + mx._m11 * m1 + mx._m12;
var a = this._a,
b = this._b,
c = this._c,
d = this._d,
tx = this._tx,
ty = this._ty;
this._a = mx._a * a + mx._b * c;
this._c = mx._c * a + mx._d * c;
this._b = mx._a * b + mx._b * d;
this._d = mx._c * b + mx._d * d;
this._tx = mx._a * tx + mx._b * ty + mx._tx;
this._ty = mx._c * tx + mx._d * ty + mx._ty;
return this;
},
@ -341,16 +346,15 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
* the result. If an array is transformed, the the result is stored into a
* destination array.
*
* @param {Point} point The point to be transformed.
*
* @param {Point} point The point to be transformed
* @param {Number[]} src The array containing the source points
* as x, y value pairs.
* @param {Number} srcOff The offset to the first point to be transformed.
* as x, y value pairs
* @param {Number} srcOff The offset to the first point to be transformed
* @param {Number[]} dst The array into which to store the transformed
* point pairs.
* point pairs
* @param {Number} dstOff The offset of the location of the first
* transformed point in the destination array.
* @param {Number} numPts The number of points to tranform.
* transformed point in the destination array
* @param {Number} numPts The number of points to tranform
*/
transform: function(/* point | */ src, srcOff, dst, dstOff, numPts) {
return arguments.length < 5
@ -369,8 +373,8 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
if (!dest)
dest = new Point(Point.dont);
return dest.set(
x * this._m00 + y * this._m01 + this._m02,
x * this._m10 + y * this._m11 + this._m12,
x * this._a + y * this._b + this._tx,
x * this._c + y * this._d + this._ty,
dontNotify
);
},
@ -381,8 +385,8 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
while (i < srcEnd) {
var x = src[i++];
var y = src[i++];
dst[j++] = x * this._m00 + y * this._m01 + this._m02;
dst[j++] = x * this._m10 + y * this._m11 + this._m12;
dst[j++] = x * this._a + y * this._b + this._tx;
dst[j++] = x * this._c + y * this._d + this._ty;
}
return dst;
},
@ -418,60 +422,61 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
},
/**
* @return {Number} The determinant of this transform.
* @return {Number} The determinant of this transform
*/
getDeterminant: function() {
return this._m00 * this._m11 - this._m01 * this._m10;
return this._a * this._d - this._b * this._c;
},
getTranslation: function() {
return new Point(this._m02, this._m12);
return new Point(this._tx, this._ty);
},
getScaling: function() {
var hor = Math.sqrt(this._m00 * this._m00 + this._m10 * this._m10),
ver = Math.sqrt(this._m01 * this._m01 + this._m11 * this._m11);
return new Point(this._m00 < 0 ? -hor : hor, this._m01 < 0 ? -ver : ver);
var hor = Math.sqrt(this._a * this._a + this._c * this._c),
ver = Math.sqrt(this._b * this._b + this._d * this._d);
return new Point(this._a < 0 ? -hor : hor, this._b < 0 ? -ver : ver);
},
/**
* @return {Number} The rotation angle of the matrix. If a non-uniform
* Returns the rotation angle of the matrix. If a non-uniform
* rotation is applied as a result of a shear() or scale() command,
* undefined is returned, as the resulting transformation cannot be
* expressed in one rotation angle.
* expressed in one rotation angle
* @return {Number} The rotation angle of the matrix
*/
getRotation: function() {
var angle1 = -Math.atan2(this._m01, this._m11),
angle2 = Math.atan2(this._m10, this._m00);
var angle1 = -Math.atan2(this._b, this._d),
angle2 = Math.atan2(this._c, this._a);
return Math.abs(angle1 - angle2) < Numerical.TOLERANCE
? angle1 * 180 / Math.PI : undefined;
},
/**
* @return {Boolean} Whether this transform is the identity transform.
* @return {Boolean} Whether this transform is the identity transform
*/
isIdentity: function() {
return this._m00 == 1 && this._m10 == 0 && this._m01 == 0 &&
this._m11 == 1 && this._m02 == 0 && this._m12 == 0;
return this._a == 1 && this._c == 0 && this._b == 0 && this._d == 1
&& this._tx == 0 && this._ty == 0;
},
/**
* Returns whether the transform is invertible. A transform is not
* invertible if the determinant is 0 or any value is non-finite or NaN.
*
* @return {Boolean} Whether the transform is invertible.
* @return {Boolean} Whether the transform is invertible
*/
isInvertible: function() {
var det = this.getDeterminant();
return isFinite(det) && det != 0 && isFinite(this._m02)
&& isFinite(this._m12);
return isFinite(det) && det != 0 && isFinite(this._tx)
&& isFinite(this._ty);
},
/**
* Checks whether the matrix is singular or not. Singular matrices cannot be
* inverted.
*
* @return {Boolean} Whether the matrix is singular.
* @return {Boolean} Whether the matrix is singular
*/
isSingular: function() {
return !this.isInvertible();
@ -483,33 +488,33 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
* returned.
*
* @return {Matrix} The inverted matrix, or {@code null }, if the matrix is
* singular.
* singular
*/
createInverse: function() {
var det = this.getDeterminant();
if (isFinite(det) && det != 0 && isFinite(this._m02)
&& isFinite(this._m12)) {
if (isFinite(det) && det != 0 && isFinite(this._tx)
&& isFinite(this._ty)) {
return Matrix.create(
this._m11 / det,
-this._m10 / det,
-this._m01 / det,
this._m00 / det,
(this._m01 * this._m12 - this._m11 * this._m02) / det,
(this._m10 * this._m02 - this._m00 * this._m12) / det);
this._d / det,
-this._c / det,
-this._b / det,
this._a / det,
(this._b * this._ty - this._d * this._tx) / det,
(this._c * this._tx - this._a * this._ty) / det);
}
return null;
},
createShiftless: function() {
return Matrix.create(this._m00, this._m10, this._m01, this._m11, 0, 0);
return Matrix.create(this._a, this._c, this._b, this._d, 0, 0);
},
/**
* Sets this transform to a scaling transformation.
*
* @param {Number} hor The horizontal scaling factor.
* @param {Number} ver The vertical scaling factor.
* @return {Matrix} This affine transform.
* @param {Number} hor The horizontal scaling factor
* @param {Number} ver The vertical scaling factor
* @return {Matrix} This affine transform
*/
setToScale: function(hor, ver) {
return this.set(hor, 0, 0, ver, 0, 0);
@ -518,9 +523,9 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
/**
* Sets this transform to a translation transformation.
*
* @param {Number} dx The distance to translate in the x direction.
* @param {Number} dy The distance to translate in the y direction.
* @return {Matrix} This affine transform.
* @param {Number} dx The distance to translate in the x direction
* @param {Number} dy The distance to translate in the y direction
* @return {Matrix} This affine transform
*/
setToTranslation: function(delta) {
delta = Point.read(arguments);
@ -530,9 +535,9 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
/**
* Sets this transform to a shearing transformation.
*
* @param {Number} hor The horizontal shear factor.
* @param {Number} ver The vertical shear factor.
* @return {Matrix} This affine transform.
* @param {Number} hor The horizontal shear factor
* @param {Number} ver The vertical shear factor
* @return {Matrix} This affine transform
*/
setToShear: function(hor, ver) {
return this.set(1, ver, hor, 1, 0, 0);
@ -541,10 +546,10 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
/**
* Sets this transform to a rotation transformation.
*
* @param {Number} angle The angle of rotation measured in degrees.
* @param {Number} x The x coordinate of the anchor point.
* @param {Number} y The y coordinate of the anchor point.
* @return {Matrix} This affine transform.
* @param {Number} angle The angle of rotation measured in degrees
* @param {Number} x The x coordinate of the anchor point
* @param {Number} y The y coordinate of the anchor point
* @return {Matrix} This affine transform
*/
setToRotation: function(angle, center) {
center = Point.read(arguments, 1);
@ -566,25 +571,23 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
*/
applyToContext: function(ctx, reset) {
ctx[reset ? 'setTransform' : 'transform'](
this._m00, this._m10, this._m01,
this._m11, this._m02, this._m12
);
this._a, this._c, this._b, this._d, this._tx, this._ty);
return this;
},
statics: /** @lends Matrix */{
// See Point.create()
create: function(m00, m10, m01, m11, m02, m12) {
return new Matrix(Matrix.dont).set(m00, m10, m01, m11, m02, m12);
create: function(a, c, b, d, tx, ty) {
return new Matrix(Matrix.dont).set(a, c, b, d, tx, ty);
},
/**
* Creates a transform representing a scaling transformation.
*
* @param {Number} hor The horizontal scaling factor.
* @param {Number} ver The vertical scaling factor.
* @param {Number} hor The horizontal scaling factor
* @param {Number} ver The vertical scaling factor
* @return {Matrix} A transform representing a scaling
* transformation.
* transformation
*/
getScaleInstance: function(hor, ver) {
var mx = new Matrix();
@ -594,10 +597,10 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
/**
* Creates a transform representing a translation transformation.
*
* @param {Number} dx The distance to translate in the x direction.
* @param {Number} dy The distance to translate in the y direction.
* @param {Number} dx The distance to translate in the x direction
* @param {Number} dy The distance to translate in the y direction
* @return {Matrix} A transform representing a translation
* transformation.
* transformation
*/
getTranslateInstance: function(delta) {
var mx = new Matrix();
@ -607,9 +610,9 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
/**
* Creates a transform representing a shearing transformation.
*
* @param {Number} hor The horizontal shear factor.
* @param {Number} ver The vertical shear factor.
* @return {Matrix} A transform representing a shearing transformation.
* @param {Number} hor The horizontal shear factor
* @param {Number} ver The vertical shear factor
* @return {Matrix} A transform representing a shearing transformation
*/
getShearInstance: function(hor, ver, center) {
var mx = new Matrix();
@ -619,10 +622,10 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
/**
* Creates a transform representing a rotation transformation.
*
* @param {Number} angle The angle of rotation measured in degrees.
* @param {Number} x The x coordinate of the anchor point.
* @param {Number} y The y coordinate of the anchor point.
* @return {Matrix} A transform representing a rotation transformation.
* @param {Number} angle The angle of rotation measured in degrees
* @param {Number} x The x coordinate of the anchor point
* @param {Number} y The y coordinate of the anchor point
* @return {Matrix} A transform representing a rotation transformation
*/
getRotateInstance: function(angle, center) {
var mx = new Matrix();
@ -631,12 +634,12 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
}
}, new function() {
return Base.each({
scaleX: '_m00',
scaleY: '_m11',
translateX: '_m02',
translateY: '_m12',
shearX: '_m01',
shearY: '_m10'
scaleX: '_a',
scaleY: '_d',
translateX: '_tx',
translateY: '_ty',
shearX: '_b',
shearY: '_c'
}, function(prop, name) {
name = Base.capitalize(name);
this['get' + name] = function() {

View file

@ -390,7 +390,7 @@ var Point = this.Point = Base.extend(/** @lends Point# */{
* is not modified!
*
* @param {Matrix} matrix
* @return {Point} the transformed point
* @return {Point} The transformed point
*/
transform: function(matrix) {
return matrix ? matrix._transformPoint(this) : this;
@ -402,13 +402,16 @@ var Point = this.Point = Base.extend(/** @lends Point# */{
* Returns the distance between the point and another point.
*
* @param {Point} point
* @param {Boolean} squared Controls whether the distance should remain
* squared, or its square root should be calculated.
* @return {Number}
*/
getDistance: function(point) {
getDistance: function(point, squared) {
point = Point.read(arguments);
var x = point.x - this.x,
y = point.y - this.y;
return Math.sqrt(x * x + y * y);
y = point.y - this.y,
d = x * x + y * y;
return squared ? d : Math.sqrt(d);
},
/**
@ -421,7 +424,11 @@ var Point = this.Point = Base.extend(/** @lends Point# */{
* @bean
*/
getLength: function() {
return Math.sqrt(this.x * this.x + this.y * this.y);
// Supports a hidden parameter 'squared', which controls whether the
// squared length should be returned. Hide it so it produces a bean
// property called #length.
var l = this.x * this.x + this.y * this.y;
return arguments[0] ? l : Math.sqrt(l);
},
setLength: function(length) {
@ -453,8 +460,8 @@ var Point = this.Point = Base.extend(/** @lends Point# */{
* {@code length} parameter defines the length to normalize to.
* The object itself is not modified!
*
* @param {Number} [length=1] the length of the normalized vector
* @return {Point} the normalized vector of the vector that is represented
* @param {Number} [length=1] The length of the normalized vector
* @return {Point} The normalized vector of the vector that is represented
* by this point's coordinates.
*/
normalize: function(length) {

View file

@ -14,96 +14,72 @@
* All rights reserved.
*/
var DomElement = new function() {
function cumulateOffset(el, name, parent, test) {
var left = name + 'Left',
top = name + 'Top',
x = 0,
y = 0,
style;
// If we're asked to calculate positioned offset, stop at any parent
// element that has relative or absolute position.
while (el && el.style && (!test || !test.test(
style = DomElement.getComputedStyle(el, 'position')))) {
x += el[left] || 0;
y += el[top] || 0;
el = el[parent];
/**
* @name DomElement
* @namespace
* @private
*/
var DomElement = {
getBounds: function(el, viewport) {
var rect = el.getBoundingClientRect(),
doc = el.ownerDocument,
body = doc.body,
docEl = doc.documentElement,
x = rect.left - (docEl.clientLeft || body.clientLeft || 0),
y = rect.top - (docEl.clientTop || body.clientTop || 0);
if (!viewport) {
var win = DomElement.getViewport(doc);
x += win.pageXOffset || docEl.scrollLeft || body.scrollLeft;
y += win.pageYOffset || docEl.scrollTop || body.scrollTop;
}
return {
offset: Point.create(x, y),
element: el,
style: style
};
return new Rectangle(x, y, rect.width, rect.height);
},
getOffset: function(el, viewport) {
return this.getBounds(el, viewport).getPoint();
},
getSize: function(el) {
return this.getBounds(el, true).getSize();
},
/**
* Checks if element is invisibile (display: none, ...)
*/
isInvisible: function(el) {
return this.getSize(el).equals([0, 0]);
},
/**
* Checks if element is visibile in current viewport
*/
isVisible: function(el) {
// See if the viewport bounds intersect with the windows rectangle
// which always starts at 0, 0
return !this.isInvisible(el) && this.getViewportBounds(el).intersects(
this.getBounds(el, true));
},
getViewport: function(doc) {
return doc.defaultView || doc.parentWindow;
},
getViewportBounds: function(el) {
var doc = el.ownerDocument,
view = this.getViewport(doc),
body = doc.getElementsByTagName(
doc.compatMode === 'CSS1Compat' ? 'html' : 'body')[0];
return Rectangle.create(0, 0,
view.innerWidth || body.clientWidth,
view.innerHeight || body.clientHeight
);
},
getComputedStyle: function(el, name) {
if (el.currentStyle)
return el.currentStyle[Base.camelize(name)];
var style = this.getViewport(el.ownerDocument)
.getComputedStyle(el, null);
return style ? style.getPropertyValue(Base.hyphenate(name)) : null;
}
function getScrollOffset(el, test) {
return cumulateOffset(el, 'scroll', 'parentNode', test).offset;
}
return {
getOffset: function(el, positioned, viewport) {
var res = cumulateOffset(el, 'offset', 'offsetParent',
positioned ? /^(relative|absolute|fixed)$/ : /^fixed$/);
// We need to handle fixed positioned elements seperately if we're
// asked to calculate offsets within the page (= not within
// viewport), by adding their scroll offset to the result.
if (res.style == 'fixed' && !viewport)
return res.offset.add(getScrollOffset(res.element));
// Otherwise remove scrolling from the calculated offset if we asked
// for viewport coordinates
return viewport
? res.offset.subtract(getScrollOffset(el, /^fixed$/))
: res.offset;
},
getSize: function(el) {
return Size.create(el.offsetWidth, el.offsetHeight);
},
getBounds: function(el, positioned, viewport) {
return new Rectangle(this.getOffset(el, positioned, viewport),
this.getSize(el));
},
/**
* Checks if element is invisibile (display: none, ...)
*/
isInvisible: function(el) {
return this.getSize(el).equals([0, 0]);
},
/**
* Checks if element is visibile in current viewport
*/
isVisible: function(el) {
// See if the viewport bounds intersect with the windows rectangle
// which always starts at 0, 0
return !this.isInvisible(el)
&& new Rectangle([0, 0], this.getViewportSize(el))
.intersects(this.getBounds(el, false, true));
},
getViewport: function(doc) {
return doc.defaultView || doc.parentWindow;
},
getViewportSize: function(el) {
var doc = el.ownerDocument,
view = this.getViewport(doc),
body = doc.getElementsByTagName(
doc.compatMode === 'CSS1Compat' ? 'html' : 'body')[0];
return Size.create(
view.innerWidth || body.clientWidth,
view.innerHeight || body.clientHeight
);
},
getComputedStyle: function(el, name) {
if (el.currentStyle)
return el.currentStyle[Base.camelize(name)];
var style = this.getViewport(el.ownerDocument)
.getComputedStyle(el, null);
return style ? style.getPropertyValue(Base.hyphenate(name)) : null;
}
};
};

View file

@ -14,6 +14,11 @@
* All rights reserved.
*/
/**
* @name DomEvent
* @namespace
* @private
*/
var DomEvent = {
add: function(el, events) {
for (var type in events) {
@ -60,8 +65,8 @@ var DomEvent = {
getOffset: function(event, target) {
// Remove target offsets from page coordinates
return DomEvent.getPoint(event).subtract(
DomElement.getOffset(target || DomEvent.getTarget(event), true));
return DomEvent.getPoint(event).subtract(DomElement.getOffset(
target || DomEvent.getTarget(event)));
},
preventDefault: function(event) {

View file

@ -746,8 +746,8 @@ var HSLColor = this.HSLColor = Color.extend(/** @lends HSLColor# */{
* var circle = new Path.Circle(new Point(80, 50), 30);
*
* // Create an HSLColor with a hue of 90 degrees, a saturation
* // 100% and a lightness of 100%:
* circle.fillColor = new HSLColor(90, 1, 1);
* // 100% and a lightness of 50%:
* circle.fillColor = new HSLColor(90, 1, 0.5);
*/
_colorType: 'hsl'

View file

@ -39,31 +39,25 @@
var PaperScope = this.PaperScope = Base.extend(/** @lends PaperScope# */{
/**
* Creates a PaperScope object and an empty {@link Project} for it. If a
* canvas is provided, it also creates a {@link View} for it.
* Both project and view are linked to this scope.
* Creates a PaperScope object.
*
* @name PaperScope#initialize
* @function
* @param {HTMLCanvasElement} canvas The canvas this scope should be
* associated with.
*/
initialize: function(canvas, script) {
initialize: function(script) {
// script is only used internally, when creating scopes for PaperScript.
// Whenever a PaperScope is created, it automatically becomes the active
// one.
paper = this;
this.views = [];
this.view = null;
this.views = [];
this.project = null;
this.projects = [];
// Since the global paper variable points to this PaperScope, the
// created project and view are automatically associated with it.
this.project = new Project();
this.tool = null;
this.tools = [];
var obj = script || canvas;
this._id = obj && obj.getAttribute('id')
|| script && script.src
// Assign an id to this canvas that's either extracted from the script
// or automatically generated.
this._id = script && (script.getAttribute('id') || script.src)
|| ('paperscope-' + (PaperScope._id++));
// Make sure the script tag also has this id now. If it already had an
// id, we're not changing it, since it's the first option we're
@ -71,10 +65,6 @@ var PaperScope = this.PaperScope = Base.extend(/** @lends PaperScope# */{
if (script)
script.setAttribute('id', this._id);
PaperScope._scopes[this._id] = this;
if (canvas) {
// Create a view for the canvas.
this.view = new View(canvas);
}
},
/**
@ -136,11 +126,43 @@ var PaperScope = this.PaperScope = Base.extend(/** @lends PaperScope# */{
* paper.install(window);
*/
install: function(scope) {
// Use scope as side-car (= 'this' inside iterator), and have it
// returned at the end.
return Base.each(this, function(value, key) {
this[key] = value;
}, scope);
// Define project, view and tool as getters that redirect to these
// values on the PaperScope, so they are kept up to date
var that = this;
Base.each(['project', 'view', 'tool'], function(key) {
Base.define(scope, key, {
configurable: true,
writable: true,
get: function() {
return that[key];
}
});
});
// Copy over all fields from this scope to the destination.
// Do not use Base.each, since we also want to enumerate over
// fields on PaperScope.prototype, e.g. all classes
for (var key in this) {
if (!/^(version|_id|load)/.test(key) && !(key in scope))
scope[key] = this[key];
}
},
/**
* Sets up an empty project for us. If a canvas is provided, it also creates
* a {@link View} for it, both linked to this scope.
*
* @param {HTMLCanvasElement} canvas The canvas this scope should be
* associated with.
*/
setup: function(canvas) {
// Create an empty project for the scope.
// Make sure this is the active scope, so the created project and view
// are automatically associated with it.
paper = this;
this.project = new Project();
// Create a view for the canvas.
if (canvas)
this.view = new View(canvas);
},
clear: function() {

View file

@ -100,7 +100,7 @@ var PaperScript = this.PaperScript = new function() {
// Use parse-js to translate the code into a AST structure which is then
// walked and parsed for operators to overload. The resulting AST is
// translated back to code and evaluated.
var ast = parse_js.parse(code, true),
var ast = parse_js.parse(code),
walker = parse_js.ast_walker(),
walk = walker.walk;
@ -144,8 +144,7 @@ var PaperScript = this.PaperScript = new function() {
/**
* Evaluates parsed PaperScript code in the passed {@link PaperScope}
* object. It also handles canvas setup, tool creation and handlers
* automatically for us.
* object. It also installs handlers automatically for us.
*
* @name PaperScript.evaluate
* @function
@ -194,12 +193,9 @@ var PaperScript = this.PaperScript = new function() {
}
if (view) {
view.onResize = onResize;
if (onFrame) {
view.setOnFrame(onFrame);
} else {
// Automatically draw view at the end.
view.draw();
}
view.setOnFrame(onFrame);
// Automatically draw view at the end.
view.draw();
}
}).call(scope);
}
@ -240,7 +236,8 @@ var PaperScript = this.PaperScript = new function() {
// so a project is created for it now.
var canvas = PaperScript.getAttribute(script, 'canvas');
canvas = canvas && document.getElementById(canvas);
var scope = new PaperScope(canvas, script);
var scope = new PaperScope(script);
scope.setup(canvas);
if (script.src) {
// If we're loading from a source, request that first and then
// run later.

View file

@ -19,13 +19,19 @@
// that allow us to use their names.
// Setting Function#name is not possible, as that is read-only.
Base.each(this, function(val, key) {
if (val && val.prototype instanceof Base)
if (val && val.prototype instanceof Base) {
val._name = key;
/*#*/ if (options.version == 'dev') {
// If we're in dev mode, also export all classes through PaperScope, to
// mimick scoping behavior of the built library.
PaperScope.prototype[key] = val;
/*#*/ } // options.version == 'dev'
}
});
/*#*/ if (options.version == 'dev') {
// We're already leaking into the global scope, so let's just assign the global
// paper object with a prepare scope. See paper.js for the non-dev version of
// this code.
// See paper.js for the non-dev version of this code. We cannot handle dev there
// due to the seperate loading of all source files, which are only availabe
// after the execution of paper.js
paper = new PaperScope();
/*#*/ } // options.version == 'dev'

View file

@ -17,9 +17,9 @@
/**
* @name HitResult
*
* @class
*
* @extends CurveLocation
* @class A HitResult object contains information about the results of a hit
* test. It is returned by {@link Item#hitTest(point)} and
* {@link Project#hitTest(point)}.
*/
HitResult = Base.extend(/** @lends HitResult# */{
initialize: function(type, item, values) {
@ -34,6 +34,61 @@ HitResult = Base.extend(/** @lends HitResult# */{
}
},
/**
* Describes the type of the hit result. For example, if you hit a segment
* point, the type would be 'segment'.
*
* @property
* @name HitResult#type
* @type String('segment', 'handle-in', 'handle-out', 'stroke', 'fill',
* 'bounds', 'center')
*/
/**
* If the HitResult has a {@link HitResult#type} of 'bounds', this property
* describes which corner of the bounding rectangle was hit.
*
* @property
* @name HitResult#name
* @type String('top-left', 'top-right', 'bottom-left', 'bottom-right',
* 'left-center', 'top-center', 'right-center', 'bottom-center')
*/
/**
* The item that was hit.
*
* @property
* @name HitResult#item
* @type Item
*/
/**
* If the HitResult has a type of 'stroke', this property gives more
* information about the exact position that was hit on the path.
*
* @property
* @name HitResult#location
* @type CurveLocation
*/
/**
* If the HitResult has a type of 'stroke', 'segment', 'handle-in' or
* 'handle-out', this property refers to the Segment that was hit or that
* is closest to the hitResult.location on the curve.
*
* @property
* @name HitResult#segment
* @type Segment
*/
/**
* The hit point.
*
* @property
* @name HitResult#point
* @type Point
*/
statics: {
/**
* Merges default options into options hash for #hitTest() calls, and

View file

@ -682,6 +682,45 @@ var Item = this.Item = Base.extend(/** @lends Item# */{
return raster;
},
/**
* Perform a hit test on the item (and its children, if it is a
* {@link Group} or {@link Layer}) at the location of the specified point.
*
* The optional options object allows you to control the specifics of the
* hit test and may contain a combination of the following values:
* <b>tolerance:</b> {@code Number} - The tolerance of the hit test in
* points.
* <b>options.type:</b> Only hit test again a certain item
* type: {@link PathItem}, {@link Raster}, {@link TextItem}, etc.
* <b>options.fill:</b> {@code Boolean} - Hit test the fill of items.
* <b>options.stroke:</b> {@code Boolean} - Hit test the curves of path
* items, taking into account stroke width.
* <b>options.segment:</b> {@code Boolean} - Hit test for
* {@link Segment#point} of {@link Path} items.
* <b>options.handles:</b> {@code Boolean} - Hit test for the handles
* ({@link Segment#handleIn} / {@link Segment#handleOut}) of path segments.
* <b>options.ends:</b> {@code Boolean} - Only hit test for the first or
* last segment points of open path items.
* <b>options.bounds:</b> {@code Boolean} - Hit test the corners and
* side-centers of the bounding rectangle of items ({@link Item#bounds}).
* <b>options.center:</b> {@code Boolean} - Hit test the
* {@link Rectangle#center} of the bounding rectangle of items
* ({@link Item#bounds}).
* <b>options.guide:</b> {@code Boolean} - Hit test items that have
* {@link Item#guide} set to {@code true}.
* <b>options.selected:</b> {@code Boolean} - Only hit selected items.
*
* @name Item#hitTest
* @function
* @param {Point} point The point where the hit test should be performed
* @param {Object} [options={ fill: true, stroke: true, segments: true,
* tolerance: 2 }]
* @return {HitResult} A hit result object that contains more
* information about what exactly was hit or {@code null} if nothing was
* hit.
*/
hitTest: function(point, options, matrix) {
options = HitResult.getOptions(point, options);
point = options.point;

View file

@ -134,6 +134,9 @@ var paper = new function() {
// the first PaperScope and return it, all in one statement.
// The version for 'dev' of this happens in core/initialize.js, since it depends
// on sequentiality of include() loading.
// Mark this object as enumerable, so all the injected classes can be enumerated
// again in PaperScope#install().
this.enumerable = true;
return new (PaperScope.inject(this));
/*#*/ } // options.version != 'dev'
};

View file

@ -760,8 +760,15 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
return [0.5 * (w[0].x + w[5].x)];
// Compute intersection of chord from first control point to last
// with x-axis.
if (isFlatEnough(w))
return [xAxis.intersect(new Line(w[0], w[5], true)).x];
if (isFlatEnough(w)) {
var line = new Line(w[0], w[5], true);
// Compare the line's squared length with EPSILON. If we're
// below, #intersect() will return null because of division
// by near-zero.
return [ line.vector.getLength(true) < Numerical.EPSILON
? line.point.x
: xAxis.intersect(line).x ];
}
}
// Otherwise, solve recursively after
@ -840,19 +847,20 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
// Also look at beginning and end of curve (t = 0 / 1)
var roots = findRoots(w, 0).concat([0, 1]);
var minDist = Infinity,
minPoint,
minRoot;
minT,
minPoint;
// There are always roots, since we add [0, 1] above.
for (var i = 0; i < roots.length; i++) {
var pt = this.getPoint(roots[i]),
dist = point.getDistance(pt);
dist = point.getDistance(pt, true);
// We're comparing squared distances
if (dist < minDist) {
minDist = dist;
minRoot = roots[i];
minT = roots[i];
minPoint = pt;
}
}
return new CurveLocation(this, minRoot, minPoint, minDist);
return new CurveLocation(this, minT, minPoint, Math.sqrt(minDist));
},
getNearestPoint: function(point, matrix) {

View file

@ -1174,6 +1174,15 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
return loc && loc.getNormal();
},
/**
* Returns the nearest location on the path to the specified point.
*
* @name Path#getNearestLocation
* @function
* @param point {Point} The point for which we search the nearest location
* @return {CurveLocation} The location on the path that's the closest to
* the specified point
*/
getNearestLocation: function(point, matrix) {
var curves = this.getCurves(),
minDist = Infinity,
@ -1188,6 +1197,15 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
return minLoc;
},
/**
* Returns the nearest point on the path to the specified point.
*
* @name Path#getNearestPoint
* @function
* @param point {Point} The point for which we search the nearest point
* @return {Point} The point on the path that's the closest to the specified
* point
*/
getNearestPoint: function(point, matrix) {
return this.getNearestLocation(point, matrix).getPoint();
},

View file

@ -181,6 +181,41 @@ var Project = this.Project = Base.extend(/** @lends Project# */{
this._selectedItems[i].setSelected(false);
},
/**
* Perform a hit test on the items contained within the project at the
* location of the specified point.
*
* The optional options object allows you to control the specifics of the
* hit test and may contain a combination of the following values:
* <b>options.tolerance:</b> {@code Number} - The tolerance of the hit test
* in points.
* <b>options.type:</b> Only hit test again a certain item
* type: {@link PathItem}, {@link Raster}, {@link TextItem}, etc.
* <b>options.fill:</b> {@code Boolean} - Hit test the fill of items.
* <b>options.stroke:</b> {@code Boolean} - Hit test the curves of path
* items, taking into account stroke width.
* <b>options.segment:</b> {@code Boolean} - Hit test for
* {@link Segment#point} of {@link Path} items.
* <b>options.handles:</b> {@code Boolean} - Hit test for the handles
* ({@link Segment#handleIn} / {@link Segment#handleOut}) of path segments.
* <b>options.ends:</b> {@code Boolean} - Only hit test for the first or
* last segment points of open path items.
* <b>options.bounds:</b> {@code Boolean} - Hit test the corners and
* side-centers of the bounding rectangle of items ({@link Item#bounds}).
* <b>options.center:</b> {@code Boolean} - Hit test the
* {@link Rectangle#center} of the bounding rectangle of items
* ({@link Item#bounds}).
* <b>options.guide:</b> {@code Boolean} - Hit test items that have
* {@link Item#guide} set to {@code true}.
* <b>options.selected:</b> {@code 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,
* tolerance: true }]
* @return {HitResult} A hit result object that contains more
* information about what exactly was hit or {@code null} if nothing was
* hit.
*/
hitTest: function(point, options) {
options = HitResult.getOptions(point, options);
point = options.point;