mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Sort sub-paths before 'reorienting' during boolean calculations
This commit is contained in:
parent
551b49805c
commit
274f1a4b55
1 changed files with 8 additions and 2 deletions
|
@ -76,11 +76,17 @@ PathItem.inject(new function() {
|
||||||
*/
|
*/
|
||||||
function reorientPath(path) {
|
function reorientPath(path) {
|
||||||
if (path instanceof CompoundPath) {
|
if (path instanceof CompoundPath) {
|
||||||
var children = path._children,
|
var children = path.removeChildren(),
|
||||||
length = children.length,
|
length = children.length,
|
||||||
bounds = new Array(length),
|
bounds = new Array(length),
|
||||||
counters = new Array(length),
|
counters = new Array(length),
|
||||||
clockwise = children[0].isClockwise();
|
clockwise;
|
||||||
|
children.sort(function(a, b){
|
||||||
|
var b1 = a.getBounds(), b2 = b.getBounds();
|
||||||
|
return b1._width * b1._height < b2._width * b2._height;
|
||||||
|
});
|
||||||
|
path.addChildren(children);
|
||||||
|
clockwise = children[0].isClockwise();
|
||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
bounds[i] = children[i].getBounds();
|
bounds[i] = children[i].getBounds();
|
||||||
counters[i] = 0;
|
counters[i] = 0;
|
||||||
|
|
Loading…
Reference in a new issue