mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Rename start/endConnected to excludeStart/End.
This commit is contained in:
parent
a7fc04a9b1
commit
928ad48937
2 changed files with 12 additions and 12 deletions
|
@ -1385,14 +1385,14 @@ new function() { // Scope for intersection using bezier fat-line clipping
|
||||||
overlap) {
|
overlap) {
|
||||||
// Do not exclude connecting points between two curves if they were part
|
// Do not exclude connecting points between two curves if they were part
|
||||||
// of overlap checks. They could be self-overlapping.
|
// of overlap checks. They could be self-overlapping.
|
||||||
var excludeStart = !overlap && param.startConnected,
|
var excludeStart = !overlap && param.excludeStart,
|
||||||
excludeEnd = !overlap && param.endConnected,
|
excludeEnd = !overlap && param.excludeEnd,
|
||||||
tMin = /*#=*/Numerical.CURVETIME_EPSILON,
|
tMin = /*#=*/Numerical.CURVETIME_EPSILON,
|
||||||
tMax = 1 - tMin;
|
tMax = 1 - tMin;
|
||||||
if (t1 == null)
|
if (t1 == null)
|
||||||
t1 = Curve.getParameterOf(v1, p1);
|
t1 = Curve.getParameterOf(v1, p1);
|
||||||
// Check t1 and t2 against correct bounds, based on start-/endConnected:
|
// Check t1 and t2 against correct bounds, based on excludeStart/End:
|
||||||
// - startConnected means the start of c1 connects to the end of c2
|
// - excludeStart means the start of c1 connects to the end of c2
|
||||||
// - endConneted means the end of c1 connects to the start of c2
|
// - endConneted means the end of c1 connects to the start of c2
|
||||||
// - If either c1 or c2 are at the end of the path, exclude their end,
|
// - If either c1 or c2 are at the end of the path, exclude their end,
|
||||||
// which connects back to the beginning, but only if it's not part of
|
// which connects back to the beginning, but only if it's not part of
|
||||||
|
@ -1665,7 +1665,7 @@ new function() { // Scope for intersection using bezier fat-line clipping
|
||||||
// If the two curves are connected and the 2nd is very short,
|
// If the two curves are connected and the 2nd is very short,
|
||||||
// (l < Numerical.GEOMETRIC_EPSILON), we need to filter out an
|
// (l < Numerical.GEOMETRIC_EPSILON), we need to filter out an
|
||||||
// invalid intersection at the beginning of this short curve.
|
// invalid intersection at the beginning of this short curve.
|
||||||
if (!param.endConnected || t2 > Numerical.CURVETIME_EPSILON) {
|
if (!param.excludeEnd || t2 > Numerical.CURVETIME_EPSILON) {
|
||||||
addLocation(locations, param,
|
addLocation(locations, param,
|
||||||
v1, c1, t1, flip ? pl : pc,
|
v1, c1, t1, flip ? pl : pc,
|
||||||
v2, c2, t2, flip ? pc : pl);
|
v2, c2, t2, flip ? pc : pl);
|
||||||
|
@ -1758,9 +1758,9 @@ new function() { // Scope for intersection using bezier fat-line clipping
|
||||||
c2p2 = new Point(c2p2x, c2p2y);
|
c2p2 = new Point(c2p2x, c2p2y);
|
||||||
if (c1p1.isClose(c2p1, epsilon))
|
if (c1p1.isClose(c2p1, epsilon))
|
||||||
addLocation(locations, param, v1, c1, 0, c1p1, v2, c2, 0, c2p1);
|
addLocation(locations, param, v1, c1, 0, c1p1, v2, c2, 0, c2p1);
|
||||||
if (!param.startConnected && c1p1.isClose(c2p2, epsilon))
|
if (!param.excludeStart && c1p1.isClose(c2p2, epsilon))
|
||||||
addLocation(locations, param, v1, c1, 0, c1p1, v2, c2, 1, c2p2);
|
addLocation(locations, param, v1, c1, 0, c1p1, v2, c2, 1, c2p2);
|
||||||
if (!param.endConnected && c1p2.isClose(c2p1, epsilon))
|
if (!param.excludeEnd && c1p2.isClose(c2p1, epsilon))
|
||||||
addLocation(locations, param, v1, c1, 1, c1p2, v2, c2, 0, c2p1);
|
addLocation(locations, param, v1, c1, 1, c1p2, v2, c2, 0, c2p1);
|
||||||
if (c1p2.isClose(c2p2, epsilon))
|
if (c1p2.isClose(c2p2, epsilon))
|
||||||
addLocation(locations, param, v1, c1, 1, c1p2, v2, c2, 1, c2p2);
|
addLocation(locations, param, v1, c1, 1, c1p2, v2, c2, 1, c2p2);
|
||||||
|
@ -1832,8 +1832,8 @@ new function() { // Scope for intersection using bezier fat-line clipping
|
||||||
// Divide the curve in two and then apply the normal curve
|
// Divide the curve in two and then apply the normal curve
|
||||||
// intersection code.
|
// intersection code.
|
||||||
var parts = Curve.subdivide(v1, tSplit);
|
var parts = Curve.subdivide(v1, tSplit);
|
||||||
// After splitting, the end is always connected:
|
// After splitting, the end is always connected, so exclude:
|
||||||
param.endConnected = true;
|
param.excludeEnd = true;
|
||||||
// Since the curve was split above, we need to adjust the
|
// Since the curve was split above, we need to adjust the
|
||||||
// parameters for both locations.
|
// parameters for both locations.
|
||||||
param.renormalize = function(t1, t2) {
|
param.renormalize = function(t1, t2) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
Curve._getSelfIntersection(values1, curve1, locations, {
|
Curve._getSelfIntersection(values1, curve1, locations, {
|
||||||
include: include,
|
include: include,
|
||||||
// Only possible if there is only one closed curve:
|
// Only possible if there is only one closed curve:
|
||||||
startConnected: length1 === 1 &&
|
excludeStart: length1 === 1 &&
|
||||||
curve1.getPoint1().equals(curve1.getPoint2())
|
curve1.getPoint1().equals(curve1.getPoint2())
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,8 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
// Do not compare indices here to determine connection,
|
// Do not compare indices here to determine connection,
|
||||||
// since one array of curves can contain curves from
|
// since one array of curves can contain curves from
|
||||||
// separate sup-paths of a compound path.
|
// separate sup-paths of a compound path.
|
||||||
startConnected: self && curve1.getPrevious() === curve2,
|
excludeStart: self && curve1.getPrevious() === curve2,
|
||||||
endConnected: self && curve1.getNext() === curve2
|
excludeEnd: self && curve1.getNext() === curve2
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue