paper 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +252 -0
  2. package/README.md +3 -1
  3. package/dist/docs/assets/js/paper.js +6997 -1658
  4. package/dist/docs/classes/AreaText.html +8658 -0
  5. package/dist/docs/classes/ChangeFlag.html +2 -1
  6. package/dist/docs/classes/Color.html +2 -1
  7. package/dist/docs/classes/CompoundPath.html +152 -67
  8. package/dist/docs/classes/Curve.html +2 -1
  9. package/dist/docs/classes/CurveLocation.html +2 -1
  10. package/dist/docs/classes/Event.html +5 -4
  11. package/dist/docs/classes/Gradient.html +2 -1
  12. package/dist/docs/classes/GradientStop.html +2 -1
  13. package/dist/docs/classes/Group.html +117 -15
  14. package/dist/docs/classes/HitResult.html +2 -1
  15. package/dist/docs/classes/HostItem.html +80 -15
  16. package/dist/docs/classes/Item.html +137 -15
  17. package/dist/docs/classes/Key.html +2 -1
  18. package/dist/docs/classes/KeyEvent.html +5 -4
  19. package/dist/docs/classes/Layer.html +114 -15
  20. package/dist/docs/classes/Matrix.html +2 -1
  21. package/dist/docs/classes/MouseEvent.html +5 -4
  22. package/dist/docs/classes/PaperScope.html +4 -2
  23. package/dist/docs/classes/PaperScript.html +5 -2
  24. package/dist/docs/classes/Path.html +126 -67
  25. package/dist/docs/classes/PathItem.html +270 -185
  26. package/dist/docs/classes/PathText.html +8528 -0
  27. package/dist/docs/classes/Point.html +13 -2
  28. package/dist/docs/classes/PointText.html +1346 -59
  29. package/dist/docs/classes/Project.html +40 -7
  30. package/dist/docs/classes/Raster.html +80 -15
  31. package/dist/docs/classes/Rectangle.html +3 -2
  32. package/dist/docs/classes/Segment.html +2 -1
  33. package/dist/docs/classes/Shape.html +80 -15
  34. package/dist/docs/classes/Size.html +4 -2
  35. package/dist/docs/classes/Style.html +767 -14
  36. package/dist/docs/classes/SymbolDefinition.html +2 -1
  37. package/dist/docs/classes/SymbolItem.html +80 -15
  38. package/dist/docs/classes/TextItem.html +1469 -179
  39. package/dist/docs/classes/TextRange.html +186 -0
  40. package/dist/docs/classes/TextStory.html +355 -0
  41. package/dist/docs/classes/Tool.html +2 -1
  42. package/dist/docs/classes/ToolEvent.html +57 -4
  43. package/dist/docs/classes/Tween.html +17 -1
  44. package/dist/docs/classes/View.html +9 -8
  45. package/dist/docs/classes/global.html +2 -1
  46. package/dist/docs/classes/index.html +2 -2
  47. package/dist/docs/index.html +1 -1
  48. package/dist/paper-core.js +6832 -1637
  49. package/dist/paper-core.min.js +3 -3
  50. package/dist/paper-full.js +6997 -1658
  51. package/dist/paper-full.min.js +3 -3
  52. package/dist/{paper-sourced.js → paper-hosted.js} +7109 -1682
  53. package/dist/paper.d.ts +1727 -163
  54. package/examples/Scripts/AreaText.html +65 -0
  55. package/examples/Scripts/PathText.html +48 -0
  56. package/examples/Scripts/TextRanges.html +51 -0
  57. package/package.json +3 -2
@@ -17,6 +17,7 @@
17
17
 
18
18
 
19
19
 
20
+
20
21
  </div>
21
22
 
22
23
 
@@ -96,6 +97,8 @@
96
97
  <li><tt>options.url: <tt>String</tt></tt> &mdash; the url of the source, for source-map generation</li>
97
98
  <li><tt>options.source: <tt>String</tt></tt> &mdash; the source to be used for the source- mapping, in case the code that&rsquo;s passed in has already been mingled.</li>
98
99
  <li><tt>options.handlers: Array of <tt>Strings</tt></tt> &mdash; the names of further global handlers to export next to <code>onFrame</code>, <code>onResize</code> and the tool&rsquo;s handlers, for hosts that call them themselves</li>
100
+ <li><tt>options.load: <tt>Function</tt></tt> &mdash; the loader for static <code>import</code> statements, called with the specifier as written and the <code>options.url</code> of the importing script, and returning the module&rsquo;s exports, e.g. the result of executing it. Modules with ES <code>export</code> statements have their default export as <code>default</code> and are marked with <code>__esModule</code>, so <code>import x</code> receives the default export, and for CommonJS-style exports the whole exports. <code>import * as x</code> receives all exports, and for CommonJS-style exports, these as <code>default</code> too. Dynamic <code>import(specifier)</code> resolves to that namespace as a Promise, and its loader may return a Promise as well. The loader runs each module once and handles cycles. Parsing <code>import</code> requires a current Acorn as <code>self.acorn</code>
101
+ Code with top-level <code>await</code> runs as an async function. <code>execute()</code> then returns a Promise of the exports, and installs the global handlers once it resolves. Parsing it requires a current Acorn as <code>self.acorn</code>.</li>
99
102
  </ul>
