mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Prebuilt module for commit fc72c05e69
This commit is contained in:
parent
ed0aaaf430
commit
02c3dca13a
8 changed files with 185 additions and 98 deletions
61
dist/docs/assets/js/paper.js
vendored
61
dist/docs/assets/js/paper.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Wed Jul 20 17:58:47 2016 +0200
|
* Date: Thu Jul 21 13:50:55 2016 +0200
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -9586,7 +9586,7 @@ PathItem.inject(new function() {
|
||||||
.transform(null, true, true);
|
.transform(null, true, true);
|
||||||
if (closed)
|
if (closed)
|
||||||
res.setClosed(true);
|
res.setClosed(true);
|
||||||
return closed ? res.resolveCrossings().reorient() : res;
|
return closed ? res.resolveCrossings().reorient(true) : res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createResult(ctor, paths, reduce, path1, path2) {
|
function createResult(ctor, paths, reduce, path1, path2) {
|
||||||
|
@ -10204,42 +10204,55 @@ PathItem.inject(new function() {
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|
||||||
reorient: function() {
|
reorient: function(sort) {
|
||||||
var children = this._children;
|
var children = this._children,
|
||||||
if (children && children.length > 1) {
|
length = children && children.length;
|
||||||
children = this.removeChildren().sort(function (a, b) {
|
if (length > 1) {
|
||||||
return abs(b.getArea()) - abs(a.getArea());
|
children = this.removeChildren();
|
||||||
});
|
var sorted = children.slice().sort(function (a, b) {
|
||||||
var first = children[0],
|
return abs(b.getArea()) - abs(a.getArea());
|
||||||
|
}),
|
||||||
|
first = sorted[0],
|
||||||
paths = [first],
|
paths = [first],
|
||||||
excluded = {},
|
|
||||||
isNonZero = this.getFillRule() === 'nonzero',
|
isNonZero = this.getFillRule() === 'nonzero',
|
||||||
windings = isNonZero && Base.each(children, function(path) {
|
lookup = (isNonZero || !sort) && Base.each(children,
|
||||||
this.push(path.isClockwise() ? 1 : -1);
|
function(path, i) {
|
||||||
}, []);
|
this[path._id] = {
|
||||||
for (var i = 1, l = children.length; i < l; i++) {
|
winding: path.isClockwise() ? 1 : -1,
|
||||||
var path = children[i],
|
index: i
|
||||||
point = path.getInteriorPoint(),
|
};
|
||||||
|
}, {});
|
||||||
|
for (var i1 = 1; i1 < length; i1++) {
|
||||||
|
var path1 = sorted[i1],
|
||||||
|
entry1 = lookup && lookup[path1._id],
|
||||||
|
point = path1.getInteriorPoint(),
|
||||||
isContained = false,
|
isContained = false,
|
||||||
container = null,
|
container = null,
|
||||||
exclude = false;
|
exclude = false;
|
||||||
for (var j = i - 1; j >= 0 && !container; j--) {
|
for (var i2 = i1 - 1; i2 >= 0 && !container; i2--) {
|
||||||
if (children[j].contains(point)) {
|
var path2 = sorted[i2];
|
||||||
|
if (path2.contains(point)) {
|
||||||
|
var entry2 = lookup && lookup[path2._id];
|
||||||
if (isNonZero && !isContained) {
|
if (isNonZero && !isContained) {
|
||||||
windings[i] += windings[j];
|
entry1.winding += entry2.winding;
|
||||||
if (windings[i] && windings[j]) {
|
if (entry1.winding && entry2.winding) {
|
||||||
exclude = excluded[i] = true;
|
exclude = entry1.exclude = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isContained = true;
|
isContained = true;
|
||||||
container = !excluded[j] && children[j];
|
container = !(entry2 && entry2.exclude) && path2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!exclude) {
|
if (!exclude) {
|
||||||
path.setClockwise(container ? !container.isClockwise()
|
path1.setClockwise(container
|
||||||
|
? !container.isClockwise()
|
||||||
: first.isClockwise());
|
: first.isClockwise());
|
||||||
paths.push(path);
|
if (!sort) {
|
||||||
|
paths[entry1.index] = path1;
|
||||||
|
} else {
|
||||||
|
paths.push(path1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setChildren(paths, true);
|
this.setChildren(paths, true);
|
||||||
|
|
28
dist/docs/classes/CompoundPath.html
vendored
28
dist/docs/classes/CompoundPath.html
vendored
|
@ -6678,17 +6678,26 @@ function onMouseDown(event) {
|
||||||
|
|
||||||
<div id="reorient" class="member">
|
<div id="reorient" class="member">
|
||||||
<div class="member-link">
|
<div class="member-link">
|
||||||
<a name="reorient" href="#reorient"><tt><b>reorient</b>()</tt></a>
|
<a name="reorient" href="#reorient"><tt><b>reorient</b>([sort])</tt></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-description hidden">
|
<div class="member-description hidden">
|
||||||
<div class="member-text">
|
<div class="member-text">
|
||||||
<p>Fixes the orientation of the sub-paths of a compound-path, by first ordering them according to the area they cover, and then making sure that all sub-paths are of different winding direction than the first, biggest path, except for when individual sub-paths are disjoint, i.e. islands, which are reoriented so that:</p>
|
<p>Fixes the orientation of the sub-paths of a compound-path, assuming that non of its sub-paths intersect, by reorienting sub-paths so that they are of different winding direction than their containing path, except for disjoint sub-paths, i.e. islands, which are reoriented so that they have the same winding direction as the the biggest path.</p>
|
||||||
<ul>
|
<p>Additionally, if the compound-path has the <code>'nonzero'</code> <tt>#getFillRule</tt>(), the winding of each nested path is counted, and sub-paths that do not contribute to the final result are discarded.</p>
|
||||||
<li>The holes have opposite winding direction.</li>
|
|
||||||
<li>Islands have to have the same winding direction as the first child.</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
|
<ul class="member-list">
|
||||||
|
<h4>Parameters:</h4>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<tt>sort:</tt>
|
||||||
|
<tt>Boolean</tt>
|
||||||
|
— controls if the sub-paths should be sorted according to their area from largest to smallest, or if normal sequence should be preserved
|
||||||
|
— optional, default: <tt>false</tt>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
<ul class="member-list">
|
<ul class="member-list">
|
||||||
<h4>Returns:</h4>
|
<h4>Returns:</h4>
|
||||||
|
@ -6700,6 +6709,13 @@ function onMouseDown(event) {
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<ul class="member-list">
|
||||||
|
<h4>See also:</h4>
|
||||||
|
|
||||||
|
<li><tt><tt>#getFillRule</tt>()</tt></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
28
dist/docs/classes/Path.html
vendored
28
dist/docs/classes/Path.html
vendored
|
@ -9373,17 +9373,26 @@ function onMouseDown(event) {
|
||||||
|
|
||||||
<div id="reorient" class="member">
|
<div id="reorient" class="member">
|
||||||
<div class="member-link">
|
<div class="member-link">
|
||||||
<a name="reorient" href="#reorient"><tt><b>reorient</b>()</tt></a>
|
<a name="reorient" href="#reorient"><tt><b>reorient</b>([sort])</tt></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-description hidden">
|
<div class="member-description hidden">
|
||||||
<div class="member-text">
|
<div class="member-text">
|
||||||
<p>Fixes the orientation of the sub-paths of a compound-path, by first ordering them according to the area they cover, and then making sure that all sub-paths are of different winding direction than the first, biggest path, except for when individual sub-paths are disjoint, i.e. islands, which are reoriented so that:</p>
|
<p>Fixes the orientation of the sub-paths of a compound-path, assuming that non of its sub-paths intersect, by reorienting sub-paths so that they are of different winding direction than their containing path, except for disjoint sub-paths, i.e. islands, which are reoriented so that they have the same winding direction as the the biggest path.</p>
|
||||||
<ul>
|
<p>Additionally, if the compound-path has the <code>'nonzero'</code> <tt>#getFillRule</tt>(), the winding of each nested path is counted, and sub-paths that do not contribute to the final result are discarded.</p>
|
||||||
<li>The holes have opposite winding direction.</li>
|
|
||||||
<li>Islands have to have the same winding direction as the first child.</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
|
<ul class="member-list">
|
||||||
|
<h4>Parameters:</h4>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<tt>sort:</tt>
|
||||||
|
<tt>Boolean</tt>
|
||||||
|
— controls if the sub-paths should be sorted according to their area from largest to smallest, or if normal sequence should be preserved
|
||||||
|
— optional, default: <tt>false</tt>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
<ul class="member-list">
|
<ul class="member-list">
|
||||||
<h4>Returns:</h4>
|
<h4>Returns:</h4>
|
||||||
|
@ -9395,6 +9404,13 @@ function onMouseDown(event) {
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<ul class="member-list">
|
||||||
|
<h4>See also:</h4>
|
||||||
|
|
||||||
|
<li><tt><tt>#getFillRule</tt>()</tt></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
28
dist/docs/classes/PathItem.html
vendored
28
dist/docs/classes/PathItem.html
vendored
|
@ -319,17 +319,26 @@
|
||||||
|
|
||||||
<div id="reorient" class="member">
|
<div id="reorient" class="member">
|
||||||
<div class="member-link">
|
<div class="member-link">
|
||||||
<a name="reorient" href="#reorient"><tt><b>reorient</b>()</tt></a>
|
<a name="reorient" href="#reorient"><tt><b>reorient</b>([sort])</tt></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-description hidden">
|
<div class="member-description hidden">
|
||||||
<div class="member-text">
|
<div class="member-text">
|
||||||
<p>Fixes the orientation of the sub-paths of a compound-path, by first ordering them according to the area they cover, and then making sure that all sub-paths are of different winding direction than the first, biggest path, except for when individual sub-paths are disjoint, i.e. islands, which are reoriented so that:</p>
|
<p>Fixes the orientation of the sub-paths of a compound-path, assuming that non of its sub-paths intersect, by reorienting sub-paths so that they are of different winding direction than their containing path, except for disjoint sub-paths, i.e. islands, which are reoriented so that they have the same winding direction as the the biggest path.</p>
|
||||||
<ul>
|
<p>Additionally, if the compound-path has the <code>'nonzero'</code> <tt>#getFillRule</tt>(), the winding of each nested path is counted, and sub-paths that do not contribute to the final result are discarded.</p>
|
||||||
<li>The holes have opposite winding direction.</li>
|
|
||||||
<li>Islands have to have the same winding direction as the first child.</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
|
<ul class="member-list">
|
||||||
|
<h4>Parameters:</h4>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<tt>sort:</tt>
|
||||||
|
<tt>Boolean</tt>
|
||||||
|
— controls if the sub-paths should be sorted according to their area from largest to smallest, or if normal sequence should be preserved
|
||||||
|
— optional, default: <tt>false</tt>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
<ul class="member-list">
|
<ul class="member-list">
|
||||||
<h4>Returns:</h4>
|
<h4>Returns:</h4>
|
||||||
|
@ -341,6 +350,13 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<ul class="member-list">
|
||||||
|
<h4>See also:</h4>
|
||||||
|
|
||||||
|
<li><tt><tt>#getFillRule</tt>()</tt></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
61
dist/paper-core.js
vendored
61
dist/paper-core.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Wed Jul 20 17:58:47 2016 +0200
|
* Date: Thu Jul 21 13:50:55 2016 +0200
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -9586,7 +9586,7 @@ PathItem.inject(new function() {
|
||||||
.transform(null, true, true);
|
.transform(null, true, true);
|
||||||
if (closed)
|
if (closed)
|
||||||
res.setClosed(true);
|
res.setClosed(true);
|
||||||
return closed ? res.resolveCrossings().reorient() : res;
|
return closed ? res.resolveCrossings().reorient(true) : res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createResult(ctor, paths, reduce, path1, path2) {
|
function createResult(ctor, paths, reduce, path1, path2) {
|
||||||
|
@ -10204,42 +10204,55 @@ PathItem.inject(new function() {
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|
||||||
reorient: function() {
|
reorient: function(sort) {
|
||||||
var children = this._children;
|
var children = this._children,
|
||||||
if (children && children.length > 1) {
|
length = children && children.length;
|
||||||
children = this.removeChildren().sort(function (a, b) {
|
if (length > 1) {
|
||||||
return abs(b.getArea()) - abs(a.getArea());
|
children = this.removeChildren();
|
||||||
});
|
var sorted = children.slice().sort(function (a, b) {
|
||||||
var first = children[0],
|
return abs(b.getArea()) - abs(a.getArea());
|
||||||
|
}),
|
||||||
|
first = sorted[0],
|
||||||
paths = [first],
|
paths = [first],
|
||||||
excluded = {},
|
|
||||||
isNonZero = this.getFillRule() === 'nonzero',
|
isNonZero = this.getFillRule() === 'nonzero',
|
||||||
windings = isNonZero && Base.each(children, function(path) {
|
lookup = (isNonZero || !sort) && Base.each(children,
|
||||||
this.push(path.isClockwise() ? 1 : -1);
|
function(path, i) {
|
||||||
}, []);
|
this[path._id] = {
|
||||||
for (var i = 1, l = children.length; i < l; i++) {
|
winding: path.isClockwise() ? 1 : -1,
|
||||||
var path = children[i],
|
index: i
|
||||||
point = path.getInteriorPoint(),
|
};
|
||||||
|
}, {});
|
||||||
|
for (var i1 = 1; i1 < length; i1++) {
|
||||||
|
var path1 = sorted[i1],
|
||||||
|
entry1 = lookup && lookup[path1._id],
|
||||||
|
point = path1.getInteriorPoint(),
|
||||||
isContained = false,
|
isContained = false,
|
||||||
container = null,
|
container = null,
|
||||||
exclude = false;
|
exclude = false;
|
||||||
for (var j = i - 1; j >= 0 && !container; j--) {
|
for (var i2 = i1 - 1; i2 >= 0 && !container; i2--) {
|
||||||
if (children[j].contains(point)) {
|
var path2 = sorted[i2];
|
||||||
|
if (path2.contains(point)) {
|
||||||
|
var entry2 = lookup && lookup[path2._id];
|
||||||
if (isNonZero && !isContained) {
|
if (isNonZero && !isContained) {
|
||||||
windings[i] += windings[j];
|
entry1.winding += entry2.winding;
|
||||||
if (windings[i] && windings[j]) {
|
if (entry1.winding && entry2.winding) {
|
||||||
exclude = excluded[i] = true;
|
exclude = entry1.exclude = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isContained = true;
|
isContained = true;
|
||||||
container = !excluded[j] && children[j];
|
container = !(entry2 && entry2.exclude) && path2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!exclude) {
|
if (!exclude) {
|
||||||
path.setClockwise(container ? !container.isClockwise()
|
path1.setClockwise(container
|
||||||
|
? !container.isClockwise()
|
||||||
: first.isClockwise());
|
: first.isClockwise());
|
||||||
paths.push(path);
|
if (!sort) {
|
||||||
|
paths[entry1.index] = path1;
|
||||||
|
} else {
|
||||||
|
paths.push(path1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setChildren(paths, true);
|
this.setChildren(paths, true);
|
||||||
|
|
8
dist/paper-core.min.js
vendored
8
dist/paper-core.min.js
vendored
File diff suppressed because one or more lines are too long
61
dist/paper-full.js
vendored
61
dist/paper-full.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Wed Jul 20 17:58:47 2016 +0200
|
* Date: Thu Jul 21 13:50:55 2016 +0200
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -9586,7 +9586,7 @@ PathItem.inject(new function() {
|
||||||
.transform(null, true, true);
|
.transform(null, true, true);
|
||||||
if (closed)
|
if (closed)
|
||||||
res.setClosed(true);
|
res.setClosed(true);
|
||||||
return closed ? res.resolveCrossings().reorient() : res;
|
return closed ? res.resolveCrossings().reorient(true) : res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createResult(ctor, paths, reduce, path1, path2) {
|
function createResult(ctor, paths, reduce, path1, path2) {
|
||||||
|
@ -10204,42 +10204,55 @@ PathItem.inject(new function() {
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|
||||||
reorient: function() {
|
reorient: function(sort) {
|
||||||
var children = this._children;
|
var children = this._children,
|
||||||
if (children && children.length > 1) {
|
length = children && children.length;
|
||||||
children = this.removeChildren().sort(function (a, b) {
|
if (length > 1) {
|
||||||
return abs(b.getArea()) - abs(a.getArea());
|
children = this.removeChildren();
|
||||||
});
|
var sorted = children.slice().sort(function (a, b) {
|
||||||
var first = children[0],
|
return abs(b.getArea()) - abs(a.getArea());
|
||||||
|
}),
|
||||||
|
first = sorted[0],
|
||||||
paths = [first],
|
paths = [first],
|
||||||
excluded = {},
|
|
||||||
isNonZero = this.getFillRule() === 'nonzero',
|
isNonZero = this.getFillRule() === 'nonzero',
|
||||||
windings = isNonZero && Base.each(children, function(path) {
|
lookup = (isNonZero || !sort) && Base.each(children,
|
||||||
this.push(path.isClockwise() ? 1 : -1);
|
function(path, i) {
|
||||||
}, []);
|
this[path._id] = {
|
||||||
for (var i = 1, l = children.length; i < l; i++) {
|
winding: path.isClockwise() ? 1 : -1,
|
||||||
var path = children[i],
|
index: i
|
||||||
point = path.getInteriorPoint(),
|
};
|
||||||
|
}, {});
|
||||||
|
for (var i1 = 1; i1 < length; i1++) {
|
||||||
|
var path1 = sorted[i1],
|
||||||
|
entry1 = lookup && lookup[path1._id],
|
||||||
|
point = path1.getInteriorPoint(),
|
||||||
isContained = false,
|
isContained = false,
|
||||||
container = null,
|
container = null,
|
||||||
exclude = false;
|
exclude = false;
|
||||||
for (var j = i - 1; j >= 0 && !container; j--) {
|
for (var i2 = i1 - 1; i2 >= 0 && !container; i2--) {
|
||||||
if (children[j].contains(point)) {
|
var path2 = sorted[i2];
|
||||||
|
if (path2.contains(point)) {
|
||||||
|
var entry2 = lookup && lookup[path2._id];
|
||||||
if (isNonZero && !isContained) {
|
if (isNonZero && !isContained) {
|
||||||
windings[i] += windings[j];
|
entry1.winding += entry2.winding;
|
||||||
if (windings[i] && windings[j]) {
|
if (entry1.winding && entry2.winding) {
|
||||||
exclude = excluded[i] = true;
|
exclude = entry1.exclude = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isContained = true;
|
isContained = true;
|
||||||
container = !excluded[j] && children[j];
|
container = !(entry2 && entry2.exclude) && path2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!exclude) {
|
if (!exclude) {
|
||||||
path.setClockwise(container ? !container.isClockwise()
|
path1.setClockwise(container
|
||||||
|
? !container.isClockwise()
|
||||||
: first.isClockwise());
|
: first.isClockwise());
|
||||||
paths.push(path);
|
if (!sort) {
|
||||||
|
paths[entry1.index] = path1;
|
||||||
|
} else {
|
||||||
|
paths.push(path1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setChildren(paths, true);
|
this.setChildren(paths, true);
|
||||||
|
|
8
dist/paper-full.min.js
vendored
8
dist/paper-full.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue