mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Prebuilt module for commit d1f1d7a5f6
This commit is contained in:
parent
0956c7d9ff
commit
1d73f441bd
9 changed files with 80 additions and 114 deletions
|
@ -168,6 +168,7 @@ contribute to the code.
|
|||
- Add new options to `#exportSVG()` to control output bounds and transformation
|
||||
matrix (#972).
|
||||
- Allow `Item#position` to be selected via `Item#position.selected` (#980).
|
||||
- Add `tolerance` argument to `Path#join(path, tolerance)`.
|
||||
|
||||
### Fixed
|
||||
- Fix calculations of `Item#strokeBounds` for all possible combinations of
|
||||
|
@ -240,6 +241,8 @@ contribute to the code.
|
|||
(#769).
|
||||
- Fix wrong indices in `Item#insertChildren()`, when inserting children that
|
||||
were previously inserted in the same parent (#1015).
|
||||
- Add capability to `PathItem#closePath()` to handle imprecise SVG data due to
|
||||
rounding (#1045).
|
||||
|
||||
### Removed
|
||||
- Canvas attributes "resize" and "data-paper-resize" no longer cause paper to
|
||||
|
|
30
dist/docs/assets/js/paper.js
vendored
30
dist/docs/assets/js/paper.js
vendored
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Date: Sat Jun 11 11:14:19 2016 +0200
|
||||
* Date: Sat Jun 11 12:43:37 2016 +0200
|
||||
*
|
||||
***
|
||||
*
|
||||
|
@ -1344,7 +1344,7 @@ var Point = Base.extend({
|
|||
isClose: function() {
|
||||
var point = Point.read(arguments),
|
||||
tolerance = Base.read(arguments);
|
||||
return this.getDistance(point) < tolerance;
|
||||
return this.getDistance(point) <= tolerance;
|
||||
},
|
||||
|
||||
isCollinear: function() {
|
||||
|
@ -7427,7 +7427,7 @@ var PathItem = Item.extend({
|
|||
}
|
||||
break;
|
||||
case 'z':
|
||||
this.closePath(true);
|
||||
this.closePath(1e-12);
|
||||
break;
|
||||
}
|
||||
previous = lower;
|
||||
|
@ -8011,25 +8011,26 @@ var Path = PathItem.extend({
|
|||
return location != null ? this.splitAt(location) : null;
|
||||
},
|
||||
|
||||
join: function(path) {
|
||||
if (path) {
|
||||
join: function(path, tolerance) {
|
||||
var epsilon = tolerance || 0;
|
||||
if (path && path !== this) {
|
||||
var segments = path._segments,
|
||||
last1 = this.getLastSegment(),
|
||||
last2 = path.getLastSegment();
|
||||
if (!last2)
|
||||
return this;
|
||||
if (last1 && last1._point.equals(last2._point))
|
||||
if (last1 && last1._point.isClose(last2._point, epsilon))
|
||||
path.reverse();
|
||||
var first2 = path.getFirstSegment();
|
||||
if (last1 && last1._point.equals(first2._point)) {
|
||||
if (last1 && last1._point.isClose(first2._point, epsilon)) {
|
||||
last1.setHandleOut(first2._handleOut);
|
||||
this._add(segments.slice(1));
|
||||
} else {
|
||||
var first1 = this.getFirstSegment();
|
||||
if (first1 && first1._point.equals(first2._point))
|
||||
if (first1 && first1._point.isClose(first2._point, epsilon))
|
||||
path.reverse();
|
||||
last2 = path.getLastSegment();
|
||||
if (first1 && first1._point.equals(last2._point)) {
|
||||
if (first1 && first1._point.isClose(last2._point, epsilon)) {
|
||||
first1.setHandleIn(last2._handleIn);
|
||||
this._add(segments.slice(0, segments.length - 1), 0);
|
||||
} else {
|
||||
|
@ -8042,7 +8043,7 @@ var Path = PathItem.extend({
|
|||
}
|
||||
var first = this.getFirstSegment(),
|
||||
last = this.getLastSegment();
|
||||
if (first !== last && first._point.equals(last._point)) {
|
||||
if (first !== last && first._point.isClose(last._point, epsilon)) {
|
||||
first.setHandleIn(last._handleIn);
|
||||
last.remove();
|
||||
this.setClosed(true);
|
||||
|
@ -8848,10 +8849,9 @@ new function() {
|
|||
}
|
||||
},
|
||||
|
||||
closePath: function(join) {
|
||||
closePath: function(tolerance) {
|
||||
this.setClosed(true);
|
||||
if (join)
|
||||
this.join();
|
||||
this.join(this, tolerance);
|
||||
}
|
||||
};
|
||||
}, {
|
||||
|
@ -9396,8 +9396,8 @@ new function() {
|
|||
this.moveTo(last ? point.add(last._point) : point);
|
||||
},
|
||||
|
||||
closePath: function(join) {
|
||||
getCurrentPath(this, true).closePath(join);
|
||||
closePath: function(tolerance) {
|
||||
getCurrentPath(this, true).closePath(tolerance);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
18
dist/docs/classes/CompoundPath.html
vendored
18
dist/docs/classes/CompoundPath.html
vendored
|
@ -7613,27 +7613,15 @@ function onMouseMove(event) {
|
|||
</div>
|
||||
|
||||
|
||||
<div id="closepath-join" class="member">
|
||||
<div id="closepath" class="member">
|
||||
<div class="member-link">
|
||||
<a name="closepath-join" href="#closepath-join"><tt><b>closePath</b>(join)</tt></a>
|
||||
<a name="closepath" href="#closepath"><tt><b>closePath</b>()</tt></a>
|
||||
</div>
|
||||
<div class="member-description hidden">
|
||||
<div class="member-text">
|
||||
<p>Closes the path. When closed, Paper.js connects the first and last segment of the path with an additional curve.</p>
|
||||
<p>Closes the path. When closed, Paper.js connects the first and last segment of the path with an additional curve. The difference to setting <a href="../classes/Path.html#closed"><tt>path.closed</tt></a> to <code>true</code> is that this will also merge the first segment with the last if they lie in the same location.</p>
|
||||
|
||||
|
||||
<ul class="member-list">
|
||||
<h4>Parameters:</h4>
|
||||
|
||||
<li>
|
||||
<tt>join:</tt>
|
||||
<tt>Boolean</tt>
|
||||
— controls whether the method should attempt to merge the first segment with the last if they lie in the same location
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<ul class="member-list">
|
||||
|
|
41
dist/docs/classes/Path.html
vendored
41
dist/docs/classes/Path.html
vendored
|
@ -2446,11 +2446,12 @@ path.firstSegment.selected = true;
|
|||
|
||||
<div id="join-path" class="member">
|
||||
<div class="member-link">
|
||||
<a name="join-path" href="#join-path"><tt><b>join</b>(path)</tt></a>
|
||||
<a name="join-path" href="#join-path"><tt><b>join</b>(path[, tolerance])</tt></a>
|
||||
</div>
|
||||
<div class="member-description hidden">
|
||||
<div class="member-text">
|
||||
<p>Joins the path with the specified path, which will be removed in the process.</p>
|
||||
<p>Joins the path with the other specified path, which will be removed in the process. They can be joined if the first or last segments of either path lie in the same location. Locations are optionally compare with a provide <code>tolerance</code> value.</p>
|
||||
<p>If <code>null</code> or <code>this</code> is passed as the other path, the path will be joined with itself if the first and last segment are in the same location.</p>
|
||||
|
||||
|
||||
<ul class="member-list">
|
||||
|
@ -2459,22 +2460,20 @@ path.firstSegment.selected = true;
|
|||
<li>
|
||||
<tt>path:</tt>
|
||||
<a href="../classes/Path.html"><tt>Path</tt></a>
|
||||
— the path to join this path with
|
||||
— the path to join this path with; <code>null</code> or <code>this</code> to join the path with itself
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<tt>tolerance:</tt>
|
||||
<tt>Number</tt>
|
||||
— the tolerance with which to decide if two segments are to be considered the same location when joining
|
||||
— optional, default: <tt>0</tt>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<ul class="member-list">
|
||||
<h4>Returns:</h4>
|
||||
|
||||
<li>
|
||||
<tt><a href="../classes/Path.html"><tt>Path</tt></a></tt> — the joined path
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<h4>Example:<span class="description">Joining two paths:</span></h4>
|
||||
|
||||
|
@ -10434,27 +10433,15 @@ function onMouseMove(event) {
|
|||
</div>
|
||||
|
||||
|
||||
<div id="closepath-join" class="member">
|
||||
<div id="closepath" class="member">
|
||||
<div class="member-link">
|
||||
<a name="closepath-join" href="#closepath-join"><tt><b>closePath</b>(join)</tt></a>
|
||||
<a name="closepath" href="#closepath"><tt><b>closePath</b>()</tt></a>
|
||||
</div>
|
||||
<div class="member-description hidden">
|
||||
<div class="member-text">
|
||||
<p>Closes the path. When closed, Paper.js connects the first and last segment of the path with an additional curve.</p>
|
||||
<p>Closes the path. When closed, Paper.js connects the first and last segment of the path with an additional curve. The difference to setting <a href="../classes/Path.html#closed"><tt>path.closed</tt></a> to <code>true</code> is that this will also merge the first segment with the last if they lie in the same location.</p>
|
||||
|
||||
|
||||
<ul class="member-list">
|
||||
<h4>Parameters:</h4>
|
||||
|
||||
<li>
|
||||
<tt>join:</tt>
|
||||
<tt>Boolean</tt>
|
||||
— controls whether the method should attempt to merge the first segment with the last if they lie in the same location
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<ul class="member-list">
|
||||
|
|
18
dist/docs/classes/PathItem.html
vendored
18
dist/docs/classes/PathItem.html
vendored
|
@ -1284,27 +1284,15 @@ function onMouseMove(event) {
|
|||
</div>
|
||||
|
||||
|
||||
<div id="closepath-join" class="member">
|
||||
<div id="closepath" class="member">
|
||||
<div class="member-link">
|
||||
<a name="closepath-join" href="#closepath-join"><tt><b>closePath</b>(join)</tt></a>
|
||||
<a name="closepath" href="#closepath"><tt><b>closePath</b>()</tt></a>
|
||||
</div>
|
||||
<div class="member-description hidden">
|
||||
<div class="member-text">
|
||||
<p>Closes the path. When closed, Paper.js connects the first and last segment of the path with an additional curve.</p>
|
||||
<p>Closes the path. When closed, Paper.js connects the first and last segment of the path with an additional curve. The difference to setting <a href="../classes/Path.html#closed"><tt>path.closed</tt></a> to <code>true</code> is that this will also merge the first segment with the last if they lie in the same location.</p>
|
||||
|
||||
|
||||
<ul class="member-list">
|
||||
<h4>Parameters:</h4>
|
||||
|
||||
<li>
|
||||
<tt>join:</tt>
|
||||
<tt>Boolean</tt>
|
||||
— controls whether the method should attempt to merge the first segment with the last if they lie in the same location
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<ul class="member-list">
|
||||
|
|
30
dist/paper-core.js
vendored
30
dist/paper-core.js
vendored
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Date: Sat Jun 11 11:14:19 2016 +0200
|
||||
* Date: Sat Jun 11 12:43:37 2016 +0200
|
||||
*
|
||||
***
|
||||
*
|
||||
|
@ -1344,7 +1344,7 @@ var Point = Base.extend({
|
|||
isClose: function() {
|
||||
var point = Point.read(arguments),
|
||||
tolerance = Base.read(arguments);
|
||||
return this.getDistance(point) < tolerance;
|
||||
return this.getDistance(point) <= tolerance;
|
||||
},
|
||||
|
||||
isCollinear: function() {
|
||||
|
@ -7427,7 +7427,7 @@ var PathItem = Item.extend({
|
|||
}
|
||||
break;
|
||||
case 'z':
|
||||
this.closePath(true);
|
||||
this.closePath(1e-12);
|
||||
break;
|
||||
}
|
||||
previous = lower;
|
||||
|
@ -8011,25 +8011,26 @@ var Path = PathItem.extend({
|
|||
return location != null ? this.splitAt(location) : null;
|
||||
},
|
||||
|
||||
join: function(path) {
|
||||
if (path) {
|
||||
join: function(path, tolerance) {
|
||||
var epsilon = tolerance || 0;
|
||||
if (path && path !== this) {
|
||||
var segments = path._segments,
|
||||
last1 = this.getLastSegment(),
|
||||
last2 = path.getLastSegment();
|
||||
if (!last2)
|
||||
return this;
|
||||
if (last1 && last1._point.equals(last2._point))
|
||||
if (last1 && last1._point.isClose(last2._point, epsilon))
|
||||
path.reverse();
|
||||
var first2 = path.getFirstSegment();
|
||||
if (last1 && last1._point.equals(first2._point)) {
|
||||
if (last1 && last1._point.isClose(first2._point, epsilon)) {
|
||||
last1.setHandleOut(first2._handleOut);
|
||||
this._add(segments.slice(1));
|
||||
} else {
|
||||
var first1 = this.getFirstSegment();
|
||||
if (first1 && first1._point.equals(first2._point))
|
||||
if (first1 && first1._point.isClose(first2._point, epsilon))
|
||||
path.reverse();
|
||||
last2 = path.getLastSegment();
|
||||
if (first1 && first1._point.equals(last2._point)) {
|
||||
if (first1 && first1._point.isClose(last2._point, epsilon)) {
|
||||
first1.setHandleIn(last2._handleIn);
|
||||
this._add(segments.slice(0, segments.length - 1), 0);
|
||||
} else {
|
||||
|
@ -8042,7 +8043,7 @@ var Path = PathItem.extend({
|
|||
}
|
||||
var first = this.getFirstSegment(),
|
||||
last = this.getLastSegment();
|
||||
if (first !== last && first._point.equals(last._point)) {
|
||||
if (first !== last && first._point.isClose(last._point, epsilon)) {
|
||||
first.setHandleIn(last._handleIn);
|
||||
last.remove();
|
||||
this.setClosed(true);
|
||||
|
@ -8848,10 +8849,9 @@ new function() {
|
|||
}
|
||||
},
|
||||
|
||||
closePath: function(join) {
|
||||
closePath: function(tolerance) {
|
||||
this.setClosed(true);
|
||||
if (join)
|
||||
this.join();
|
||||
this.join(this, tolerance);
|
||||
}
|
||||
};
|
||||
}, {
|
||||
|
@ -9396,8 +9396,8 @@ new function() {
|
|||
this.moveTo(last ? point.add(last._point) : point);
|
||||
},
|
||||
|
||||
closePath: function(join) {
|
||||
getCurrentPath(this, true).closePath(join);
|
||||
closePath: function(tolerance) {
|
||||
getCurrentPath(this, true).closePath(tolerance);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
12
dist/paper-core.min.js
vendored
12
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: Sat Jun 11 11:14:19 2016 +0200
|
||||
* Date: Sat Jun 11 12:43:37 2016 +0200
|
||||
*
|
||||
***
|
||||
*
|
||||
|
@ -1344,7 +1344,7 @@ var Point = Base.extend({
|
|||
isClose: function() {
|
||||
var point = Point.read(arguments),
|
||||
tolerance = Base.read(arguments);
|
||||
return this.getDistance(point) < tolerance;
|
||||
return this.getDistance(point) <= tolerance;
|
||||
},
|
||||
|
||||
isCollinear: function() {
|
||||
|
@ -7427,7 +7427,7 @@ var PathItem = Item.extend({
|
|||
}
|
||||
break;
|
||||
case 'z':
|
||||
this.closePath(true);
|
||||
this.closePath(1e-12);
|
||||
break;
|
||||
}
|
||||
previous = lower;
|
||||
|
@ -8011,25 +8011,26 @@ var Path = PathItem.extend({
|
|||
return location != null ? this.splitAt(location) : null;
|
||||
},
|
||||
|
||||
join: function(path) {
|
||||
if (path) {
|
||||
join: function(path, tolerance) {
|
||||
var epsilon = tolerance || 0;
|
||||
if (path && path !== this) {
|
||||
var segments = path._segments,
|
||||
last1 = this.getLastSegment(),
|
||||
last2 = path.getLastSegment();
|
||||
if (!last2)
|
||||
return this;
|
||||
if (last1 && last1._point.equals(last2._point))
|
||||
if (last1 && last1._point.isClose(last2._point, epsilon))
|
||||
path.reverse();
|
||||
var first2 = path.getFirstSegment();
|
||||
if (last1 && last1._point.equals(first2._point)) {
|
||||
if (last1 && last1._point.isClose(first2._point, epsilon)) {
|
||||
last1.setHandleOut(first2._handleOut);
|
||||
this._add(segments.slice(1));
|
||||
} else {
|
||||
var first1 = this.getFirstSegment();
|
||||
if (first1 && first1._point.equals(first2._point))
|
||||
if (first1 && first1._point.isClose(first2._point, epsilon))
|
||||
path.reverse();
|
||||
last2 = path.getLastSegment();
|
||||
if (first1 && first1._point.equals(last2._point)) {
|
||||
if (first1 && first1._point.isClose(last2._point, epsilon)) {
|
||||
first1.setHandleIn(last2._handleIn);
|
||||
this._add(segments.slice(0, segments.length - 1), 0);
|
||||
} else {
|
||||
|
@ -8042,7 +8043,7 @@ var Path = PathItem.extend({
|
|||
}
|
||||
var first = this.getFirstSegment(),
|
||||
last = this.getLastSegment();
|
||||
if (first !== last && first._point.equals(last._point)) {
|
||||
if (first !== last && first._point.isClose(last._point, epsilon)) {
|
||||
first.setHandleIn(last._handleIn);
|
||||
last.remove();
|
||||
this.setClosed(true);
|
||||
|
@ -8848,10 +8849,9 @@ new function() {
|
|||
}
|
||||
},
|
||||
|
||||
closePath: function(join) {
|
||||
closePath: function(tolerance) {
|
||||
this.setClosed(true);
|
||||
if (join)
|
||||
this.join();
|
||||
this.join(this, tolerance);
|
||||
}
|
||||
};
|
||||
}, {
|
||||
|
@ -9396,8 +9396,8 @@ new function() {
|
|||
this.moveTo(last ? point.add(last._point) : point);
|
||||
},
|
||||
|
||||
closePath: function(join) {
|
||||
getCurrentPath(this, true).closePath(join);
|
||||
closePath: function(tolerance) {
|
||||
getCurrentPath(this, true).closePath(tolerance);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
12
dist/paper-full.min.js
vendored
12
dist/paper-full.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue