Prebuilt module for commit 7d3d7351ab

This commit is contained in:
Paper.js Bot 2016-12-31 00:10:49 +00:00
parent 9d0fcd663a
commit b74abe9d11
7 changed files with 143 additions and 53 deletions

View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Sat Dec 31 00:34:37 2016 +0100
* Date: Sat Dec 31 01:07:50 2016 +0100
*
***
*
@ -8148,9 +8148,19 @@ var Path = PathItem.extend({
this.setSelected(true);
},
divideAt: function(location) {
var loc = this.getLocationAt(location);
ret = null;
if (loc) {
var curve = loc.getCurve().divideAt(loc.getCurveOffset());
if (curve)
ret = curve._segment1;
}
return ret;
},
splitAt: function(location) {
var loc = typeof location === 'number'
? this.getLocationAt(location) : location,
var loc = this.getLocationAt(location),
index = loc && loc.index,
time = loc && loc.time,
tMin = 4e-7,
@ -8693,18 +8703,23 @@ var Path = PathItem.extend({
},
getLocationAt: function(offset) {
var curves = this.getCurves(),
length = 0;
for (var i = 0, l = curves.length; i < l; i++) {
var start = length,
curve = curves[i];
length += curve.getLength();
if (length > offset) {
return curve.getLocationAt(offset - start);
if (typeof offset === 'number') {
var curves = this.getCurves(),
length = 0;
for (var i = 0, l = curves.length; i < l; i++) {
var start = length,
curve = curves[i];
length += curve.getLength();
if (length > offset) {
return curve.getLocationAt(offset - start);
}
}
if (curves.length > 0 && offset <= this.getLength()) {
return new CurveLocation(curves[curves.length - 1], 1);
}
} else if (offset && offset.getPath && offset.getPath() === this) {
return offset;
}
if (curves.length > 0 && offset <= this.getLength())
return new CurveLocation(curves[curves.length - 1], 1);
return null;
}

View file

@ -860,7 +860,7 @@
</div>
<div class="member-description hidden">
<div class="member-text">
<p>Divides the curve into two curves at the given offset. The curve itself is modified and becomes the first part, the second part is returned as a new curve. If the modified curve belongs to a path item, the second part is also added to the path.</p>
<p>Divides the curve into two curves at the given offset or location. The curve itself is modified and becomes the first part, the second part is returned as a new curve. If the curve belongs to a path item, a new segment is inserted into the path at the given location, and the second part becomes a part of the path as well.</p>
<ul class="member-list">
@ -880,7 +880,7 @@
<h4>Returns:</h4>
<li>
<tt><a href="../classes/Curve.html"><tt>Curve</tt></a></tt>&nbsp;&mdash;&nbsp;the second part of the divided curve, if the offset is within the valid range, {code null} otherwise.
<tt><a href="../classes/Curve.html"><tt>Curve</tt></a></tt>&nbsp;&mdash;&nbsp;the second part of the divided curve if the location is valid, {code null} otherwise
</li>
</ul>

View file

@ -2230,6 +2230,51 @@ path.selected = true;
</div>
</div>
</div>
<div id="divideat-location" class="member">
<div class="member-link">
<a name="divideat-location" href="#divideat-location"><tt><b>divideAt</b>(location)</tt></a>
</div>
<div class="member-description hidden">
<div class="member-text">
<p>Divides the path on the curve at the given offset or location into two curves, by inserting a new segment at the given location.</p>
<ul class="member-list">
<h4>Parameters:</h4>
<li>
<tt>location:</tt>
<tt>Number</tt><a href="../classes/CurveLocation.html"><tt>CurveLocation</tt></a>
&mdash;&nbsp;the offset or location on the path at which to divide the existing curve by inserting a new segment
</li>
</ul>
<ul class="member-list">
<h4>Returns:</h4>
<li>
<tt><a href="../classes/Segment.html"><tt>Segment</tt></a></tt>&nbsp;&mdash;&nbsp;the newly inserted segment if the location is valid, {code null} otherwise
</li>
</ul>
<ul class="member-list">
<h4>See also:</h4>
<li><tt><a href="../classes/Curve.html#divideat-location"><tt>curve.divideAt(location)</tt></a></tt></li>
</ul>
</div>
</div>
</div>

41
dist/paper-core.js vendored
View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Sat Dec 31 00:34:37 2016 +0100
* Date: Sat Dec 31 01:07:50 2016 +0100
*
***
*
@ -8148,9 +8148,19 @@ var Path = PathItem.extend({
this.setSelected(true);
},
divideAt: function(location) {
var loc = this.getLocationAt(location);
ret = null;
if (loc) {
var curve = loc.getCurve().divideAt(loc.getCurveOffset());
if (curve)
ret = curve._segment1;
}
return ret;
},
splitAt: function(location) {
var loc = typeof location === 'number'
? this.getLocationAt(location) : location,
var loc = this.getLocationAt(location),
index = loc && loc.index,
time = loc && loc.time,
tMin = 4e-7,
@ -8693,18 +8703,23 @@ var Path = PathItem.extend({
},
getLocationAt: function(offset) {
var curves = this.getCurves(),
length = 0;
for (var i = 0, l = curves.length; i < l; i++) {
var start = length,
curve = curves[i];
length += curve.getLength();
if (length > offset) {
return curve.getLocationAt(offset - start);
if (typeof offset === 'number') {
var curves = this.getCurves(),
length = 0;
for (var i = 0, l = curves.length; i < l; i++) {
var start = length,
curve = curves[i];
length += curve.getLength();
if (length > offset) {
return curve.getLocationAt(offset - start);
}
}
if (curves.length > 0 && offset <= this.getLength()) {
return new CurveLocation(curves[curves.length - 1], 1);
}
} else if (offset && offset.getPath && offset.getPath() === this) {
return offset;
}
if (curves.length > 0 && offset <= this.getLength())
return new CurveLocation(curves[curves.length - 1], 1);
return null;
}

File diff suppressed because one or more lines are too long

41
dist/paper-full.js vendored
View file

@ -9,7 +9,7 @@
*
* All rights reserved.
*
* Date: Sat Dec 31 00:34:37 2016 +0100
* Date: Sat Dec 31 01:07:50 2016 +0100
*
***
*
@ -8148,9 +8148,19 @@ var Path = PathItem.extend({
this.setSelected(true);
},
divideAt: function(location) {
var loc = this.getLocationAt(location);
ret = null;
if (loc) {
var curve = loc.getCurve().divideAt(loc.getCurveOffset());
if (curve)
ret = curve._segment1;
}
return ret;
},
splitAt: function(location) {
var loc = typeof location === 'number'
? this.getLocationAt(location) : location,
var loc = this.getLocationAt(location),
index = loc && loc.index,
time = loc && loc.time,
tMin = 4e-7,
@ -8693,18 +8703,23 @@ var Path = PathItem.extend({
},
getLocationAt: function(offset) {
var curves = this.getCurves(),
length = 0;
for (var i = 0, l = curves.length; i < l; i++) {
var start = length,
curve = curves[i];
length += curve.getLength();
if (length > offset) {
return curve.getLocationAt(offset - start);
if (typeof offset === 'number') {
var curves = this.getCurves(),
length = 0;
for (var i = 0, l = curves.length; i < l; i++) {
var start = length,
curve = curves[i];
length += curve.getLength();
if (length > offset) {
return curve.getLocationAt(offset - start);
}
}
if (curves.length > 0 && offset <= this.getLength()) {
return new CurveLocation(curves[curves.length - 1], 1);
}
} else if (offset && offset.getPath && offset.getPath() === this) {
return offset;
}
if (curves.length > 0 && offset <= this.getLength())
return new CurveLocation(curves[curves.length - 1], 1);
return null;
}

File diff suppressed because one or more lines are too long