mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -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) {
|
||||
if (path instanceof CompoundPath) {
|
||||
var children = path._children,
|
||||
var children = path.removeChildren(),
|
||||
length = children.length,
|
||||
bounds = 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++) {
|
||||
bounds[i] = children[i].getBounds();
|
||||
counters[i] = 0;
|
||||
|
|
Loading…
Reference in a new issue