mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Added exclusion and divide operators
This commit is contained in:
parent
96ced2bdcf
commit
1d1bfdc529
1 changed files with 17 additions and 6 deletions
23
Boolean2.js
23
Boolean2.js
|
@ -326,12 +326,23 @@ function subtract( path1, path2, _cache ){
|
|||
|
||||
// a.k.a. eXclusiveOR
|
||||
function exclude( path1, path2 ){
|
||||
var cache = null;
|
||||
// computeBoolean( path1, path2, null, cache );
|
||||
var res1 = subtract( path1, path2, cache );
|
||||
var res2 = subtract( path2, path1, cache );
|
||||
res1 = new CompoundPath( res1.children, res2.children );
|
||||
return res1;
|
||||
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 );
|
||||
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 );
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue