mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Merge branch 'master' of https://github.com/paperjs/paper.js
This commit is contained in:
commit
ebc3b3789b
27 changed files with 558 additions and 309 deletions
|
@ -31,7 +31,7 @@
|
|||
# stripped Formated but without comments
|
||||
# compressed Uses UglifyJS to reduce file size
|
||||
|
||||
VERSION=0.2
|
||||
VERSION=0.21
|
||||
DATE=$(git log -1 --pretty=format:%ad)
|
||||
|
||||
COMMAND="./prepro.js -d '{ \"version\": $VERSION, \"date\": \"$DATE\" }' -d '$4' $2"
|
||||
|
|
21
dist/docs/classes/CompoundPath.html
vendored
21
dist/docs/classes/CompoundPath.html
vendored
|
@ -2584,18 +2584,19 @@ 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.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.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>
|
||||
|
|
21
dist/docs/classes/Group.html
vendored
21
dist/docs/classes/Group.html
vendored
|
@ -1789,18 +1789,19 @@ 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.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.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>
|
||||
|
|
21
dist/docs/classes/Item.html
vendored
21
dist/docs/classes/Item.html
vendored
|
@ -1654,18 +1654,19 @@ 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.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.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>
|
||||
|
|
21
dist/docs/classes/Layer.html
vendored
21
dist/docs/classes/Layer.html
vendored
|
@ -1748,18 +1748,19 @@ 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.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.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>
|
||||
|
|
21
dist/docs/classes/Path.html
vendored
21
dist/docs/classes/Path.html
vendored
|
@ -4900,18 +4900,19 @@ 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.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.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>
|
||||
|
|
21
dist/docs/classes/PathItem.html
vendored
21
dist/docs/classes/PathItem.html
vendored
|
@ -2481,18 +2481,19 @@ 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.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.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>
|
||||
|
|
21
dist/docs/classes/PlacedItem.html
vendored
21
dist/docs/classes/PlacedItem.html
vendored
|
@ -1695,18 +1695,19 @@ 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.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.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>
|
||||
|
|
21
dist/docs/classes/PlacedSymbol.html
vendored
21
dist/docs/classes/PlacedSymbol.html
vendored
|
@ -1781,18 +1781,19 @@ 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.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.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>
|
||||
|
|
21
dist/docs/classes/PointText.html
vendored
21
dist/docs/classes/PointText.html
vendored
|
@ -1744,18 +1744,19 @@ 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.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.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>
|
||||
|
|
21
dist/docs/classes/Raster.html
vendored
21
dist/docs/classes/Raster.html
vendored
|
@ -2365,18 +2365,19 @@ 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.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.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>
|
||||
|
|
21
dist/docs/classes/TextItem.html
vendored
21
dist/docs/classes/TextItem.html
vendored
|
@ -1802,18 +1802,19 @@ 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.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.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>
|
||||
|
|
56
dist/docs/classes/Tool.html
vendored
56
dist/docs/classes/Tool.html
vendored
|
@ -518,6 +518,62 @@ keys.</p>
|
|||
|
||||
|
||||
|
||||
<!-- ============================== methods ================================ -->
|
||||
<div class="reference-members"><h2>Methods</h2>
|
||||
|
||||
|
||||
<div id="activate-member" class="member">
|
||||
<div id="activate-link" class="member-link">
|
||||
<a name="activate" href="#" onClick="return toggleMember('activate', false);"><tt><b>activate</b>()</tt></a>
|
||||
</div>
|
||||
<div id="activate-description" class="member-description hidden">
|
||||
<div class="member-header">
|
||||
<div class="member-title">
|
||||
<div class="member-link">
|
||||
<a href="#" onClick="return toggleMember('activate', false);"><tt><b>activate</b>()</tt></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('activate', false);"></div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="member-text">
|
||||
<p>Activates this tool, meaning <a href="../classes/PaperScope.html#tool"><tt>paperScope.tool</tt></a> will
|
||||
point to it and it will be the one that recieves mouse events.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="remove-member" class="member">
|
||||
<div id="remove-link" class="member-link">
|
||||
<a name="remove" href="#" onClick="return toggleMember('remove', false);"><tt><b>remove</b>()</tt></a>
|
||||
</div>
|
||||
<div id="remove-description" class="member-description hidden">
|
||||
<div class="member-header">
|
||||
<div class="member-title">
|
||||
<div class="member-link">
|
||||
<a href="#" onClick="return toggleMember('remove', false);"><tt><b>remove</b>()</tt></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('remove', false);"></div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="member-text">
|
||||
<p>Removes this tool from the <a href="../classes/PaperScope.html#tools"><tt>paperScope.tools</tt></a> list.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
82
dist/docs/classes/View.html
vendored
82
dist/docs/classes/View.html
vendored
|
@ -50,8 +50,9 @@ screen.</p>
|
|||
|
||||
<li>
|
||||
<tt>canvas:</tt>
|
||||
<tt>Canvas</tt>
|
||||
|
||||
<tt>HTMLCanvasElement</tt> / <tt>String</tt>
|
||||
— The canvas object that this
|
||||
view should wrap, or the String id that represents it
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -379,6 +380,58 @@ function onResize(event) {
|
|||
<div class="reference-members"><h2>Methods</h2>
|
||||
|
||||
|
||||
<div id="activate-member" class="member">
|
||||
<div id="activate-link" class="member-link">
|
||||
<a name="activate" href="#" onClick="return toggleMember('activate', false);"><tt><b>activate</b>()</tt></a>
|
||||
</div>
|
||||
<div id="activate-description" class="member-description hidden">
|
||||
<div class="member-header">
|
||||
<div class="member-title">
|
||||
<div class="member-link">
|
||||
<a href="#" onClick="return toggleMember('activate', false);"><tt><b>activate</b>()</tt></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('activate', false);"></div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="member-text">
|
||||
<p>Makes this view the active one, meaning <a href="../classes/PaperScope.html#view"><tt>paperScope.view</tt></a> will
|
||||
point to it.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="remove-member" class="member">
|
||||
<div id="remove-link" class="member-link">
|
||||
<a name="remove" href="#" onClick="return toggleMember('remove', false);"><tt><b>remove</b>()</tt></a>
|
||||
</div>
|
||||
<div id="remove-description" class="member-description hidden">
|
||||
<div class="member-header">
|
||||
<div class="member-title">
|
||||
<div class="member-link">
|
||||
<a href="#" onClick="return toggleMember('remove', false);"><tt><b>remove</b>()</tt></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('remove', false);"></div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="member-text">
|
||||
<p>Removes thsi view from the <a href="../classes/PaperScope.html#views"><tt>paperScope.views</tt></a> list and frees the
|
||||
associated canvas.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="isvisible-member" class="member">
|
||||
<div id="isvisible-link" class="member-link">
|
||||
<a name="isvisible" href="#" onClick="return toggleMember('isvisible', false);"><tt><b>isVisible</b>()</tt></a>
|
||||
|
@ -444,6 +497,31 @@ viewport.</p>
|
|||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="draw-member" class="member">
|
||||
<div id="draw-link" class="member-link">
|
||||
<a name="draw" href="#" onClick="return toggleMember('draw', false);"><tt><b>draw</b>()</tt></a>
|
||||
</div>
|
||||
<div id="draw-description" class="member-description hidden">
|
||||
<div class="member-header">
|
||||
<div class="member-title">
|
||||
<div class="member-link">
|
||||
<a href="#" onClick="return toggleMember('draw', false);"><tt><b>draw</b>()</tt></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="member-close"><input type="button" value="Close" onClick="toggleMember('draw', false);"></div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="member-text">
|
||||
<p>Draws the view.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
122
dist/docs/resources/js/paper.js
vendored
122
dist/docs/resources/js/paper.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Paper.js v0.2
|
||||
* Paper.js v0.21
|
||||
*
|
||||
* This file is part of Paper.js, a JavaScript Vector Graphics Library,
|
||||
* based on Scriptographer.org and designed to be largely API compatible.
|
||||
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Date: Mon Aug 1 12:03:23 2011 +0100
|
||||
* Date: Tue Aug 2 10:08:08 2011 +0100
|
||||
*
|
||||
***
|
||||
*
|
||||
|
@ -303,9 +303,12 @@ this.Base = Base.inject({
|
|||
|
||||
toString: function() {
|
||||
return '{ ' + Base.each(this, function(value, key) {
|
||||
var type = typeof value;
|
||||
this.push(key + ': ' + (type === 'number' ? Base.formatNumber(value)
|
||||
: type === 'string' ? "'" + value + "'" : value));
|
||||
if (key.charAt(0) != '_') {
|
||||
var type = typeof value;
|
||||
this.push(key + ': ' + (type === 'number'
|
||||
? Base.formatNumber(value)
|
||||
: type === 'string' ? "'" + value + "'" : value));
|
||||
}
|
||||
}, []).join(', ') + ' }';
|
||||
},
|
||||
|
||||
|
@ -406,7 +409,7 @@ var PaperScope = this.PaperScope = Base.extend({
|
|||
PaperScope._scopes[this._id] = this;
|
||||
},
|
||||
|
||||
version: 0.2,
|
||||
version: 0.21,
|
||||
|
||||
evaluate: function(code) {
|
||||
var res = PaperScript.evaluate(code, this);
|
||||
|
@ -476,6 +479,33 @@ var PaperScope = this.PaperScope = Base.extend({
|
|||
}
|
||||
});
|
||||
|
||||
var PaperScopeItem = Base.extend({
|
||||
|
||||
initialize: function(activate) {
|
||||
this._scope = paper;
|
||||
this._index = this._scope[this._list].push(this) - 1;
|
||||
if (activate || !this._scope[this._reference])
|
||||
this.activate();
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
if (!this._scope)
|
||||
return false;
|
||||
this._scope[this._reference] = this;
|
||||
return true;
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
if (this._index == null)
|
||||
return false;
|
||||
Base.splice(this._scope[this._list], null, this._index, 1);
|
||||
if (this._scope[this._reference] == this)
|
||||
this._scope[this._reference] = null;
|
||||
this._scope = null;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
var Point = this.Point = Base.extend({
|
||||
initialize: function(arg0, arg1) {
|
||||
if (arg1 !== undefined) {
|
||||
|
@ -1623,14 +1653,15 @@ var Line = this.Line = Base.extend({
|
|||
}
|
||||
});
|
||||
|
||||
var Project = this.Project = Base.extend({
|
||||
var Project = this.Project = PaperScopeItem.extend({
|
||||
_list: 'projects',
|
||||
_reference: 'project',
|
||||
|
||||
initialize: function() {
|
||||
this._scope = paper;
|
||||
this._index = this._scope.projects.push(this) - 1;
|
||||
this.base(true);
|
||||
this._currentStyle = new PathStyle();
|
||||
this._selectedItems = {};
|
||||
this._selectedItemCount = 0;
|
||||
this.activate();
|
||||
this.layers = [];
|
||||
this.symbols = [];
|
||||
this.activeLayer = new Layer();
|
||||
|
@ -1649,25 +1680,6 @@ var Project = this.Project = Base.extend({
|
|||
this._currentStyle.initialize(style);
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
if (this._scope) {
|
||||
this._scope.project = this;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
if (this._scope) {
|
||||
Base.splice(this._scope.projects, null, this._index, 1);
|
||||
if (this._scope.project == this)
|
||||
this._scope.project = null;
|
||||
this._scope = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
getIndex: function() {
|
||||
return this._index;
|
||||
},
|
||||
|
@ -6470,12 +6482,16 @@ DomEvent.requestAnimationFrame = new function() {
|
|||
};
|
||||
};
|
||||
|
||||
var View = this.View = Base.extend({
|
||||
var View = this.View = PaperScopeItem.extend({
|
||||
_list: 'views',
|
||||
_reference: 'view',
|
||||
|
||||
initialize: function(canvas) {
|
||||
this._scope = paper;
|
||||
this._index = this._scope.views.push(this) - 1;
|
||||
this.base();
|
||||
var size;
|
||||
if (canvas && canvas instanceof HTMLCanvasElement) {
|
||||
if (typeof canvas === 'string')
|
||||
canvas = document.getElementById(canvas);
|
||||
if (canvas instanceof HTMLCanvasElement) {
|
||||
this._canvas = canvas;
|
||||
if (PaperScript.hasAttribute(canvas, 'resize')) {
|
||||
var offset = DomElement.getOffset(canvas, true),
|
||||
|
@ -6530,6 +6546,17 @@ var View = this.View = Base.extend({
|
|||
this._scope._redrawNotified = false;
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
if (!this.base())
|
||||
return false;
|
||||
if (View._focused == this)
|
||||
View._focused = null;
|
||||
delete View._views[this._id];
|
||||
DomEvent.remove(this._canvas, this._events);
|
||||
this._canvas = this._events = this._onFrame = null;
|
||||
return true;
|
||||
},
|
||||
|
||||
getCanvas: function() {
|
||||
return this._canvas;
|
||||
},
|
||||
|
@ -6623,22 +6650,6 @@ var View = this.View = Base.extend({
|
|||
return true;
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
this._scope.view = this;
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
if (this._index == null)
|
||||
return false;
|
||||
if (View._focused == this)
|
||||
View._focused = null;
|
||||
delete View._views[this._id];
|
||||
Base.splice(this._scope.views, null, this._index, 1);
|
||||
DomEvent.remove(this._canvas, this._events);
|
||||
this._scope = this._canvas = this._events = this._onFrame = null;
|
||||
return true;
|
||||
},
|
||||
|
||||
projectToView: function(point) {
|
||||
return this._matrix._transformPoint(Point.read(arguments));
|
||||
},
|
||||
|
@ -7046,9 +7057,12 @@ var ToolEvent = this.ToolEvent = Event.extend({
|
|||
}
|
||||
});
|
||||
|
||||
var Tool = this.Tool = Base.extend({
|
||||
var Tool = this.Tool = PaperScopeItem.extend({
|
||||
_list: 'tools',
|
||||
_reference: 'tool',
|
||||
|
||||
initialize: function() {
|
||||
this._scope = paper;
|
||||
this.base();
|
||||
this._firstMove = true;
|
||||
this._count = 0;
|
||||
this._downCount = 0;
|
||||
|
@ -7675,7 +7689,7 @@ var parse_js=new function(){function W(a,b,c){var d=[];for(var e=0;e<a.length;++
|
|||
function evaluate(code, scope) {
|
||||
paper = scope;
|
||||
var view = scope.view,
|
||||
tool = scope.tool = /on(?:Key|Mouse)(?:Up|Down|Move|Drag)/.test(code)
|
||||
tool = /on(?:Key|Mouse)(?:Up|Down|Move|Drag)/.test(code)
|
||||
&& new Tool(),
|
||||
res;
|
||||
with (scope) {
|
||||
|
@ -7723,10 +7737,8 @@ var parse_js=new function(){function W(a,b,c){var d=[];for(var e=0;e<a.length;++
|
|||
var script = scripts[i];
|
||||
if (/^text\/(?:x-|)paperscript$/.test(script.type)
|
||||
&& !script.getAttribute('data-paper-loaded')) {
|
||||
var canvas = PaperScript.getAttribute(script, 'canvas');
|
||||
canvas = canvas && document.getElementById(canvas);
|
||||
var scope = new PaperScope(script);
|
||||
scope.setup(canvas);
|
||||
scope.setup(PaperScript.getAttribute(script, 'canvas'));
|
||||
if (script.src) {
|
||||
request(script.src, scope);
|
||||
} else {
|
||||
|
|
122
dist/paper.js
vendored
122
dist/paper.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Paper.js v0.2
|
||||
* Paper.js v0.21
|
||||
*
|
||||
* This file is part of Paper.js, a JavaScript Vector Graphics Library,
|
||||
* based on Scriptographer.org and designed to be largely API compatible.
|
||||
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Date: Mon Aug 1 12:03:23 2011 +0100
|
||||
* Date: Tue Aug 2 10:08:08 2011 +0100
|
||||
*
|
||||
***
|
||||
*
|
||||
|
@ -303,9 +303,12 @@ this.Base = Base.inject({
|
|||
|
||||
toString: function() {
|
||||
return '{ ' + Base.each(this, function(value, key) {
|
||||
var type = typeof value;
|
||||
this.push(key + ': ' + (type === 'number' ? Base.formatNumber(value)
|
||||
: type === 'string' ? "'" + value + "'" : value));
|
||||
if (key.charAt(0) != '_') {
|
||||
var type = typeof value;
|
||||
this.push(key + ': ' + (type === 'number'
|
||||
? Base.formatNumber(value)
|
||||
: type === 'string' ? "'" + value + "'" : value));
|
||||
}
|
||||
}, []).join(', ') + ' }';
|
||||
},
|
||||
|
||||
|
@ -406,7 +409,7 @@ var PaperScope = this.PaperScope = Base.extend({
|
|||
PaperScope._scopes[this._id] = this;
|
||||
},
|
||||
|
||||
version: 0.2,
|
||||
version: 0.21,
|
||||
|
||||
evaluate: function(code) {
|
||||
var res = PaperScript.evaluate(code, this);
|
||||
|
@ -476,6 +479,33 @@ var PaperScope = this.PaperScope = Base.extend({
|
|||
}
|
||||
});
|
||||
|
||||
var PaperScopeItem = Base.extend({
|
||||
|
||||
initialize: function(activate) {
|
||||
this._scope = paper;
|
||||
this._index = this._scope[this._list].push(this) - 1;
|
||||
if (activate || !this._scope[this._reference])
|
||||
this.activate();
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
if (!this._scope)
|
||||
return false;
|
||||
this._scope[this._reference] = this;
|
||||
return true;
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
if (this._index == null)
|
||||
return false;
|
||||
Base.splice(this._scope[this._list], null, this._index, 1);
|
||||
if (this._scope[this._reference] == this)
|
||||
this._scope[this._reference] = null;
|
||||
this._scope = null;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
var Point = this.Point = Base.extend({
|
||||
initialize: function(arg0, arg1) {
|
||||
if (arg1 !== undefined) {
|
||||
|
@ -1623,14 +1653,15 @@ var Line = this.Line = Base.extend({
|
|||
}
|
||||
});
|
||||
|
||||
var Project = this.Project = Base.extend({
|
||||
var Project = this.Project = PaperScopeItem.extend({
|
||||
_list: 'projects',
|
||||
_reference: 'project',
|
||||
|
||||
initialize: function() {
|
||||
this._scope = paper;
|
||||
this._index = this._scope.projects.push(this) - 1;
|
||||
this.base(true);
|
||||
this._currentStyle = new PathStyle();
|
||||
this._selectedItems = {};
|
||||
this._selectedItemCount = 0;
|
||||
this.activate();
|
||||
this.layers = [];
|
||||
this.symbols = [];
|
||||
this.activeLayer = new Layer();
|
||||
|
@ -1649,25 +1680,6 @@ var Project = this.Project = Base.extend({
|
|||
this._currentStyle.initialize(style);
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
if (this._scope) {
|
||||
this._scope.project = this;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
if (this._scope) {
|
||||
Base.splice(this._scope.projects, null, this._index, 1);
|
||||
if (this._scope.project == this)
|
||||
this._scope.project = null;
|
||||
this._scope = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
getIndex: function() {
|
||||
return this._index;
|
||||
},
|
||||
|
@ -6470,12 +6482,16 @@ DomEvent.requestAnimationFrame = new function() {
|
|||
};
|
||||
};
|
||||
|
||||
var View = this.View = Base.extend({
|
||||
var View = this.View = PaperScopeItem.extend({
|
||||
_list: 'views',
|
||||
_reference: 'view',
|
||||
|
||||
initialize: function(canvas) {
|
||||
this._scope = paper;
|
||||
this._index = this._scope.views.push(this) - 1;
|
||||
this.base();
|
||||
var size;
|
||||
if (canvas && canvas instanceof HTMLCanvasElement) {
|
||||
if (typeof canvas === 'string')
|
||||
canvas = document.getElementById(canvas);
|
||||
if (canvas instanceof HTMLCanvasElement) {
|
||||
this._canvas = canvas;
|
||||
if (PaperScript.hasAttribute(canvas, 'resize')) {
|
||||
var offset = DomElement.getOffset(canvas, true),
|
||||
|
@ -6530,6 +6546,17 @@ var View = this.View = Base.extend({
|
|||
this._scope._redrawNotified = false;
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
if (!this.base())
|
||||
return false;
|
||||
if (View._focused == this)
|
||||
View._focused = null;
|
||||
delete View._views[this._id];
|
||||
DomEvent.remove(this._canvas, this._events);
|
||||
this._canvas = this._events = this._onFrame = null;
|
||||
return true;
|
||||
},
|
||||
|
||||
getCanvas: function() {
|
||||
return this._canvas;
|
||||
},
|
||||
|
@ -6623,22 +6650,6 @@ var View = this.View = Base.extend({
|
|||
return true;
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
this._scope.view = this;
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
if (this._index == null)
|
||||
return false;
|
||||
if (View._focused == this)
|
||||
View._focused = null;
|
||||
delete View._views[this._id];
|
||||
Base.splice(this._scope.views, null, this._index, 1);
|
||||
DomEvent.remove(this._canvas, this._events);
|
||||
this._scope = this._canvas = this._events = this._onFrame = null;
|
||||
return true;
|
||||
},
|
||||
|
||||
projectToView: function(point) {
|
||||
return this._matrix._transformPoint(Point.read(arguments));
|
||||
},
|
||||
|
@ -7046,9 +7057,12 @@ var ToolEvent = this.ToolEvent = Event.extend({
|
|||
}
|
||||
});
|
||||
|
||||
var Tool = this.Tool = Base.extend({
|
||||
var Tool = this.Tool = PaperScopeItem.extend({
|
||||
_list: 'tools',
|
||||
_reference: 'tool',
|
||||
|
||||
initialize: function() {
|
||||
this._scope = paper;
|
||||
this.base();
|
||||
this._firstMove = true;
|
||||
this._count = 0;
|
||||
this._downCount = 0;
|
||||
|
@ -7675,7 +7689,7 @@ var parse_js=new function(){function W(a,b,c){var d=[];for(var e=0;e<a.length;++
|
|||
function evaluate(code, scope) {
|
||||
paper = scope;
|
||||
var view = scope.view,
|
||||
tool = scope.tool = /on(?:Key|Mouse)(?:Up|Down|Move|Drag)/.test(code)
|
||||
tool = /on(?:Key|Mouse)(?:Up|Down|Move|Drag)/.test(code)
|
||||
&& new Tool(),
|
||||
res;
|
||||
with (scope) {
|
||||
|
@ -7723,10 +7737,8 @@ var parse_js=new function(){function W(a,b,c){var d=[];for(var e=0;e<a.length;++
|
|||
var script = scripts[i];
|
||||
if (/^text\/(?:x-|)paperscript$/.test(script.type)
|
||||
&& !script.getAttribute('data-paper-loaded')) {
|
||||
var canvas = PaperScript.getAttribute(script, 'canvas');
|
||||
canvas = canvas && document.getElementById(canvas);
|
||||
var scope = new PaperScope(script);
|
||||
scope.setup(canvas);
|
||||
scope.setup(PaperScript.getAttribute(script, 'canvas'));
|
||||
if (script.src) {
|
||||
request(script.src, scope);
|
||||
} else {
|
||||
|
|
|
@ -351,7 +351,7 @@ var Size = this.Size = Base.extend(/** @lends Size# */{
|
|||
* @return {Boolean} {@true both width and height are 0}
|
||||
*/
|
||||
isZero: function() {
|
||||
return this.width == 0 && this.width == 0;
|
||||
return this.width == 0 && this.height == 0;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,9 +40,13 @@ this.Base = Base.inject(/** @lends Base# */{
|
|||
*/
|
||||
toString: function() {
|
||||
return '{ ' + Base.each(this, function(value, key) {
|
||||
var type = typeof value;
|
||||
this.push(key + ': ' + (type === 'number' ? Base.formatNumber(value)
|
||||
: type === 'string' ? "'" + value + "'" : value));
|
||||
// Hide internal properties even if they are enumerable
|
||||
if (key.charAt(0) != '_') {
|
||||
var type = typeof value;
|
||||
this.push(key + ': ' + (type === 'number'
|
||||
? Base.formatNumber(value)
|
||||
: type === 'string' ? "'" + value + "'" : value));
|
||||
}
|
||||
}, []).join(', ') + ' }';
|
||||
},
|
||||
|
||||
|
|
58
src/core/PaperScopeItem.js
Normal file
58
src/core/PaperScopeItem.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Paper.js
|
||||
*
|
||||
* This file is part of Paper.js, a JavaScript Vector Graphics Library,
|
||||
* based on Scriptographer.org and designed to be largely API compatible.
|
||||
* http://paperjs.org/
|
||||
* http://scriptographer.org/
|
||||
*
|
||||
* Copyright (c) 2011, Juerg Lehni & Jonathan Puckey
|
||||
* http://lehni.org/ & http://jonathanpuckey.com/
|
||||
*
|
||||
* Distributed under the MIT license. See LICENSE file for details.
|
||||
*
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name PaperScopeItem
|
||||
*
|
||||
* @class A private base class for all classes that have lists and references in
|
||||
* the {@link PaperScope} ({@link Project}, {@link View}, {@link Tool}), so
|
||||
* functionality can be shared.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
var PaperScopeItem = Base.extend(/** @lends PaperScopeItem# */{
|
||||
|
||||
/**
|
||||
* Creates a PaperScopeItem object.
|
||||
*/
|
||||
initialize: function(activate) {
|
||||
// Store reference to the currently active global paper scope:
|
||||
this._scope = paper;
|
||||
// Push it onto this._scope.projects and set index:
|
||||
this._index = this._scope[this._list].push(this) - 1;
|
||||
// If the project has no active reference, activate this one
|
||||
if (activate || !this._scope[this._reference])
|
||||
this.activate();
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
if (!this._scope)
|
||||
return false;
|
||||
this._scope[this._reference] = this;
|
||||
return true;
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
if (this._index == null)
|
||||
return false;
|
||||
Base.splice(this._scope[this._list], null, this._index, 1);
|
||||
// Clear the active tool reference if it was pointint to this.
|
||||
if (this._scope[this._reference] == this)
|
||||
this._scope[this._reference] = null;
|
||||
this._scope = null;
|
||||
return true;
|
||||
}
|
||||
});
|
|
@ -156,8 +156,7 @@ var PaperScript = this.PaperScript = new function() {
|
|||
// Set currently active scope.
|
||||
paper = scope;
|
||||
var view = scope.view,
|
||||
// TODO: Add support for multiple tools
|
||||
tool = scope.tool = /on(?:Key|Mouse)(?:Up|Down|Move|Drag)/.test(code)
|
||||
tool = /on(?:Key|Mouse)(?:Up|Down|Move|Drag)/.test(code)
|
||||
&& new Tool(),
|
||||
res;
|
||||
// Define variables for potential handlers, so eval() calls below to
|
||||
|
@ -234,10 +233,8 @@ var PaperScript = this.PaperScript = new function() {
|
|||
// retrieved through PaperScope.get().
|
||||
// If a canvas id is provided, pass it on to the PaperScope
|
||||
// so a project is created for it now.
|
||||
var canvas = PaperScript.getAttribute(script, 'canvas');
|
||||
canvas = canvas && document.getElementById(canvas);
|
||||
var scope = new PaperScope(script);
|
||||
scope.setup(canvas);
|
||||
scope.setup(PaperScript.getAttribute(script, 'canvas'));
|
||||
if (script.src) {
|
||||
// If we're loading from a source, request that first and then
|
||||
// run later.
|
||||
|
|
|
@ -677,8 +677,7 @@ var Item = this.Item = Base.extend(/** @lends Item# */{
|
|||
matrix.applyToContext(ctx);
|
||||
this.draw(ctx, {});
|
||||
var raster = new Raster(canvas);
|
||||
raster.setPosition(this.getPosition());
|
||||
raster.scale(1 / scale);
|
||||
raster.setBounds(bounds);
|
||||
return raster;
|
||||
},
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ var paper = new function() {
|
|||
|
||||
/*#*/ include('core/Base.js');
|
||||
/*#*/ include('core/PaperScope.js');
|
||||
/*#*/ include('core/PaperScopeItem.js');
|
||||
|
||||
// Include Paper classes, which are later injected into PaperScope by setting
|
||||
// them on the 'this' object, e.g.:
|
||||
|
|
|
@ -203,6 +203,9 @@ var Segment = this.Segment = Base.extend(/** @lends Segment# */{
|
|||
if (selected)
|
||||
selection[0] = false;
|
||||
selection[index] = selected;
|
||||
// Let path know that we changed something and the view
|
||||
// should be redrawn
|
||||
path._changed(Change.ATTRIBUTE);
|
||||
}
|
||||
}
|
||||
this._selectionState = (selection[0] ? SelectionState.POINT : 0)
|
||||
|
|
|
@ -34,7 +34,10 @@
|
|||
* An array of all open projects is accessible through the
|
||||
* {@link PaperScope#projects} variable.
|
||||
*/
|
||||
var Project = this.Project = Base.extend(/** @lends Project# */{
|
||||
var Project = this.Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||
_list: 'projects',
|
||||
_reference: 'project',
|
||||
|
||||
// TODO: Add arguments to define pages
|
||||
/**
|
||||
* Creates a Paper.js project.
|
||||
|
@ -43,16 +46,12 @@ var Project = this.Project = Base.extend(/** @lends Project# */{
|
|||
* and the {@link PaperScope#project} variable points to it.
|
||||
*/
|
||||
initialize: function() {
|
||||
// Store reference to the currently active global paper scope:
|
||||
this._scope = paper;
|
||||
// Push it onto this._scope.projects and set index:
|
||||
this._index = this._scope.projects.push(this) - 1;
|
||||
// Activate straight away so paper.project is set, as required by
|
||||
// Layer and DoumentView constructors.
|
||||
this.base(true);
|
||||
this._currentStyle = new PathStyle();
|
||||
this._selectedItems = {};
|
||||
this._selectedItemCount = 0;
|
||||
// Activate straight away so paper.project is set, as required by
|
||||
// Layer and DoumentView constructors.
|
||||
this.activate();
|
||||
this.layers = [];
|
||||
this.symbols = [];
|
||||
this.activeLayer = new Layer();
|
||||
|
@ -63,6 +62,21 @@ var Project = this.Project = Base.extend(/** @lends Project# */{
|
|||
this._scope._needsRedraw();
|
||||
},
|
||||
|
||||
/**
|
||||
* Activates this project, so all newly created items will be placed
|
||||
* in it.
|
||||
*
|
||||
* @name Project#activate
|
||||
* @function
|
||||
*/
|
||||
|
||||
/**
|
||||
* Removes this project from the {@link PaperScope#projects} list.
|
||||
*
|
||||
* @name Project#remove
|
||||
* @function
|
||||
*/
|
||||
|
||||
/**
|
||||
* The currently active path style. All selected items and newly
|
||||
* created items will be styled with this style.
|
||||
|
@ -98,33 +112,6 @@ var Project = this.Project = Base.extend(/** @lends Project# */{
|
|||
this._currentStyle.initialize(style);
|
||||
},
|
||||
|
||||
/**
|
||||
* Activates this project, so all newly created items will be placed
|
||||
* in it.
|
||||
*/
|
||||
activate: function() {
|
||||
if (this._scope) {
|
||||
this._scope.project = this;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes this project from the {@link PaperScope#projects} list.
|
||||
*/
|
||||
remove: function() {
|
||||
if (this._scope) {
|
||||
Base.splice(this._scope.projects, null, this._index, 1);
|
||||
// Clear the active project reference if it was pointint to this.
|
||||
if (this._scope.project == this)
|
||||
this._scope.project = null;
|
||||
this._scope = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* The index of the project in the {@link PaperScope#projects} list.
|
||||
*
|
||||
|
|
|
@ -37,9 +37,8 @@ var PointText = this.PointText = TextItem.extend(/** @lends PointText# */{
|
|||
*/
|
||||
initialize: function(point) {
|
||||
this.base();
|
||||
var point = Point.read(arguments);
|
||||
this._point = LinkedPoint.create(this, 'setPoint', point.x, point.y);
|
||||
this._matrix = new Matrix().translate(point);
|
||||
this._point = Point.read(arguments).clone();
|
||||
this._matrix = new Matrix().translate(this._point);
|
||||
},
|
||||
|
||||
clone: function() {
|
||||
|
@ -56,18 +55,21 @@ var PointText = this.PointText = TextItem.extend(/** @lends PointText# */{
|
|||
* @bean
|
||||
*/
|
||||
getPoint: function() {
|
||||
return this._point;
|
||||
// Se Item#getPosition for an explanation why we create new LinkedPoint
|
||||
// objects each time.
|
||||
return LinkedPoint.create(this, 'setPoint',
|
||||
this._point.x, this._point.y);
|
||||
},
|
||||
|
||||
setPoint: function(point) {
|
||||
this._transform(new Matrix().translate(
|
||||
Point.read(arguments).subtract(this._point)));
|
||||
this.translate(Point.read(arguments).subtract(this._point));
|
||||
},
|
||||
|
||||
// TODO: Position should be the center point of the bounds but we currently
|
||||
// don't support bounds for PointText.
|
||||
// don't support bounds for PointText, so let's return the same as #point
|
||||
// for the time being.
|
||||
getPosition: function() {
|
||||
return this._point;
|
||||
return this.getPoint();
|
||||
},
|
||||
|
||||
setPosition: function(point) {
|
||||
|
@ -76,10 +78,8 @@ var PointText = this.PointText = TextItem.extend(/** @lends PointText# */{
|
|||
|
||||
_transform: function(matrix, flags) {
|
||||
this._matrix.preConcatenate(matrix);
|
||||
// We need to transform the LinkedPoint, passing true for dontNotify so
|
||||
// chaning it won't trigger calls of setPoint(), leading to an endless
|
||||
// recursion.
|
||||
matrix._transformPoint(this._point, this._point, true);
|
||||
// Also transform _point:
|
||||
matrix._transformPoint(this._point, this._point);
|
||||
},
|
||||
|
||||
draw: function(ctx) {
|
||||
|
|
|
@ -46,16 +46,33 @@
|
|||
* path.add(event.point);
|
||||
* }
|
||||
*/
|
||||
var Tool = this.Tool = Base.extend(/** @lends Tool# */{
|
||||
var Tool = this.Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||
_list: 'tools',
|
||||
_reference: 'tool',
|
||||
|
||||
// DOCS: rewrite Tool constructor explanation
|
||||
initialize: function() {
|
||||
// Store reference to the currently active global paper scope:
|
||||
this._scope = paper;
|
||||
this.base();
|
||||
this._firstMove = true;
|
||||
this._count = 0;
|
||||
this._downCount = 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Activates this tool, meaning {@link PaperScope#tool} will
|
||||
* point to it and it will be the one that recieves mouse events.
|
||||
*
|
||||
* @name Tool#activate
|
||||
* @function
|
||||
*/
|
||||
|
||||
/**
|
||||
* Removes this tool from the {@link PaperScope#tools} list.
|
||||
*
|
||||
* @name Tool#remove
|
||||
* @function
|
||||
*/
|
||||
|
||||
/**
|
||||
* The fixed time delay in milliseconds between each call to the
|
||||
* {@link #onMouseDrag} event. Setting this to an interval means the
|
||||
|
|
|
@ -23,16 +23,17 @@
|
|||
* center, both useful for constructing artwork that should appear centered on
|
||||
* screen.
|
||||
*/
|
||||
var View = this.View = Base.extend(/** @lends View# */{
|
||||
var View = this.View = PaperScopeItem.extend(/** @lends View# */{
|
||||
_list: 'views',
|
||||
_reference: 'view',
|
||||
|
||||
/**
|
||||
* Creates a view object
|
||||
* @param {Canvas} canvas
|
||||
* @param {HTMLCanvasElement|String} canvas The canvas object that this
|
||||
* view should wrap, or the String id that represents it
|
||||
*/
|
||||
initialize: function(canvas) {
|
||||
// Associate this view with the active paper scope.
|
||||
this._scope = paper;
|
||||
// Push it onto project.views and set index:
|
||||
this._index = this._scope.views.push(this) - 1;
|
||||
this.base();
|
||||
// Handle canvas argument
|
||||
var size;
|
||||
|
||||
|
@ -134,6 +135,32 @@ var View = this.View = Base.extend(/** @lends View# */{
|
|||
this._scope._redrawNotified = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Makes this view the active one, meaning {@link PaperScope#view} will
|
||||
* point to it.
|
||||
*
|
||||
* @name View#activate
|
||||
* @function
|
||||
*/
|
||||
|
||||
/**
|
||||
* Removes thsi view from the {@link PaperScope#views} list and frees the
|
||||
* associated canvas.
|
||||
*/
|
||||
remove: function() {
|
||||
if (!this.base())
|
||||
return false;
|
||||
// Clear focus if removed view had it
|
||||
if (View._focused == this)
|
||||
View._focused = null;
|
||||
delete View._views[this._id];
|
||||
// Uninstall event handlers again for this view.
|
||||
DomEvent.remove(this._canvas, this._events);
|
||||
// Clearing _onFrame makes the frame handler stop automatically.
|
||||
this._canvas = this._events = this._onFrame = null;
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* The underlying native canvas element.
|
||||
*
|
||||
|
@ -264,6 +291,12 @@ var View = this.View = Base.extend(/** @lends View# */{
|
|||
this._inverse = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Draws the view.
|
||||
*
|
||||
* @name View#draw
|
||||
* @function
|
||||
*/
|
||||
draw: function(checkRedraw) {
|
||||
if (checkRedraw && !this._redrawNeeded)
|
||||
return false;
|
||||
|
@ -289,25 +322,6 @@ var View = this.View = Base.extend(/** @lends View# */{
|
|||
return true;
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
this._scope.view = this;
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
if (this._index == null)
|
||||
return false;
|
||||
// Clear focus if removed view had it
|
||||
if (View._focused == this)
|
||||
View._focused = null;
|
||||
delete View._views[this._id];
|
||||
Base.splice(this._scope.views, null, this._index, 1);
|
||||
// Uninstall event handlers again for this view.
|
||||
DomEvent.remove(this._canvas, this._events);
|
||||
// Clearing _onFrame makes the frame handler stop automatically.
|
||||
this._scope = this._canvas = this._events = this._onFrame = null;
|
||||
return true;
|
||||
},
|
||||
|
||||
// TODO: getInvalidBounds
|
||||
// TODO: invalidate(rect)
|
||||
// TODO: style: artwork / preview / raster / opaque / ink
|
||||
|
|
Loading…
Reference in a new issue