100
103
 
101
104
  <ul class="member-list">
@@ -129,7 +132,7 @@
129
132
  <h4>Returns:</h4>
130
133
 
131
134
  <li>
132
- <tt><tt>Object</tt></tt>&nbsp;&mdash;&nbsp;the exports defined in the executed code
135
+ <tt><tt>Object</tt>⟋<tt>Promise</tt></tt>&nbsp;&mdash;&nbsp;the exports defined in the executed code, or with top-level <code>await</code>, a Promise of them
133
136
  </li>
134
137
 
135
138
 
@@ -190,7 +193,7 @@
190
193
 
191
194
  <!-- =========================== copyright notice ========================== -->
192
195
  <p class="footer">
193
- Paper.js v0.14.0<br>
196
+ Paper.js v0.15.0<br>
194
197
  Copyright &#169; 2011—2026 <a href="http://www.lehni.org" target="_blank">J&uuml;rg Lehni</a> &amp; <a href="http://www.jonathanpuckey.com" target="_blank">Jonathan Puckey</a>. All Rights Reserved.</p>
195
198
  <div class="content-end"></div>
196
199
 
@@ -19,6 +19,7 @@
19
19
 
20
20
  <p>The path item represents a path in a Paper.js project.</p>
21
21
 
22
+
22
23
  </div>
23
24
 
24
25
  <!-- =============================== constructors ========================== -->
