mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Use groups for compound boolean operations
This commit is contained in:
parent
1d1bfdc529
commit
454632571b
1 changed files with 2 additions and 8 deletions
10
Boolean2.js
10
Boolean2.js
|
@ -328,20 +328,14 @@ function subtract( path1, path2, _cache ){
|
|||
function exclude( path1, path2 ){
|
||||
var res1 = subtract( path1, path2 );
|
||||
var res2 = subtract( path2, path1 );
|
||||
res1 = ( res1 instanceof CompoundPath )? res1.children : [ res1 ];
|
||||
res2 = ( res2 instanceof CompoundPath )? res2.children : [ res2 ];
|
||||
var res = new CompoundPath();
|
||||
res.addChildren( res1.concat( res2 ), true );
|
||||
var res = new Group( [res1, res2] );
|
||||
return res;
|
||||
}
|
||||
|
||||
function divide( path1, path2 ){
|
||||
var res1 = subtract( path1, path2 );
|
||||
var res2 = intersect( path1, path2 );
|
||||
res1 = ( res1 instanceof CompoundPath )? res1.children : [ res1 ];
|
||||
res2 = ( res2 instanceof CompoundPath )? res2.children : [ res2 ];
|
||||
var res = new CompoundPath();
|
||||
res.addChildren( res1.concat( res2 ), true );
|
||||
var res = new Group( [res1, res2] );
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue