Prebuilt module for commit 7241edd98a

This commit is contained in:
Paper.js Bot 2016-06-13 10:01:14 +00:00
parent d87dcb4334
commit 7b481eafc9
5 changed files with 137 additions and 137 deletions

View file

@ -9,7 +9,7 @@
* *
* All rights reserved. * All rights reserved.
* *
* Date: Mon Jun 13 09:00:29 2016 +0200 * Date: Mon Jun 13 11:58:18 2016 +0200
* *
*** ***
* *
@ -9604,7 +9604,7 @@ PathItem.inject(new function() {
return results || locations; return results || locations;
} }
function getWinding(point, curves, operator, horizontal) { function getWinding(point, curves, horizontal) {
var epsilon = 2e-7, var epsilon = 2e-7,
px = point.x, px = point.x,
py = point.y, py = point.y,
@ -9633,9 +9633,9 @@ PathItem.inject(new function() {
yTop = (yTop + py) / 2; yTop = (yTop + py) / 2;
yBottom = (yBottom + py) / 2; yBottom = (yBottom + py) / 2;
if (yTop > -Infinity) if (yTop > -Infinity)
windLeft = getWinding(new Point(px, yTop), curves, operator); windLeft = getWinding(new Point(px, yTop), curves).winding;
if (yBottom < Infinity) if (yBottom < Infinity)
windRight = getWinding(new Point(px, yBottom), curves, operator); windRight = getWinding(new Point(px, yBottom), curves).winding;
} else { } else {
var xBefore = px - epsilon, var xBefore = px - epsilon,
xAfter = px + epsilon, xAfter = px + epsilon,
@ -9692,15 +9692,17 @@ PathItem.inject(new function() {
windRight = windRightOnCurve; windRight = windRightOnCurve;
} }
} }
return operator && operator.unite && !windLeft ^ !windRight ? 1 return {
: Math.max(abs(windLeft), abs(windRight)); winding: Math.max(abs(windLeft), abs(windRight)),
contour: !windLeft ^ !windRight
};
} }
function propagateWinding(segment, path1, path2, monoCurves, operator) { function propagateWinding(segment, path1, path2, monoCurves, operator) {
var chain = [], var chain = [],
start = segment, start = segment,
totalLength = 0, totalLength = 0,
windingSum = 0; winding;
do { do {
var curve = segment.getCurve(), var curve = segment.getCurve(),
length = curve.getLength(); length = curve.getLength();
@ -9708,36 +9710,34 @@ PathItem.inject(new function() {
totalLength += length; totalLength += length;
segment = segment.getNext(); segment = segment.getNext();
} while (segment && !segment._intersection && segment !== start); } while (segment && !segment._intersection && segment !== start);
for (var i = 0; i < 3; i++) { var length = totalLength / 2;
var length = totalLength * (i + 1) / 4; for (var j = 0, l = chain.length; j < l; j++) {
for (var j = 0, l = chain.length; j < l; j++) { var entry = chain[j],
var entry = chain[j], curveLength = entry.length;
curveLength = entry.length; if (length <= curveLength) {
if (length <= curveLength) { var curve = entry.curve,
var curve = entry.curve, path = curve._path,
path = curve._path, parent = path._parent,
parent = path._parent, t = curve.getTimeAt(length),
t = curve.getTimeAt(length), pt = curve.getPointAtTime(t),
pt = curve.getPointAtTime(t), hor = Math.abs(curve.getTangentAtTime(t).y)
hor = Math.abs(curve.getTangentAtTime(t).y) < 1e-7;
< 1e-7; if (parent instanceof CompoundPath)
if (parent instanceof CompoundPath) path = parent;
path = parent; winding = !(operator.subtract && path2 && (
if (!(operator.subtract && path2 path === path1 && path2._getWinding(pt, hor) ||
&& (path === path1 path === path2 && !path1._getWinding(pt, hor)))
&& path2._getWinding(pt, operator, hor) ? getWinding(pt, monoCurves, hor)
|| path === path2 : { winding: 0 };
&& !path1._getWinding(pt, operator, hor)))) { break;
windingSum += getWinding(pt, monoCurves, operator, hor);
}
break;
}
length -= curveLength;
} }
length -= curveLength;
}
for (var j = chain.length - 1; j >= 0; j--) {
var seg = chain[j].segment;
seg._winding = winding.winding;
seg._contour = winding.contour;
} }
var winding = Math.round(windingSum / 3);
for (var j = chain.length - 1; j >= 0; j--)
chain[j].segment._winding = winding;
} }
function tracePaths(segments, operator) { function tracePaths(segments, operator) {
@ -9745,8 +9745,9 @@ PathItem.inject(new function() {
start, start,
otherStart; otherStart;
function isValid(seg) { function isValid(seg, excludeContour) {
return !!(!seg._visited && (!operator || operator[seg._winding])); return !!(!seg._visited && (!operator || operator[seg._winding]
|| !excludeContour && operator.unite && seg._contour));
} }
function isStart(seg) { function isStart(seg) {
@ -9796,8 +9797,8 @@ PathItem.inject(new function() {
} }
} }
} }
if (!isValid(seg) || !seg._path._validOverlapsOnly if (!isValid(seg, true)
&& inter && seg._winding && inter._overlap) || !seg._path._validOverlapsOnly && inter && inter._overlap)
continue; continue;
start = otherStart = null; start = otherStart = null;
while (true) { while (true) {
@ -9810,7 +9811,7 @@ PathItem.inject(new function() {
if (isStart(other)) { if (isStart(other)) {
finished = true; finished = true;
seg = other; seg = other;
} else if (isValid(other)) { } else if (isValid(other, isValid(seg, true))) {
if (operator && inter._overlap if (operator && inter._overlap
&& (operator.intersect || operator.subtract)) { && (operator.intersect || operator.subtract)) {
seg._visited = true; seg._visited = true;
@ -9859,9 +9860,8 @@ PathItem.inject(new function() {
} }
return { return {
_getWinding: function(point, operator, horizontal) { _getWinding: function(point, horizontal) {
return getWinding(point, this._getMonoCurves(), operator, return getWinding(point, this._getMonoCurves(), horizontal).winding;
horizontal);
}, },
unite: function(path) { unite: function(path) {

86
dist/paper-core.js vendored
View file

@ -9,7 +9,7 @@
* *
* All rights reserved. * All rights reserved.
* *
* Date: Mon Jun 13 09:00:29 2016 +0200 * Date: Mon Jun 13 11:58:18 2016 +0200
* *
*** ***
* *
@ -9604,7 +9604,7 @@ PathItem.inject(new function() {
return results || locations; return results || locations;
} }
function getWinding(point, curves, operator, horizontal) { function getWinding(point, curves, horizontal) {
var epsilon = 2e-7, var epsilon = 2e-7,
px = point.x, px = point.x,
py = point.y, py = point.y,
@ -9633,9 +9633,9 @@ PathItem.inject(new function() {
yTop = (yTop + py) / 2; yTop = (yTop + py) / 2;
yBottom = (yBottom + py) / 2; yBottom = (yBottom + py) / 2;
if (yTop > -Infinity) if (yTop > -Infinity)
windLeft = getWinding(new Point(px, yTop), curves, operator); windLeft = getWinding(new Point(px, yTop), curves).winding;
if (yBottom < Infinity) if (yBottom < Infinity)
windRight = getWinding(new Point(px, yBottom), curves, operator); windRight = getWinding(new Point(px, yBottom), curves).winding;
} else { } else {
var xBefore = px - epsilon, var xBefore = px - epsilon,
xAfter = px + epsilon, xAfter = px + epsilon,
@ -9692,15 +9692,17 @@ PathItem.inject(new function() {
windRight = windRightOnCurve; windRight = windRightOnCurve;
} }
} }
return operator && operator.unite && !windLeft ^ !windRight ? 1 return {
: Math.max(abs(windLeft), abs(windRight)); winding: Math.max(abs(windLeft), abs(windRight)),
contour: !windLeft ^ !windRight
};
} }
function propagateWinding(segment, path1, path2, monoCurves, operator) { function propagateWinding(segment, path1, path2, monoCurves, operator) {
var chain = [], var chain = [],
start = segment, start = segment,
totalLength = 0, totalLength = 0,
windingSum = 0; winding;
do { do {
var curve = segment.getCurve(), var curve = segment.getCurve(),
length = curve.getLength(); length = curve.getLength();
@ -9708,36 +9710,34 @@ PathItem.inject(new function() {
totalLength += length; totalLength += length;
segment = segment.getNext(); segment = segment.getNext();
} while (segment && !segment._intersection && segment !== start); } while (segment && !segment._intersection && segment !== start);
for (var i = 0; i < 3; i++) { var length = totalLength / 2;
var length = totalLength * (i + 1) / 4; for (var j = 0, l = chain.length; j < l; j++) {
for (var j = 0, l = chain.length; j < l; j++) { var entry = chain[j],
var entry = chain[j], curveLength = entry.length;
curveLength = entry.length; if (length <= curveLength) {
if (length <= curveLength) { var curve = entry.curve,
var curve = entry.curve, path = curve._path,
path = curve._path, parent = path._parent,
parent = path._parent, t = curve.getTimeAt(length),
t = curve.getTimeAt(length), pt = curve.getPointAtTime(t),
pt = curve.getPointAtTime(t), hor = Math.abs(curve.getTangentAtTime(t).y)
hor = Math.abs(curve.getTangentAtTime(t).y) < 1e-7;
< 1e-7; if (parent instanceof CompoundPath)
if (parent instanceof CompoundPath) path = parent;
path = parent; winding = !(operator.subtract && path2 && (
if (!(operator.subtract && path2 path === path1 && path2._getWinding(pt, hor) ||
&& (path === path1 path === path2 && !path1._getWinding(pt, hor)))
&& path2._getWinding(pt, operator, hor) ? getWinding(pt, monoCurves, hor)
|| path === path2 : { winding: 0 };
&& !path1._getWinding(pt, operator, hor)))) { break;
windingSum += getWinding(pt, monoCurves, operator, hor);
}
break;
}
length -= curveLength;
} }
length -= curveLength;
}
for (var j = chain.length - 1; j >= 0; j--) {
var seg = chain[j].segment;
seg._winding = winding.winding;
seg._contour = winding.contour;
} }
var winding = Math.round(windingSum / 3);
for (var j = chain.length - 1; j >= 0; j--)
chain[j].segment._winding = winding;
} }
function tracePaths(segments, operator) { function tracePaths(segments, operator) {
@ -9745,8 +9745,9 @@ PathItem.inject(new function() {
start, start,
otherStart; otherStart;
function isValid(seg) { function isValid(seg, excludeContour) {
return !!(!seg._visited && (!operator || operator[seg._winding])); return !!(!seg._visited && (!operator || operator[seg._winding]
|| !excludeContour && operator.unite && seg._contour));
} }
function isStart(seg) { function isStart(seg) {
@ -9796,8 +9797,8 @@ PathItem.inject(new function() {
} }
} }
} }
if (!isValid(seg) || !seg._path._validOverlapsOnly if (!isValid(seg, true)
&& inter && seg._winding && inter._overlap) || !seg._path._validOverlapsOnly && inter && inter._overlap)
continue; continue;
start = otherStart = null; start = otherStart = null;
while (true) { while (true) {
@ -9810,7 +9811,7 @@ PathItem.inject(new function() {
if (isStart(other)) { if (isStart(other)) {
finished = true; finished = true;
seg = other; seg = other;
} else if (isValid(other)) { } else if (isValid(other, isValid(seg, true))) {
if (operator && inter._overlap if (operator && inter._overlap
&& (operator.intersect || operator.subtract)) { && (operator.intersect || operator.subtract)) {
seg._visited = true; seg._visited = true;
@ -9859,9 +9860,8 @@ PathItem.inject(new function() {
} }
return { return {
_getWinding: function(point, operator, horizontal) { _getWinding: function(point, horizontal) {
return getWinding(point, this._getMonoCurves(), operator, return getWinding(point, this._getMonoCurves(), horizontal).winding;
horizontal);
}, },
unite: function(path) { unite: function(path) {

File diff suppressed because one or more lines are too long

86
dist/paper-full.js vendored
View file

@ -9,7 +9,7 @@
* *
* All rights reserved. * All rights reserved.
* *
* Date: Mon Jun 13 09:00:29 2016 +0200 * Date: Mon Jun 13 11:58:18 2016 +0200
* *
*** ***
* *
@ -9604,7 +9604,7 @@ PathItem.inject(new function() {
return results || locations; return results || locations;
} }
function getWinding(point, curves, operator, horizontal) { function getWinding(point, curves, horizontal) {
var epsilon = 2e-7, var epsilon = 2e-7,
px = point.x, px = point.x,
py = point.y, py = point.y,
@ -9633,9 +9633,9 @@ PathItem.inject(new function() {
yTop = (yTop + py) / 2; yTop = (yTop + py) / 2;
yBottom = (yBottom + py) / 2; yBottom = (yBottom + py) / 2;
if (yTop > -Infinity) if (yTop > -Infinity)
windLeft = getWinding(new Point(px, yTop), curves, operator); windLeft = getWinding(new Point(px, yTop), curves).winding;
if (yBottom < Infinity) if (yBottom < Infinity)
windRight = getWinding(new Point(px, yBottom), curves, operator); windRight = getWinding(new Point(px, yBottom), curves).winding;
} else { } else {
var xBefore = px - epsilon, var xBefore = px - epsilon,
xAfter = px + epsilon, xAfter = px + epsilon,
@ -9692,15 +9692,17 @@ PathItem.inject(new function() {
windRight = windRightOnCurve; windRight = windRightOnCurve;
} }
} }
return operator && operator.unite && !windLeft ^ !windRight ? 1 return {
: Math.max(abs(windLeft), abs(windRight)); winding: Math.max(abs(windLeft), abs(windRight)),
contour: !windLeft ^ !windRight
};
} }
function propagateWinding(segment, path1, path2, monoCurves, operator) { function propagateWinding(segment, path1, path2, monoCurves, operator) {
var chain = [], var chain = [],
start = segment, start = segment,
totalLength = 0, totalLength = 0,
windingSum = 0; winding;
do { do {
var curve = segment.getCurve(), var curve = segment.getCurve(),
length = curve.getLength(); length = curve.getLength();
@ -9708,36 +9710,34 @@ PathItem.inject(new function() {
totalLength += length; totalLength += length;
segment = segment.getNext(); segment = segment.getNext();
} while (segment && !segment._intersection && segment !== start); } while (segment && !segment._intersection && segment !== start);
for (var i = 0; i < 3; i++) { var length = totalLength / 2;
var length = totalLength * (i + 1) / 4; for (var j = 0, l = chain.length; j < l; j++) {
for (var j = 0, l = chain.length; j < l; j++) { var entry = chain[j],
var entry = chain[j], curveLength = entry.length;
curveLength = entry.length; if (length <= curveLength) {
if (length <= curveLength) { var curve = entry.curve,
var curve = entry.curve, path = curve._path,
path = curve._path, parent = path._parent,
parent = path._parent, t = curve.getTimeAt(length),
t = curve.getTimeAt(length), pt = curve.getPointAtTime(t),
pt = curve.getPointAtTime(t), hor = Math.abs(curve.getTangentAtTime(t).y)
hor = Math.abs(curve.getTangentAtTime(t).y) < 1e-7;
< 1e-7; if (parent instanceof CompoundPath)
if (parent instanceof CompoundPath) path = parent;
path = parent; winding = !(operator.subtract && path2 && (
if (!(operator.subtract && path2 path === path1 && path2._getWinding(pt, hor) ||
&& (path === path1 path === path2 && !path1._getWinding(pt, hor)))
&& path2._getWinding(pt, operator, hor) ? getWinding(pt, monoCurves, hor)
|| path === path2 : { winding: 0 };
&& !path1._getWinding(pt, operator, hor)))) { break;
windingSum += getWinding(pt, monoCurves, operator, hor);
}
break;
}
length -= curveLength;
} }
length -= curveLength;
}
for (var j = chain.length - 1; j >= 0; j--) {
var seg = chain[j].segment;
seg._winding = winding.winding;
seg._contour = winding.contour;
} }
var winding = Math.round(windingSum / 3);
for (var j = chain.length - 1; j >= 0; j--)
chain[j].segment._winding = winding;
} }
function tracePaths(segments, operator) { function tracePaths(segments, operator) {
@ -9745,8 +9745,9 @@ PathItem.inject(new function() {
start, start,
otherStart; otherStart;
function isValid(seg) { function isValid(seg, excludeContour) {
return !!(!seg._visited && (!operator || operator[seg._winding])); return !!(!seg._visited && (!operator || operator[seg._winding]
|| !excludeContour && operator.unite && seg._contour));
} }
function isStart(seg) { function isStart(seg) {
@ -9796,8 +9797,8 @@ PathItem.inject(new function() {
} }
} }
} }
if (!isValid(seg) || !seg._path._validOverlapsOnly if (!isValid(seg, true)
&& inter && seg._winding && inter._overlap) || !seg._path._validOverlapsOnly && inter && inter._overlap)
continue; continue;
start = otherStart = null; start = otherStart = null;
while (true) { while (true) {
@ -9810,7 +9811,7 @@ PathItem.inject(new function() {
if (isStart(other)) { if (isStart(other)) {
finished = true; finished = true;
seg = other; seg = other;
} else if (isValid(other)) { } else if (isValid(other, isValid(seg, true))) {
if (operator && inter._overlap if (operator && inter._overlap
&& (operator.intersect || operator.subtract)) { && (operator.intersect || operator.subtract)) {
seg._visited = true; seg._visited = true;
@ -9859,9 +9860,8 @@ PathItem.inject(new function() {
} }
return { return {
_getWinding: function(point, operator, horizontal) { _getWinding: function(point, horizontal) {
return getWinding(point, this._getMonoCurves(), operator, return getWinding(point, this._getMonoCurves(), horizontal).winding;
horizontal);
}, },
unite: function(path) { unite: function(path) {

File diff suppressed because one or more lines are too long