@@ -3352,7 +3353,7 @@ for (var i = 0; i < amount + 1; i++) {
3352
3353
  <div class="member-description hidden">
3353
3354
 
3354
3355
  <div class="member-text">
3355
- <p>The key of the host&rsquo;s node that the item represents, in a project backed by a host document, see <a href="../classes/Project.html#source"><tt>project.source</tt></a>. It can only be set once, on an item created by a script, to register the key that the host gave its new node.</p>
3356
+ <p>The key of the host&rsquo;s node that the item represents, in a project backed by a host document, see <a href="../classes/Project.html#host"><tt>project.host</tt></a>. It can only be set once, on an item created by a script, to register the key that the host gave its new node.</p>
3356
3357
 
3357
3358
 
3358
3359
 
@@ -3717,7 +3718,7 @@ path.visible = false;
3717
3718
  <div class="member-description hidden">
3718
3719
 
3719
3720
  <div class="member-text">
3720
- <p>The blend mode with which the item is composited onto the canvas. Both the standard canvas compositing modes, as well as the new CSS blend modes are supported. If blend-modes cannot be rendered natively, they are emulated. Be aware that emulation can have an impact on performance.</p>
3721
+ <p>The blend mode with which the item is composited onto the canvas. Both the standard canvas compositing modes, as well as the new CSS blend modes are supported. Where the canvas doesn&rsquo;t support a CSS blend mode natively, it draws as <code>&#39;normal&#39;</code>. Paper.js&rsquo;s own modes <code>&#39;add&#39;</code>, <code>&#39;subtract&#39;</code>, <code>&#39;average&#39;</code>, <code>&#39;pin-light&#39;</code> and <code>&#39;negation&#39;</code> are emulated, which can have an impact on performance.</p>
3721
3722
 
3722
3723
 
3723
3724
  <ul class="member-list">
@@ -3870,6 +3871,42 @@ circle2.opacity = 0.5;
3870
3871
  </div>
3871
3872
 
3872
3873
 
3874
+ <div id="textwrap" class="member">
3875
+ <div class="member-link">
3876
+ <a name="textwrap" href="#textwrap"><tt><b>textWrap</b></tt></a>
3877
+ </div>
3878
+ <div class="member-description hidden">
3879
+
3880
+ <div class="member-text">
3881
+ <p>Specifies whether, and how, the item pushes aside the text of the <a href="../classes/AreaText.html"><tt>AreaText</tt></a> items below it in its layer: <code>null</code>, or an object with <code>offset</code>, the space kept between them, and <code>invert</code>, to let the text flow inside it instead. <code>true</code> sets the defaults.</p>
3882
+
3883
+
3884
+
3885
+ <ul class="member-list">
3886
+ <h4>Default:</h4>
3887
+ <li><tt>null</tt></li>
3888
+ </ul>
3889
+
3890
+ <ul class="member-list">
3891
+ <h4>Type:</h4>
3892
+ <li>
3893
+ <tt>Object</tt>
3894
+ </li>
3895
+ </ul>
3896
+
3897
+
3898
+ <h4>Example:</h4>
3899
+
3900
+
3901
+ <pre><code>var circle = new Path.Circle({ center: [100, 100], radius: 40 });
3902
+ circle.textWrap = { offset: 10 };</code></pre>
3903
+
3904
+ </div>
3905
+
3906
+ </div>
3907
+ </div>
3908
+
3909
+
3873
3910
  <div id="selected" class="member">
3874
3911
  <div class="member-link">
3875
3912
  <a name="selected" href="#selected"><tt><b>selected</b></tt></a>
@@ -4166,6 +4203,7 @@ circle.position.x += 100;
4166
4203
 
4167
4204
  <div class="member-text">
4168
4205
  <p>The bounding rectangle of the item including stroke width.</p>
4206
+ <p>Setting it fits the item&rsquo;s <a href="../classes/Item.html#bounds"><tt>bounds</tt></a> into the given rectangle minus the extent of the stroke on each side, also where this extent changes with the item&rsquo;s proportions, as with miters. A rectangle smaller than the stroke itself shrinks the bounds to its center.</p>
4169
4207
 
4170
4208
 
4171
4209
 
@@ -6305,9 +6343,9 @@ for (var i = 0; i < 20; i++) {
6305
6343
  <p>Rasterizes the item into a newly created Raster object. The item itself is not removed after rasterization.</p>
6306
6344
  <ul class="member-list">
6307
6345
  <h4>Options:</h4>
6308
- <li><tt>resolution: <tt>Number</tt></tt> &mdash; the desired resolution to be used when rasterizing, in pixels per inch (DPI). If not specified, the value of <code>view.resolution</code> is used by default. &mdash;&nbsp;default: <tt>view.resolution</tt></li>
6309
- <li><tt>raster: <a href="../classes/Raster.html"><tt>Raster</tt></a></tt> &mdash; specifies a raster to be reused when rasterizing. If the raster has the desired size already, then the underlying canvas is reused and no new memory needs to be allocated. If no raster is provided, a new raster item is created and returned instead. &mdash;&nbsp;default: <tt>null</tt></li>
6310
- <li><tt>insert: <tt>Boolean</tt></tt> &mdash; specifies whether the raster should be inserted into the scene graph. When set to <code>true</code>, it is inserted above the rasterized item. &mdash;&nbsp;default: <tt>true</tt></li>
6346
+ <li><tt>options.resolution: <tt>Number</tt></tt> &mdash; the desired resolution to be used when rasterizing, in pixels per inch (DPI). If not specified, the value of <code>view.resolution</code> is used by default. &mdash;&nbsp;default: <tt>view.resolution</tt></li>
6347
+ <li><tt>options.raster: <a href="../classes/Raster.html"><tt>Raster</tt></a></tt> &mdash; specifies a raster to be reused when rasterizing. If the raster has the desired size already, then the underlying canvas is reused and no new memory needs to be allocated. If no raster is provided, a new raster item is created and returned instead. &mdash;&nbsp;default: <tt>null</tt></li>
6348
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; specifies whether the raster should be inserted into the scene graph. When set to <code>true</code>, it is inserted above the rasterized item. &mdash;&nbsp;default: <tt>true</tt></li>
6311
6349
  </ul>
6312
6350
 
6313
6351
  <ul class="member-list">
@@ -6492,7 +6530,7 @@ function onMouseDown(event) {
6492
6530
  </div>
6493
6531
  <div class="member-description hidden">
6494
6532
  <div class="member-text">
6495
-
6533
+ <p>Checks whether the item overlaps with the given item: whether their outlines cross, or one contains the other, as <a href="../classes/Rectangle.html#intersects-rect"><tt>rectangle.intersects(rect)</tt></a> does for rectangles. Items other than paths and shapes are checked through their bounds. To only check whether outlines cross, use <a href="../classes/PathItem.html#getintersections-path"><tt>pathItem.getIntersections(path)</tt></a>.</p>
6496
6534
 
6497
6535
 
6498
6536
  <ul class="member-list">
@@ -6512,7 +6550,7 @@ function onMouseDown(event) {
6512
6550
  <h4>Returns:</h4>
6513
6551
 
6514
6552
  <li>
6515
- <tt><tt>Boolean</tt></tt>
6553
+ <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the items overlap, <tt>false</tt> otherwise
6516
6554
  </li>
6517
6555
 
6518
6556
 
@@ -7008,6 +7046,7 @@ function onMouseDown(event) {
7008
7046
  <div class="member-text">
7009
7047
  <p>Converts the provided SVG content into Paper.js items and adds them to the this item&rsquo;s children list. Note that the item is not cleared first. You can call <a href="../classes/Item.html#removechildren"><tt>item.removeChildren</tt></a>() to do so.</p>
7010
7048
  <p><code>&lt;symbol&gt;</code> elements are imported as <a href="../classes/SymbolDefinition.html"><tt>SymbolDefinition</tt></a> items, and the <code>&lt;use&gt;</code> elements that place them as <a href="../classes/SymbolItem.html"><tt>SymbolItem</tt></a> items. The styles that <code>&lt;use&gt;</code> elements inherit don&rsquo;t reach the symbols&rsquo; content.</p>
7049
+ <p>URLs are fetched as they are, so validate URLs that come from untrusted sources first, especially on servers, where they could reach internal addresses.</p>
7011
7050
  <ul class="member-list">
7012
7051
  <h4>Options:</h4>
7013
7052
  <li><tt>options.expandShapes: <tt>Boolean</tt></tt> &mdash; whether imported shape items should be expanded to path items &mdash;&nbsp;default: <tt>false</tt></li>
@@ -7520,11 +7559,11 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
7520
7559
 
7521
7560
  <div id="replacewith-item" class="member">
7522
7561
  <div class="member-link">
7523
- <a name="replacewith-item" href="#replacewith-item"><tt><b>replaceWith</b>(item)</tt></a>
7562
+ <a name="replacewith-item" href="#replacewith-item"><tt><b>replaceWith</b>(...item)</tt></a>
7524
7563
  </div>
7525
7564
  <div class="member-description hidden">
7526
7565
  <div class="member-text">
7527
- <p>Replaces this item with the provided new item which will takes its place in the project hierarchy instead.</p>
7566
+ <p>Replaces this item with the provided new items which will take its place in the project hierarchy instead, in the given order. This also ungroups a group, e.g. <code>group.replaceWith(…group.children)</code>, but note that the items keep their own matrices, see <a href="../classes/Group.html#ungroup"><tt>group.ungroup</tt></a>().</p>
7528
7567
 
7529
7568
 
7530
7569
  <ul class="member-list">
@@ -7533,7 +7572,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
7533
7572
  <li>
7534
7573
  <tt>item:</tt>
7535
7574
  <a href="../classes/Item.html"><tt>Item</tt></a>
7536
- &mdash;&nbsp;the item that will replace this item
7575
+ &mdash;&nbsp;the items that will replace this item
7537
7576
 
7538
7577
  </li>
7539
7578
 
@@ -9348,10 +9387,10 @@ function onMouseDown(event) {
9348
9387
  <p>Removes the item when the events specified in the passed options object occur.</p>
9349
9388
  <ul class="member-list">
9350
9389
  <h4>Options:</h4>
9351
- <li><tt>options.move: undefined</tt> &mdash; {Boolean) remove the item when the next <a href="../classes/Tool.html#onmousemove"><tt>tool.onMouseMove</tt></a> event is fired.</li>
9352
- <li><tt>options.drag: undefined</tt> &mdash; {Boolena) remove the item when the next <a href="../classes/Tool.html#onmousedrag"><tt>tool.onMouseDrag</tt></a> event is fired.</li>
9353
- <li><tt>options.down: undefined</tt> &mdash; {Boolean) remove the item when the next <a href="../classes/Tool.html#onmousedown"><tt>tool.onMouseDown</tt></a> event is fired.</li>
9354
- <li><tt>options.up: undefined</tt> &mdash; {Boolean) remove the item when the next <a href="../classes/Tool.html#onmouseup"><tt>tool.onMouseUp</tt></a> event is fired.</li>
9390
+ <li><tt>options.move: <tt>Boolean</tt></tt> &mdash; remove the item when the next <a href="../classes/Tool.html#onmousemove"><tt>tool.onMouseMove</tt></a> event is fired.</li>
9391
+ <li><tt>options.drag: <tt>Boolean</tt></tt> &mdash; remove the item when the next <a href="../classes/Tool.html#onmousedrag"><tt>tool.onMouseDrag</tt></a> event is fired.</li>
9392
+ <li><tt>options.down: <tt>Boolean</tt></tt> &mdash; remove the item when the next <a href="../classes/Tool.html#onmousedown"><tt>tool.onMouseDown</tt></a> event is fired.</li>
9393
+ <li><tt>options.up: <tt>Boolean</tt></tt> &mdash; remove the item when the next <a href="../classes/Tool.html#onmouseup"><tt>tool.onMouseUp</tt></a> event is fired.</li>
9355
9394
  </ul>
9356
9395
 
9357
9396
  <ul class="member-list">
@@ -10085,10 +10124,10 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
10085
10124
  </div>
10086
10125
  <div class="member-description hidden">
10087
10126
  <div class="member-text">
10088
- <p>Unites the geometry of the specified path with this path&rsquo;s geometry and returns the result as a new path item.</p>
10127
+ <p>Unites the geometry of the specified path with this path&rsquo;s geometry and returns the result as a new path item. With an array of paths, the result covers the areas inside any of them or this path. Each path keeps its own fill rule.</p>
10089
10128
  <ul class="member-list">
10090
10129
  <h4>Options:</h4>
10091
- <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
10130
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above all paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
10092
10131
  </ul>
10093
10132
 
10094
10133
  <ul class="member-list">
@@ -10096,8 +10135,8 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
10096
10135
 
10097
10136
  <li>
10098
10137
  <tt>path:</tt>
10099
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
10100
- &mdash;&nbsp;the path to unite with
10138
+ <a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
10139
+ &mdash;&nbsp;the path or paths to unite with
10101
10140
 
10102
10141
  </li>
10103
10142
 
@@ -10141,6 +10180,26 @@ result.fillColor = 'red';
10141
10180
  </div>
10142
10181
 
10143
10182
 
10183
+ <h4>Example:<span class="description">Uniting many paths at once:</span></h4>
10184
+
10185
+ <div class="paperscript split">
10186
+
10187
+ <div class="buttons">
10188
+ <div class="button run">Run</div>
10189
+ </div>
10190
+
10191
+ <script type="text/paperscript" canvas="canvas-109">
10192
+ var circles = [];
10193
+ for (var i = 0; i < 6; i++) {
10194
+ circles.push(new Path.Circle([30 + i * 20, 50], 20));
10195
+ }
10196
+ var result = circles[0].unite(circles.slice(1));
10197
+ result.fillColor = 'red';
10198
+ </script>
10199
+ <div class="canvas"><canvas width="516" height="100" id="canvas-109"></canvas></div>
10200
+ </div>
10201
+
10202
+
10144
10203
  </div>
10145
10204
  </div>
10146
10205
  </div>
@@ -10152,11 +10211,11 @@ result.fillColor = 'red';
10152
10211
  </div>
10153
10212
  <div class="member-description hidden">
10154
10213
  <div class="member-text">
10155
- <p>Intersects the geometry of the specified path with this path&rsquo;s geometry and returns the result as a new path item.</p>
10214
+ <p>Intersects the geometry of the specified path with this path&rsquo;s geometry and returns the result as a new path item. With an array of paths, the result covers the areas inside all of them and this path. Each path keeps its own fill rule.</p>
10156
10215
  <ul class="member-list">
10157
10216
  <h4>Options:</h4>
10158
- <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
10159
- <li><tt>options.trace: <tt>Boolean</tt></tt> &mdash; whether the tracing method is used, treating both paths as areas when determining which parts of the paths are to be kept in the result, or whether the first path is only to be split at intersections, keeping the parts of the curves that intersect with the area of the second path. &mdash;&nbsp;default: <tt>true</tt></li>
10217
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above all paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
10218
+ <li><tt>options.trace: <tt>Boolean</tt></tt> &mdash; whether the tracing method is used, treating all paths as areas when determining which parts of the paths are to be kept in the result, or whether the first path is only to be split at intersections, keeping the parts of the curves that intersect with the areas of all other paths. &mdash;&nbsp;default: <tt>true</tt></li>
10160
10219
  </ul>
10161
10220
 
10162
10221
  <ul class="member-list">
@@ -10164,8 +10223,8 @@ result.fillColor = 'red';
10164
10223
 
10165
10224
  <li>
10166
10225
  <tt>path:</tt>
10167
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
10168
- &mdash;&nbsp;the path to intersect with
10226
+ <a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
10227
+ &mdash;&nbsp;the path or paths to intersect with
10169
10228
 
10170
10229
  </li>
10171
10230
 
@@ -10200,12 +10259,12 @@ result.fillColor = 'red';
10200
10259
  <div class="button run">Run</div>
10201
10260
  </div>
10202
10261
 
10203
- <script type="text/paperscript" canvas="canvas-109">
10262
+ <script type="text/paperscript" canvas="canvas-110">
10204
10263
  var result = new Path.RegularPolygon([50, 50], 3, 40)
10205
10264
  .intersect(new Path.Circle([50, 50], 25));
10206
10265
  result.fillColor = 'red';
10207
10266
  </script>
10208
- <div class="canvas"><canvas width="516" height="100" id="canvas-109"></canvas></div>
10267
+ <div class="canvas"><canvas width="516" height="100" id="canvas-110"></canvas></div>
10209
10268
  </div>
10210
10269
 
10211
10270
 
@@ -10220,11 +10279,11 @@ result.fillColor = 'red';
10220
10279
  </div>
10221
10280
  <div class="member-description hidden">
10222
10281
  <div class="member-text">
10223
- <p>Subtracts the geometry of the specified path from this path&rsquo;s geometry and returns the result as a new path item.</p>
10282
+ <p>Subtracts the geometry of the specified path from this path&rsquo;s geometry and returns the result as a new path item. With an array of paths, the result covers the areas inside this path and outside all of them. Each path keeps its own fill rule.</p>
10224
10283
  <ul class="member-list">
10225
10284
  <h4>Options:</h4>
10226
- <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
10227
- <li><tt>options.trace: <tt>Boolean</tt></tt> &mdash; whether the tracing method is used, treating both paths as areas when determining which parts of the paths are to be kept in the result, or whether the first path is only to be split at intersections, removing the parts of the curves that intersect with the area of the second path. &mdash;&nbsp;default: <tt>true</tt></li>
10285
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above all paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
10286
+ <li><tt>options.trace: <tt>Boolean</tt></tt> &mdash; whether the tracing method is used, treating all paths as areas when determining which parts of the paths are to be kept in the result, or whether the first path is only to be split at intersections, removing the parts of the curves that intersect with the area of any other path. &mdash;&nbsp;default: <tt>true</tt></li>
10228
10287
  </ul>
10229
10288
 
10230
10289
  <ul class="member-list">
@@ -10232,8 +10291,8 @@ result.fillColor = 'red';
10232
10291
 
10233
10292
  <li>
10234
10293
  <tt>path:</tt>
10235
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
10236
- &mdash;&nbsp;the path to subtract
10294
+ <a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
10295
+ &mdash;&nbsp;the path or paths to subtract
10237
10296
 
10238
10297
  </li>
10239
10298
 
@@ -10268,12 +10327,12 @@ result.fillColor = 'red';
10268
10327
  <div class="button run">Run</div>
10269
10328
  </div>
10270
10329
 
10271
- <script type="text/paperscript" canvas="canvas-110">
10330
+ <script type="text/paperscript" canvas="canvas-111">
10272
10331
  var result = new Path.RegularPolygon([50, 50], 3, 40)
10273
10332
  .subtract(new Path.Circle([50, 50], 25));
10274
10333
  result.fillColor = 'red';
10275
10334
  </script>
10276
- <div class="canvas"><canvas width="516" height="100" id="canvas-110"></canvas></div>
10335
+ <div class="canvas"><canvas width="516" height="100" id="canvas-111"></canvas></div>
10277
10336
  </div>
10278
10337
 
10279
10338
 
@@ -10288,10 +10347,10 @@ result.fillColor = 'red';
10288
10347
  </div>
10289
10348
  <div class="member-description hidden">
10290
10349
  <div class="member-text">
10291
- <p>Excludes the intersection of the geometry of the specified path with this path&rsquo;s geometry and returns the result as a new path item.</p>
10350
+ <p>Excludes the intersection of the geometry of the specified path with this path&rsquo;s geometry and returns the result as a new path item. With an array of paths, the result covers the areas inside an odd number of the paths, this one included. Each path keeps its own fill rule.</p>
10292
10351
  <ul class="member-list">
10293
10352
  <h4>Options:</h4>
10294
- <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
10353
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above all paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
10295
10354
  </ul>
10296
10355
 
10297
10356
  <ul class="member-list">
@@ -10299,8 +10358,8 @@ result.fillColor = 'red';
10299
10358
 
10300
10359
  <li>
10301
10360
  <tt>path:</tt>
10302
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
10303
- &mdash;&nbsp;the path to exclude the intersection of
10361
+ <a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
10362
+ &mdash;&nbsp;the path or paths to exclude the intersection of
10304
10363
 
10305
10364
  </li>
10306
10365
 
@@ -10335,12 +10394,12 @@ result.fillColor = 'red';
10335
10394
  <div class="button run">Run</div>
10336
10395
  </div>
10337
10396
 
10338
- <script type="text/paperscript" canvas="canvas-111">
10397
+ <script type="text/paperscript" canvas="canvas-112">
10339
10398
  var result = new Path.RegularPolygon([50, 50], 3, 40)
10340
10399
  .exclude(new Path.Circle([50, 50], 25));
10341
10400
  result.fillColor = 'red';
10342
10401
  </script>
10343
- <div class="canvas"><canvas width="516" height="100" id="canvas-111"></canvas></div>
10402
+ <div class="canvas"><canvas width="516" height="100" id="canvas-112"></canvas></div>
10344
10403
  </div>
10345
10404
 
10346
10405
 
@@ -10508,7 +10567,7 @@ result.fillColor = 'red';
10508
10567
  <div class="button run">Run</div>
10509
10568
  </div>
10510
10569
 
10511
- <script type="text/paperscript" canvas="canvas-112">
10570
+ <script type="text/paperscript" canvas="canvas-113">
10512
10571
  var path = new Path.Rectangle(new Point(30, 25), new Size(50, 50));
10513
10572
  path.strokeColor = 'black';
10514
10573
 
@@ -10531,7 +10590,7 @@ function onFrame(event) {
10531
10590
  }
10532
10591
  }
10533
10592
  </script>
10534
- <div class="canvas"><canvas width="516" height="100" id="canvas-112"></canvas></div>
10593
+ <div class="canvas"><canvas width="516" height="100" id="canvas-113"></canvas></div>
10535
10594
  </div>
10536
10595
 
10537
10596
 
@@ -10672,7 +10731,7 @@ function onFrame(event) {
10672
10731
  <div class="button run">Run</div>
10673
10732
  </div>
10674
10733
 
10675
- <script type="text/paperscript" canvas="canvas-113">
10734
+ <script type="text/paperscript" canvas="canvas-114">
10676
10735
  var star = new Path.Star({
10677
10736
  center: view.center,
10678
10737
  points: 10,
@@ -10696,7 +10755,7 @@ function onMouseMove(event) {
10696
10755
  circle.position = nearestPoint;
10697
10756
  }
10698
10757
  </script>
10699
- <div class="canvas"><canvas width="516" height="200" id="canvas-113"></canvas></div>
10758
+ <div class="canvas"><canvas width="516" height="200" id="canvas-114"></canvas></div>
10700
10759
  </div>
10701
10760
 
10702
10761
 
@@ -10759,7 +10818,7 @@ function onMouseMove(event) {
10759
10818
  <div class="button run">Run</div>
10760
10819
  </div>
10761
10820
 
10762
- <script type="text/paperscript" canvas="canvas-114">
10821
+ <script type="text/paperscript" canvas="canvas-115">
10763
10822
  // Create a circle shaped path at { x: 80, y: 50 }
10764
10823
  // with a radius of 35:
10765
10824
  var path = new Path.Circle({
@@ -10777,7 +10836,7 @@ copy.position.x += 150;
10777
10836
  // Flatten the copied path, with a maximum error of 4 points:
10778
10837
  copy.flatten(4);
10779
10838
  </script>
10780
- <div class="canvas"><canvas width="516" height="100" id="canvas-114"></canvas></div>
10839
+ <div class="canvas"><canvas width="516" height="100" id="canvas-115"></canvas></div>
10781
10840
  </div>
10782
10841
 
10783
10842
 
@@ -10855,7 +10914,7 @@ copy.flatten(4);
10855
10914
  <div class="button run">Run</div>
10856
10915
  </div>
10857
10916
 
10858
- <script type="text/paperscript" canvas="canvas-115">
10917
+ <script type="text/paperscript" canvas="canvas-116">
10859
10918
  // Create a rectangular path with its top-left point at
10860
10919
  // {x: 30, y: 25} and a size of {width: 50, height: 50}:
10861
10920
  var path = new Path.Rectangle({
@@ -10874,7 +10933,7 @@ copy.position.x += 100;
10874
10933
  // Smooth the segments of the copy:
10875
10934
  copy.smooth({ type: 'continuous' });
10876
10935
  </script>
10877
- <div class="canvas"><canvas width="516" height="100" id="canvas-115"></canvas></div>
10936
+ <div class="canvas"><canvas width="516" height="100" id="canvas-116"></canvas></div>
10878
10937
  </div>
10879
10938
 
10880
10939
 
@@ -10886,7 +10945,7 @@ copy.smooth({ type: 'continuous' });
10886
10945
  <div class="button run">Run</div>
10887
10946
  </div>
10888
10947
 
10889
- <script type="text/paperscript" canvas="canvas-116">
10948
+ <script type="text/paperscript" canvas="canvas-117">
10890
10949
  var path = new Path();
10891
10950
  path.strokeColor = 'black';
10892
10951
 
@@ -10911,7 +10970,7 @@ copy.fullySelected = true;
10911
10970
  // Smooth the path using centripetal Catmull-Rom splines:
10912
10971
  copy.smooth({ type: 'catmull-rom', factor: 0.5 });
10913
10972
  </script>
10914
- <div class="canvas"><canvas width="516" height="220" id="canvas-116"></canvas></div>
10973
+ <div class="canvas"><canvas width="516" height="220" id="canvas-117"></canvas></div>
10915
10974
  </div>
10916
10975
 
10917
10976
 
@@ -10923,7 +10982,7 @@ copy.smooth({ type: 'catmull-rom', factor: 0.5 });
10923
10982
  <div class="button run">Run</div>
10924
10983
  </div>
10925
10984
 
10926
- <script type="text/paperscript" canvas="canvas-117">
10985
+ <script type="text/paperscript" canvas="canvas-118">
10927
10986
  // Create 5 rectangles, next to each other:
10928
10987
  var paths = [];
10929
10988
  for (var i = 0; i < 5; i++) {
@@ -10953,7 +11012,7 @@ paths[3].smooth({ type: 'continuous', from: 0, to: 2 });
10953
11012
  // Smooth a range, using negative indices:
10954
11013
  paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
10955
11014
  </script>
10956
- <div class="canvas"><canvas width="516" height="110" id="canvas-117"></canvas></div>
11015
+ <div class="canvas"><canvas width="516" height="110" id="canvas-118"></canvas></div>
10957
11016
  </div>
10958
11017
 
10959
11018
 
@@ -11006,7 +11065,7 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
11006
11065
  <div class="button run">Run</div>
11007
11066
  </div>
11008
11067
 
11009
- <script type="text/paperscript" canvas="canvas-118">
11068
+ <script type="text/paperscript" canvas="canvas-119">
11010
11069
  var path;
11011
11070
  function onMouseDown(event) {
11012
11071
  // If we already made a path before, deselect it:
@@ -11036,7 +11095,7 @@ function onMouseUp(event) {
11036
11095
  path.selected = true;
11037
11096
  }
11038
11097
  </script>
11039
- <div class="canvas"><canvas width="516" height="300" id="canvas-118"></canvas></div>
11098
+ <div class="canvas"><canvas width="516" height="300" id="canvas-119"></canvas></div>
11040
11099
  </div>
11041
11100
 
11042
11101
 
@@ -11235,7 +11294,7 @@ function onMouseUp(event) {
11235
11294
  <div class="button run">Run</div>
11236
11295
  </div>
11237
11296
 
11238
- <script type="text/paperscript" canvas="canvas-119">
11297
+ <script type="text/paperscript" canvas="canvas-120">
11239
11298
  var path = new Path();
11240
11299
  path.strokeColor = 'black';
11241
11300
 
@@ -11255,7 +11314,7 @@ path.arcTo(throughPoint, toPoint);
11255
11314
  var circle = new Path.Circle(throughPoint, 3);
11256
11315
  circle.fillColor = 'red';
11257
11316
  </script>
11258
- <div class="canvas"><canvas width="516" height="100" id="canvas-119"></canvas></div>
11317
+ <div class="canvas"><canvas width="516" height="100" id="canvas-120"></canvas></div>
11259
11318
  </div>
11260
11319
 
11261
11320
 
@@ -11267,7 +11326,7 @@ circle.fillColor = 'red';
11267
11326
  <div class="button run">Run</div>
11268
11327
  </div>
11269
11328
 
11270
- <script type="text/paperscript" canvas="canvas-120">
11329
+ <script type="text/paperscript" canvas="canvas-121">
11271
11330
  var myPath;
11272
11331
  function onMouseDrag(event) {
11273
11332
  // If we created a path before, remove it:
@@ -11295,7 +11354,7 @@ function onMouseUp(event) {
11295
11354
  myPath.fillColor = 'black';
11296
11355
  }
11297
11356
  </script>
11298
- <div class="canvas"><canvas width="516" height="300" id="canvas-120"></canvas></div>
11357
+ <div class="canvas"><canvas width="516" height="300" id="canvas-121"></canvas></div>
11299
11358
  </div>
11300
11359
 
11301
11360
 
@@ -11344,7 +11403,7 @@ function onMouseUp(event) {
11344
11403
  <div class="button run">Run</div>
11345
11404
  </div>
11346
11405
 
11347
- <script type="text/paperscript" canvas="canvas-121">
11406
+ <script type="text/paperscript" canvas="canvas-122">
11348
11407
  var path = new Path();
11349
11408
  path.strokeColor = 'black';
11350
11409
 
@@ -11359,7 +11418,7 @@ path2.add(new Point(180, 25));
11359
11418
  // we pass `false` as the second argument to arcTo:
11360
11419
  path2.arcTo(new Point(280, 25), false);
11361
11420
  </script>
11362
- <div class="canvas"><canvas width="516" height="100" id="canvas-121"></canvas></div>
11421
+ <div class="canvas"><canvas width="516" height="100" id="canvas-122"></canvas></div>
11363
11422
  </div>
11364
11423
 
11365
11424
 
@@ -11371,7 +11430,7 @@ path2.arcTo(new Point(280, 25), false);
11371
11430
  <div class="button run">Run</div>
11372
11431
  </div>
11373
11432
 
11374
- <script type="text/paperscript" canvas="canvas-122">
11433
+ <script type="text/paperscript" canvas="canvas-123">
11375
11434
  var myPath;
11376
11435
 
11377
11436
  // The mouse has to move at least 20 points before
@@ -11392,7 +11451,7 @@ function onMouseDrag(event) {
11392
11451
  myPath.arcTo(event.point);
11393
11452
  }
11394
11453
  </script>
11395
- <div class="canvas"><canvas width="516" height="300" id="canvas-122"></canvas></div>
11454
+ <div class="canvas"><canvas width="516" height="300" id="canvas-123"></canvas></div>
11396
11455
  </div>
11397
11456
 
11398
11457
 
@@ -11448,7 +11507,7 @@ function onMouseDrag(event) {
11448
11507
  <div class="button run">Run</div>
11449
11508
  </div>
11450
11509
 
11451
- <script type="text/paperscript" canvas="canvas-123">
11510
+ <script type="text/paperscript" canvas="canvas-124">
11452
11511
  var myPath;
11453
11512
  function onMouseMove(event) {
11454
11513
  // If we created a path before, remove it:
@@ -11469,7 +11528,7 @@ function onMouseMove(event) {
11469
11528
  myPath.selected = true;
11470
11529
  }
11471
11530
  </script>
11472
- <div class="canvas"><canvas width="516" height="300" id="canvas-123"></canvas></div>
11531
+ <div class="canvas"><canvas width="516" height="300" id="canvas-124"></canvas></div>
11473
11532
  </div>
11474
11533
 
11475
11534
 
@@ -11654,7 +11713,7 @@ function onMouseMove(event) {
11654
11713
  <div class="button run">Run</div>
11655
11714
  </div>
11656
11715
 
11657
- <script type="text/paperscript" canvas="canvas-124">
11716
+ <script type="text/paperscript" canvas="canvas-125">
11658
11717
  var path = new Path();
11659
11718
  path.strokeColor = 'black';
11660
11719
 
@@ -11668,7 +11727,7 @@ path.lineBy(50, 0);
11668
11727
  // 0 in x direction and 50 in y direction, becomes {x: 75, y: 75}
11669
11728
  path.lineBy(0, 50);
11670
11729
  </script>
11671
- <div class="canvas"><canvas width="516" height="100" id="canvas-124"></canvas></div>
11730
+ <div class="canvas"><canvas width="516" height="100" id="canvas-125"></canvas></div>
11672
11731
  </div>
11673
11732
 
11674
11733
 
@@ -11680,7 +11739,7 @@ path.lineBy(0, 50);
11680
11739
  <div class="button run">Run</div>
11681
11740
  </div>
11682
11741
 
11683
- <script type="text/paperscript" canvas="canvas-125">
11742
+ <script type="text/paperscript" canvas="canvas-126">
11684
11743
  var path = new Path();
11685
11744
  path.strokeColor = 'black';
11686
11745
 
@@ -11706,7 +11765,7 @@ path.smooth();
11706
11765
  // the construction of the path:
11707
11766
  // path.selected = true;
11708
11767
  </script>
11709
- <div class="canvas"><canvas width="516" height="300" id="canvas-125"></canvas></div>
11768
+ <div class="canvas"><canvas width="516" height="300" id="canvas-126"></canvas></div>
11710
11769
  </div>
11711
11770
 
11712
11771
 
@@ -11925,7 +11984,7 @@ path.smooth();
11925
11984
 
11926
11985
  <!-- =========================== copyright notice ========================== -->
11927
11986
  <p class="footer">
11928
- Paper.js v0.14.0<br>
11987
+ Paper.js v0.15.0<br>
11929
11988
  Copyright &#169; 2011—2026 <a href="http://www.lehni.org" target="_blank">J&uuml;rg Lehni</a> &amp; <a href="http://www.jonathanpuckey.com" target="_blank">Jonathan Puckey</a>. All Rights Reserved.</p>
11930
11989
  <div class="content-end"></div>
11931
11990