mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
more tests
This commit is contained in:
parent
f3e278f13b
commit
eec2638146
2 changed files with 16 additions and 4 deletions
|
@ -23,7 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<p>Vector boolean operations on paperjs objects. <br />
|
<p>Vector boolean operations on paperjs objects. <br />
|
||||||
Still under development, mostly written for clarity and compatibility,
|
Still under development, mostly written for clarity and compatibility,
|
||||||
not optimised for performance, and has to be tested heavily.</p>
|
not optimised for performance, and has to be tested heavily.</p>
|
||||||
<p>--<br />
|
<p>--<br />
|
||||||
hari</p>
|
hari</p>
|
||||||
|
|
|
@ -128,15 +128,27 @@ function runTests() {
|
||||||
pathB.addChild( npath );
|
pathB.addChild( npath );
|
||||||
testBooleanStatic( pathA, pathB, caption );
|
testBooleanStatic( pathA, pathB, caption );
|
||||||
|
|
||||||
|
caption = prepareTest( 'CompoundPaths 6 - holes and islands 3', container );
|
||||||
|
group = paper.project.importSvg( document.getElementById( 'glyphsacirc' ) );
|
||||||
|
pathA = group.children[0];
|
||||||
|
pathB = new CompoundPath();
|
||||||
|
var npath = new Path.Circle([110, 110], 100);
|
||||||
|
pathB.addChild( npath );
|
||||||
|
npath = new Path.Circle([110, 110], 60);
|
||||||
|
pathB.addChild( npath );
|
||||||
|
npath = new Path.Circle([110, 110], 30);
|
||||||
|
pathB.addChild( npath );
|
||||||
|
testBooleanStatic( pathA, pathB, caption );
|
||||||
|
|
||||||
// To resolve self intersection on a single path,
|
// To resolve self intersection on a single path,
|
||||||
// pass an empty second operand and do a Union operation
|
// pass an empty second operand and do a Union operation
|
||||||
caption = prepareTest( 'Self-intersecting paths 1 - Resolve self-intersection on single path', container );
|
caption = prepareTest( 'Self-intersecting paths 1 - Resolve self-intersection on single path', container );
|
||||||
pathA = new Path.Star(new Point(80, 110), 10, 20, 80);
|
pathA = new Path.Star(new Point(110, 110), 10, 20, 80);
|
||||||
pathA.smooth();
|
pathA.smooth();
|
||||||
pathB = new Path();
|
pathB = new Path();
|
||||||
testBooleanStatic( pathA, pathB, caption, false, true, true, true );
|
testBooleanStatic( pathA, pathB, caption, false, true, true, true );
|
||||||
|
|
||||||
caption = prepareTest( 'Self-intersecting paths 2 - Resolve self-intersection on single path', container );
|
caption = prepareTest( 'Self-intersecting paths 2 - Resolve self-intersecting CompoundPath', container );
|
||||||
pathA = new CompoundPath();
|
pathA = new CompoundPath();
|
||||||
pathA.addChild( new Path.Circle([100, 110], 60) );
|
pathA.addChild( new Path.Circle([100, 110], 60) );
|
||||||
pathA.addChild( new Path.Circle([160, 110], 30) );
|
pathA.addChild( new Path.Circle([160, 110], 30) );
|
||||||
|
@ -166,7 +178,7 @@ var booleanStyle = {
|
||||||
|
|
||||||
var pathStyleNormal = {
|
var pathStyleNormal = {
|
||||||
strokeColor: new Color( 0, 0, 0 ),
|
strokeColor: new Color( 0, 0, 0 ),
|
||||||
fillColor: new Color( 0, 0, 0, 0.0 ),
|
fillColor: new Color( 0, 0, 0, 0.1 ),
|
||||||
strokeWidth: 1
|
strokeWidth: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue