mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -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.
|
||||
*
|
||||
* 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);
|
||||
if (closed)
|
||||
res.setClosed(true);
|
||||
return closed ? res.resolveCrossings().reorient() : res;
|
||||
return closed ? res.resolveCrossings().reorient(true) : res;
|
||||
}
|
||||
|
||||
function createResult(ctor, paths, reduce, path1, path2) {
|
||||
|
@ -10204,42 +10204,55 @@ PathItem.inject(new function() {
|
|||
return item;
|
||||
},
|
||||
|
||||
reorient: function() {
|
||||
var children = this._children;
|
||||
if (children && children.length > 1) {
|
||||
children = this.removeChildren().sort(function (a, b) {
|
||||
return abs(b.getArea()) - abs(a.getArea());
|
||||
});
|
||||
var first = children[0],
|
||||
reorient: function(sort) {
|
||||
var children = this._children,
|
||||
length = children && children.length;
|
||||
if (length > 1) {
|
||||
children = this.removeChildren();
|
||||
var sorted = children.slice().sort(function (a, b) {
|
||||
return abs(b.getArea()) - abs(a.getArea());
|
||||
}),
|
||||
first = sorted[0],
|
||||
paths = [first],
|
||||
excluded = {},
|
||||
isNonZero = this.getFillRule() === 'nonzero',
|
||||
windings = isNonZero && Base.each(children, function(path) {
|
||||
this.push(path.isClockwise() ? 1 : -1);
|
||||
}, []);
|
||||
for (var i = 1, l = children.length; i < l; i++) {
|
||||
var path = children[i],
|
||||
point = path.getInteriorPoint(),
|
||||
lookup = (isNonZero || !sort) && Base.each(children,
|
||||
function(path, i) {
|
||||
this[path._id] = {
|
||||
winding: path.isClockwise() ? 1 : -1,
|
||||
index: i
|
||||
};
|
||||
}, {});
|
||||
for (var i1 = 1; i1 < length; i1++) {
|
||||
var path1 = sorted[i1],
|
||||
entry1 = lookup && lookup[path1._id],
|
||||
point = path1.getInteriorPoint(),
|
||||
isContained = false,
|
||||
container = null,
|
||||
exclude = false;
|
||||
for (var j = i - 1; j >= 0 && !container; j--) {
|
||||
if (children[j].contains(point)) {
|
||||
for (var i2 = i1 - 1; i2 >= 0 && !container; i2--) {
|
||||
var path2 = sorted[i2];
|
||||
if (path2.contains(point)) {
|
||||
var entry2 = lookup && lookup[path2._id];
|
||||
if (isNonZero && !isContained) {
|
||||
windings[i] += windings[j];
|
||||
if (windings[i] && windings[j]) {
|
||||
exclude = excluded[i] = true;
|
||||
entry1.winding += entry2.winding;
|
||||
if (entry1.winding && entry2.winding) {
|
||||
exclude = entry1.exclude = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
isContained = true;
|
||||
container = !excluded[j] && children[j];
|
||||
container = !(entry2 && entry2.exclude) && path2;
|
||||
}
|
||||
}
|
||||
if (!exclude) {
|
||||
path.setClockwise(container ? !container.isClockwise()
|
||||
path1.setClockwise(container
|
||||
? !container.isClockwise()
|
||||
: first.isClockwise());
|
||||
paths.push(path);
|
||||
if (!sort) {
|
||||
paths[entry1.index] = path1;
|
||||
} else {
|
||||
paths.push(path1);
|
||||
}
|
||||
}
|
||||
}
|
||||
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 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 class="member-description hidden">
|
||||
<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>
|
||||
<ul>
|
||||
<li>The holes have opposite winding direction.</li>
|
||||
<li>Islands have to have the same winding direction as the first child.</li>
|
||||
</ul>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
|
||||
<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">
|
||||
<h4>Returns:</h4>
|
||||
|
@ -6700,6 +6709,13 @@ function onMouseDown(event) {
|
|||
</ul>
|
||||
|
||||
|
||||
<ul class="member-list">
|
||||
<h4>See also:</h4>
|
||||
|
||||
<li><tt><tt>#getFillRule</tt>()</tt></li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</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 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 class="member-description hidden">
|
||||
<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>
|
||||
<ul>
|
||||
<li>The holes have opposite winding direction.</li>
|
||||
<li>Islands have to have the same winding direction as the first child.</li>
|
||||
</ul>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
|
||||
<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">
|
||||
<h4>Returns:</h4>
|
||||
|
@ -9395,6 +9404,13 @@ function onMouseDown(event) {
|
|||
</ul>
|
||||
|
||||
|
||||
<ul class="member-list">
|
||||
<h4>See also:</h4>
|
||||
|
||||
<li><tt><tt>#getFillRule</tt>()</tt></li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</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 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 class="member-description hidden">
|
||||
<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>
|
||||
<ul>
|
||||
<li>The holes have opposite winding direction.</li>
|
||||
<li>Islands have to have the same winding direction as the first child.</li>
|
||||
</ul>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
|
||||
<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">
|
||||
<h4>Returns:</h4>
|
||||
|
@ -341,6 +350,13 @@
|
|||
</ul>
|
||||
|
||||
|
||||
<ul class="member-list">
|
||||
<h4>See also:</h4>
|
||||
|
||||
<li><tt><tt>#getFillRule</tt>()</tt></li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
61
dist/paper-core.js
vendored
61
dist/paper-core.js
vendored
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* 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);
|
||||
if (closed)
|
||||
res.setClosed(true);
|
||||
return closed ? res.resolveCrossings().reorient() : res;
|
||||
return closed ? res.resolveCrossings().reorient(true) : res;
|
||||
}
|
||||
|
||||
function createResult(ctor, paths, reduce, path1, path2) {
|
||||
|
@ -10204,42 +10204,55 @@ PathItem.inject(new function() {
|
|||
return item;
|
||||
},
|
||||
|
||||
reorient: function() {
|
||||
var children = this._children;
|
||||
if (children && children.length > 1) {
|
||||
children = this.removeChildren().sort(function (a, b) {
|
||||
return abs(b.getArea()) - abs(a.getArea());
|
||||
});
|
||||
var first = children[0],
|
||||
reorient: function(sort) {
|
||||
var children = this._children,
|
||||
length = children && children.length;
|
||||
if (length > 1) {
|
||||
children = this.removeChildren();
|
||||
var sorted = children.slice().sort(function (a, b) {
|
||||
return abs(b.getArea()) - abs(a.getArea());
|
||||
}),
|
||||
first = sorted[0],
|
||||
paths = [first],
|
||||
excluded = {},
|
||||
isNonZero = this.getFillRule() === 'nonzero',
|
||||
windings = isNonZero && Base.each(children, function(path) {
|
||||
this.push(path.isClockwise() ? 1 : -1);
|
||||
}, []);
|
||||
for (var i = 1, l = children.length; i < l; i++) {
|
||||
var path = children[i],
|
||||
point = path.getInteriorPoint(),
|
||||
lookup = (isNonZero || !sort) && Base.each(children,
|
||||
function(path, i) {
|
||||
this[path._id] = {
|
||||
winding: path.isClockwise() ? 1 : -1,
|
||||
index: i
|
||||
};
|
||||
}, {});
|
||||
for (var i1 = 1; i1 < length; i1++) {
|
||||
var path1 = sorted[i1],
|
||||
entry1 = lookup && lookup[path1._id],
|
||||
point = path1.getInteriorPoint(),
|
||||
isContained = false,
|
||||
container = null,
|
||||
exclude = false;
|
||||
for (var j = i - 1; j >= 0 && !container; j--) {
|
||||
if (children[j].contains(point)) {
|
||||
for (var i2 = i1 - 1; i2 >= 0 && !container; i2--) {
|
||||
var path2 = sorted[i2];
|
||||
if (path2.contains(point)) {
|
||||
var entry2 = lookup && lookup[path2._id];
|
||||
if (isNonZero && !isContained) {
|
||||
windings[i] += windings[j];
|
||||
if (windings[i] && windings[j]) {
|
||||
exclude = excluded[i] = true;
|
||||
entry1.winding += entry2.winding;
|
||||
if (entry1.winding && entry2.winding) {
|
||||
exclude = entry1.exclude = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
isContained = true;
|
||||
container = !excluded[j] && children[j];
|
||||
container = !(entry2 && entry2.exclude) && path2;
|
||||
}
|
||||
}
|
||||
if (!exclude) {
|
||||
path.setClockwise(container ? !container.isClockwise()
|
||||
path1.setClockwise(container
|
||||
? !container.isClockwise()
|
||||
: first.isClockwise());
|
||||
paths.push(path);
|
||||
if (!sort) {
|
||||
paths[entry1.index] = path1;
|
||||
} else {
|
||||
paths.push(path1);
|
||||
}
|
||||
}
|
||||
}
|
||||
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.
|
||||
*
|
||||
* 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);
|
||||
if (closed)
|
||||
res.setClosed(true);
|
||||
return closed ? res.resolveCrossings().reorient() : res;
|
||||
return closed ? res.resolveCrossings().reorient(true) : res;
|
||||
}
|
||||
|
||||
function createResult(ctor, paths, reduce, path1, path2) {
|
||||
|
@ -10204,42 +10204,55 @@ PathItem.inject(new function() {
|
|||
return item;
|
||||
},
|
||||
|
||||
reorient: function() {
|
||||
var children = this._children;
|
||||
if (children && children.length > 1) {
|
||||
children = this.removeChildren().sort(function (a, b) {
|
||||
return abs(b.getArea()) - abs(a.getArea());
|
||||
});
|
||||
var first = children[0],
|
||||
reorient: function(sort) {
|
||||
var children = this._children,
|
||||
length = children && children.length;
|
||||
if (length > 1) {
|
||||
children = this.removeChildren();
|
||||
var sorted = children.slice().sort(function (a, b) {
|
||||
return abs(b.getArea()) - abs(a.getArea());
|
||||
}),
|
||||
first = sorted[0],
|
||||
paths = [first],
|
||||
excluded = {},
|
||||
isNonZero = this.getFillRule() === 'nonzero',
|
||||
windings = isNonZero && Base.each(children, function(path) {
|
||||
this.push(path.isClockwise() ? 1 : -1);
|
||||
}, []);
|
||||
for (var i = 1, l = children.length; i < l; i++) {
|
||||
var path = children[i],
|
||||
point = path.getInteriorPoint(),
|
||||
lookup = (isNonZero || !sort) && Base.each(children,
|
||||
function(path, i) {
|
||||
this[path._id] = {
|
||||
winding: path.isClockwise() ? 1 : -1,
|
||||
index: i
|
||||
};
|
||||
}, {});
|
||||
for (var i1 = 1; i1 < length; i1++) {
|
||||
var path1 = sorted[i1],
|
||||
entry1 = lookup && lookup[path1._id],
|
||||
point = path1.getInteriorPoint(),
|
||||
isContained = false,
|
||||
container = null,
|
||||
exclude = false;
|
||||
for (var j = i - 1; j >= 0 && !container; j--) {
|
||||
if (children[j].contains(point)) {
|
||||
for (var i2 = i1 - 1; i2 >= 0 && !container; i2--) {
|
||||
var path2 = sorted[i2];
|
||||
if (path2.contains(point)) {
|
||||
var entry2 = lookup && lookup[path2._id];
|
||||
if (isNonZero && !isContained) {
|
||||
windings[i] += windings[j];
|
||||
if (windings[i] && windings[j]) {
|
||||
exclude = excluded[i] = true;
|
||||
entry1.winding += entry2.winding;
|
||||
if (entry1.winding && entry2.winding) {
|
||||
exclude = entry1.exclude = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
isContained = true;
|
||||
container = !excluded[j] && children[j];
|
||||
container = !(entry2 && entry2.exclude) && path2;
|
||||
}
|
||||
}
|
||||
if (!exclude) {
|
||||
path.setClockwise(container ? !container.isClockwise()
|
||||
path1.setClockwise(container
|
||||
? !container.isClockwise()
|
||||
: first.isClockwise());
|
||||
paths.push(path);
|
||||
if (!sort) {
|
||||
paths[entry1.index] = path1;
|
||||
} else {
|
||||
paths.push(path1);
|
||||
}
|
||||
}
|
||||
}
|
||||
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