mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Prebuilt module for commit f9d06d8ae4
This commit is contained in:
parent
a6c090732b
commit
e255b9b31d
17 changed files with 95 additions and 59 deletions
30
dist/docs/assets/js/paper.js
vendored
30
dist/docs/assets/js/paper.js
vendored
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Date: Wed Mar 8 17:14:42 2017 +0100
|
||||
* Date: Wed Mar 8 23:01:12 2017 +0100
|
||||
*
|
||||
***
|
||||
*
|
||||
|
@ -3722,26 +3722,33 @@ new function() {
|
|||
return hit;
|
||||
}
|
||||
|
||||
function checkBounds(type, part) {
|
||||
var pt = bounds['get' + part]();
|
||||
function checkPoint(type, part) {
|
||||
var pt = part ? bounds['get' + part]() : that.getPosition();
|
||||
if (point.subtract(pt).divide(tolerancePadding).length <= 1) {
|
||||
return new HitResult(type, that,
|
||||
{ name: Base.hyphenate(part), point: pt });
|
||||
return new HitResult(type, that, {
|
||||
name: part ? Base.hyphenate(part) : type,
|
||||
point: pt
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (checkSelf && (options.center || options.bounds) && this._parent) {
|
||||
bounds = this.getInternalBounds();
|
||||
if (options.center) {
|
||||
res = checkBounds('center', 'Center');
|
||||
var checkPosition = options.position,
|
||||
checkCenter = options.center,
|
||||
checkBounds = options.bounds;
|
||||
if (checkSelf && this._parent
|
||||
&& (checkPosition || checkCenter || checkBounds)) {
|
||||
if (checkCenter || checkBounds) {
|
||||
bounds = this.getInternalBounds();
|
||||
}
|
||||
if (!res && options.bounds) {
|
||||
res = checkPosition && checkPoint('position') ||
|
||||
checkCenter && checkPoint('center', 'Center');
|
||||
if (!res && checkBounds) {
|
||||
var points = [
|
||||
'TopLeft', 'TopRight', 'BottomLeft', 'BottomRight',
|
||||
'LeftCenter', 'TopCenter', 'RightCenter', 'BottomCenter'
|
||||
];
|
||||
for (var i = 0; i < 8 && !res; i++) {
|
||||
res = checkBounds('bounds', points[i]);
|
||||
res = checkPoint('bounds', points[i]);
|
||||
}
|
||||
}
|
||||
res = filter(res);
|
||||
|
@ -5458,6 +5465,7 @@ var HitResult = Base.extend({
|
|||
segments: !options,
|
||||
handles: false,
|
||||
ends: false,
|
||||
position: false,
|
||||
center: false,
|
||||
bounds: false,
|
||||
guides: false,
|
||||
|
|
3
dist/docs/classes/CompoundPath.html
vendored
3
dist/docs/classes/CompoundPath.html
vendored
|
@ -3407,8 +3407,9 @@ function onMouseDown(event) {
|
|||
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
||||
<li><tt>options.handles: <tt>Boolean</tt></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.</li>
|
||||
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.position: <tt>Boolean</tt></tt> — hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
|
||||
<li><tt>options.center: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
|
||||
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
||||
</ul>
|
||||
|
|
3
dist/docs/classes/Group.html
vendored
3
dist/docs/classes/Group.html
vendored
|
@ -3275,8 +3275,9 @@ function onMouseDown(event) {
|
|||
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
||||
<li><tt>options.handles: <tt>Boolean</tt></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.</li>
|
||||
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.position: <tt>Boolean</tt></tt> — hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
|
||||
<li><tt>options.center: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
|
||||
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
||||
</ul>
|
||||
|
|
3
dist/docs/classes/Item.html
vendored
3
dist/docs/classes/Item.html
vendored
|
@ -3026,8 +3026,9 @@ function onMouseDown(event) {
|
|||
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
||||
<li><tt>options.handles: <tt>Boolean</tt></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.</li>
|
||||
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.position: <tt>Boolean</tt></tt> — hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
|
||||
<li><tt>options.center: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
|
||||
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
||||
</ul>
|
||||
|
|
3
dist/docs/classes/Layer.html
vendored
3
dist/docs/classes/Layer.html
vendored
|
@ -3191,8 +3191,9 @@ function onMouseDown(event) {
|
|||
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
||||
<li><tt>options.handles: <tt>Boolean</tt></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.</li>
|
||||
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.position: <tt>Boolean</tt></tt> — hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
|
||||
<li><tt>options.center: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
|
||||
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
||||
</ul>
|
||||
|
|
3
dist/docs/classes/Path.html
vendored
3
dist/docs/classes/Path.html
vendored
|
@ -6302,8 +6302,9 @@ function onMouseDown(event) {
|
|||
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
||||
<li><tt>options.handles: <tt>Boolean</tt></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.</li>
|
||||
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.position: <tt>Boolean</tt></tt> — hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
|
||||
<li><tt>options.center: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
|
||||
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
||||
</ul>
|
||||
|
|
3
dist/docs/classes/PathItem.html
vendored
3
dist/docs/classes/PathItem.html
vendored
|
@ -5040,8 +5040,9 @@ function onMouseDown(event) {
|
|||
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
||||
<li><tt>options.handles: <tt>Boolean</tt></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.</li>
|
||||
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.position: <tt>Boolean</tt></tt> — hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
|
||||
<li><tt>options.center: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
|
||||
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
||||
</ul>
|
||||
|
|
3
dist/docs/classes/PointText.html
vendored
3
dist/docs/classes/PointText.html
vendored
|
@ -3198,8 +3198,9 @@ function onMouseDown(event) {
|
|||
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
||||
<li><tt>options.handles: <tt>Boolean</tt></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.</li>
|
||||
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.position: <tt>Boolean</tt></tt> — hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
|
||||
<li><tt>options.center: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
|
||||
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
||||
</ul>
|
||||
|
|
3
dist/docs/classes/Project.html
vendored
3
dist/docs/classes/Project.html
vendored
|
@ -563,8 +563,9 @@ var path2 = new Path.Circle(new Point(175, 50), 20);
|
|||
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
||||
<li><tt>options.handles: <tt>Boolean</tt></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.</li>
|
||||
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.position: <tt>Boolean</tt></tt> — hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
|
||||
<li><tt>options.center: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
|
||||
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
||||
</ul>
|
||||
|
|
3
dist/docs/classes/Raster.html
vendored
3
dist/docs/classes/Raster.html
vendored
|
@ -4040,8 +4040,9 @@ function onMouseDown(event) {
|
|||
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
||||
<li><tt>options.handles: <tt>Boolean</tt></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.</li>
|
||||
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.position: <tt>Boolean</tt></tt> — hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
|
||||
<li><tt>options.center: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
|
||||
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
||||
</ul>
|
||||
|
|
3
dist/docs/classes/Shape.html
vendored
3
dist/docs/classes/Shape.html
vendored
|
@ -3774,8 +3774,9 @@ function onMouseDown(event) {
|
|||
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
||||
<li><tt>options.handles: <tt>Boolean</tt></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.</li>
|
||||
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.position: <tt>Boolean</tt></tt> — hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
|
||||
<li><tt>options.center: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
|
||||
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
||||
</ul>
|
||||
|
|
3
dist/docs/classes/SymbolItem.html
vendored
3
dist/docs/classes/SymbolItem.html
vendored
|
@ -3166,8 +3166,9 @@ function onMouseDown(event) {
|
|||
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
||||
<li><tt>options.handles: <tt>Boolean</tt></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.</li>
|
||||
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.position: <tt>Boolean</tt></tt> — hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
|
||||
<li><tt>options.center: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
|
||||
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
||||
</ul>
|
||||
|
|
3
dist/docs/classes/TextItem.html
vendored
3
dist/docs/classes/TextItem.html
vendored
|
@ -3280,8 +3280,9 @@ function onMouseDown(event) {
|
|||
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
||||
<li><tt>options.handles: <tt>Boolean</tt></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.</li>
|
||||
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.position: <tt>Boolean</tt></tt> — hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
|
||||
<li><tt>options.center: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.bounds: <tt>Boolean</tt></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>)</li>
|
||||
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
|
||||
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
||||
</ul>
|
||||
|
|
30
dist/paper-core.js
vendored
30
dist/paper-core.js
vendored
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Date: Wed Mar 8 17:14:42 2017 +0100
|
||||
* Date: Wed Mar 8 23:01:12 2017 +0100
|
||||
*
|
||||
***
|
||||
*
|
||||
|
@ -3722,26 +3722,33 @@ new function() {
|
|||
return hit;
|
||||
}
|
||||
|
||||
function checkBounds(type, part) {
|
||||
var pt = bounds['get' + part]();
|
||||
function checkPoint(type, part) {
|
||||
var pt = part ? bounds['get' + part]() : that.getPosition();
|
||||
if (point.subtract(pt).divide(tolerancePadding).length <= 1) {
|
||||
return new HitResult(type, that,
|
||||
{ name: Base.hyphenate(part), point: pt });
|
||||
return new HitResult(type, that, {
|
||||
name: part ? Base.hyphenate(part) : type,
|
||||
point: pt
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (checkSelf && (options.center || options.bounds) && this._parent) {
|
||||
bounds = this.getInternalBounds();
|
||||
if (options.center) {
|
||||
res = checkBounds('center', 'Center');
|
||||
var checkPosition = options.position,
|
||||
checkCenter = options.center,
|
||||
checkBounds = options.bounds;
|
||||
if (checkSelf && this._parent
|
||||
&& (checkPosition || checkCenter || checkBounds)) {
|
||||
if (checkCenter || checkBounds) {
|
||||
bounds = this.getInternalBounds();
|
||||
}
|
||||
if (!res && options.bounds) {
|
||||
res = checkPosition && checkPoint('position') ||
|
||||
checkCenter && checkPoint('center', 'Center');
|
||||
if (!res && checkBounds) {
|
||||
var points = [
|
||||
'TopLeft', 'TopRight', 'BottomLeft', 'BottomRight',
|
||||
'LeftCenter', 'TopCenter', 'RightCenter', 'BottomCenter'
|
||||
];
|
||||
for (var i = 0; i < 8 && !res; i++) {
|
||||
res = checkBounds('bounds', points[i]);
|
||||
res = checkPoint('bounds', points[i]);
|
||||
}
|
||||
}
|
||||
res = filter(res);
|
||||
|
@ -5458,6 +5465,7 @@ var HitResult = Base.extend({
|
|||
segments: !options,
|
||||
handles: false,
|
||||
ends: false,
|
||||
position: false,
|
||||
center: false,
|
||||
bounds: false,
|
||||
guides: false,
|
||||
|
|
14
dist/paper-core.min.js
vendored
14
dist/paper-core.min.js
vendored
File diff suppressed because one or more lines are too long
30
dist/paper-full.js
vendored
30
dist/paper-full.js
vendored
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Date: Wed Mar 8 17:14:42 2017 +0100
|
||||
* Date: Wed Mar 8 23:01:12 2017 +0100
|
||||
*
|
||||
***
|
||||
*
|
||||
|
@ -3722,26 +3722,33 @@ new function() {
|
|||
return hit;
|
||||
}
|
||||
|
||||
function checkBounds(type, part) {
|
||||
var pt = bounds['get' + part]();
|
||||
function checkPoint(type, part) {
|
||||
var pt = part ? bounds['get' + part]() : that.getPosition();
|
||||
if (point.subtract(pt).divide(tolerancePadding).length <= 1) {
|
||||
return new HitResult(type, that,
|
||||
{ name: Base.hyphenate(part), point: pt });
|
||||
return new HitResult(type, that, {
|
||||
name: part ? Base.hyphenate(part) : type,
|
||||
point: pt
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (checkSelf && (options.center || options.bounds) && this._parent) {
|
||||
bounds = this.getInternalBounds();
|
||||
if (options.center) {
|
||||
res = checkBounds('center', 'Center');
|
||||
var checkPosition = options.position,
|
||||
checkCenter = options.center,
|
||||
checkBounds = options.bounds;
|
||||
if (checkSelf && this._parent
|
||||
&& (checkPosition || checkCenter || checkBounds)) {
|
||||
if (checkCenter || checkBounds) {
|
||||
bounds = this.getInternalBounds();
|
||||
}
|
||||
if (!res && options.bounds) {
|
||||
res = checkPosition && checkPoint('position') ||
|
||||
checkCenter && checkPoint('center', 'Center');
|
||||
if (!res && checkBounds) {
|
||||
var points = [
|
||||
'TopLeft', 'TopRight', 'BottomLeft', 'BottomRight',
|
||||
'LeftCenter', 'TopCenter', 'RightCenter', 'BottomCenter'
|
||||
];
|
||||
for (var i = 0; i < 8 && !res; i++) {
|
||||
res = checkBounds('bounds', points[i]);
|
||||
res = checkPoint('bounds', points[i]);
|
||||
}
|
||||
}
|
||||
res = filter(res);
|
||||
|
@ -5458,6 +5465,7 @@ var HitResult = Base.extend({
|
|||
segments: !options,
|
||||
handles: false,
|
||||
ends: false,
|
||||
position: false,
|
||||
center: false,
|
||||
bounds: false,
|
||||
guides: false,
|
||||
|
|
14
dist/paper-full.min.js
vendored
14
dist/paper-full.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue