paper 0.12.20 → 0.14.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 (54) hide show
  1. package/CHANGELOG.md +318 -0
  2. package/README.md +45 -26
  3. package/dist/docs/assets/js/paper.js +1210 -481
  4. package/dist/docs/classes/ChangeFlag.html +384 -0
  5. package/dist/docs/classes/Color.html +63 -47
  6. package/dist/docs/classes/CompoundPath.html +219 -62
  7. package/dist/docs/classes/Curve.html +9 -7
  8. package/dist/docs/classes/CurveLocation.html +1 -1
  9. package/dist/docs/classes/Event.html +1 -1
  10. package/dist/docs/classes/Gradient.html +1 -1
  11. package/dist/docs/classes/GradientStop.html +1 -1
  12. package/dist/docs/classes/Group.html +151 -27
  13. package/dist/docs/classes/HitResult.html +3 -2
  14. package/dist/docs/classes/HostItem.html +6721 -0
  15. package/dist/docs/classes/Item.html +120 -27
  16. package/dist/docs/classes/Key.html +1 -1
  17. package/dist/docs/classes/KeyEvent.html +1 -1
  18. package/dist/docs/classes/Layer.html +151 -27
  19. package/dist/docs/classes/Matrix.html +1 -1
  20. package/dist/docs/classes/MouseEvent.html +1 -1
  21. package/dist/docs/classes/PaperScope.html +88 -1
  22. package/dist/docs/classes/PaperScript.html +2 -1
  23. package/dist/docs/classes/Path.html +232 -72
  24. package/dist/docs/classes/PathItem.html +337 -180
  25. package/dist/docs/classes/Point.html +143 -21
  26. package/dist/docs/classes/PointText.html +151 -27
  27. package/dist/docs/classes/Project.html +201 -8
  28. package/dist/docs/classes/Raster.html +150 -38
  29. package/dist/docs/classes/Rectangle.html +12 -11
  30. package/dist/docs/classes/Segment.html +1 -1
  31. package/dist/docs/classes/Shape.html +120 -27
  32. package/dist/docs/classes/Size.html +81 -21
  33. package/dist/docs/classes/Style.html +35 -3
  34. package/dist/docs/classes/SymbolDefinition.html +1 -1
  35. package/dist/docs/classes/SymbolItem.html +121 -28
  36. package/dist/docs/classes/TextItem.html +151 -27
  37. package/dist/docs/classes/Tool.html +127 -1
  38. package/dist/docs/classes/ToolEvent.html +27 -1
  39. package/dist/docs/classes/Tween.html +1 -1
  40. package/dist/docs/classes/View.html +345 -10
  41. package/dist/docs/classes/global.html +1 -1
  42. package/dist/docs/classes/index.html +2 -2
  43. package/dist/docs/index.html +1 -1
  44. package/dist/node/canvas.js +1 -1
  45. package/dist/node/self.js +4 -3
  46. package/dist/paper-core.js +1182 -465
  47. package/dist/paper-core.min.js +3 -3
  48. package/dist/paper-full.js +1210 -481
  49. package/dist/paper-full.min.js +3 -3
  50. package/dist/paper-sourced.js +18631 -0
  51. package/dist/paper.d.ts +606 -78
  52. package/examples/Rasters/Smoothing.html +1 -1
  53. package/package.json +6 -17
  54. package/dist/node/xml.js +0 -40
@@ -770,6 +770,32 @@ var shape = new Shape.Ellipse({
770
770
  <div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
771
771
 
772
772
 
773
+ <div id="key" class="member">
774
+ <div class="member-link">
775
+ <a name="key" href="#key"><tt><b>key</b></tt></a>
776
+ </div>
777
+ <div class="member-description hidden">
778
+
779
+ <div class="member-text">
780
+ <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>
781
+
782
+
783
+
784
+ <ul class="member-list">
785
+ <h4>Type:</h4>
786
+ <li>
787
+ <tt>Number</tt>
788
+ </li>
789
+ </ul>
790
+
791
+
792
+
793
+ </div>
794
+
795
+ </div>
796
+ </div>
797
+
798
+
773
799
  <div id="id" class="member">
774
800
  <div class="member-link">
775
801
  <a name="id" href="#id"><tt><b>id</b></tt></a>
@@ -889,6 +915,7 @@ group.children['example'].fillColor = 'red';
889
915
 
890
916
  <div class="member-text">
891
917
  <p>The path style of the item.</p>
918
+ <p>Styles set on a <a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a> are applied to the children that it contains at that moment. Items added to it later do not receive them.</p>
892
919
 
893
920
 
894
921
 
@@ -1231,6 +1258,37 @@ circle2.opacity = 0.5;
1231
1258
  </div>
1232
1259
 
1233
1260
 
1261
+ </div>
1262
+
1263
+ </div>
1264
+ </div>
1265
+
1266
+
1267
+ <div id="guide" class="member">
1268
+ <div class="member-link">
1269
+ <a name="guide" href="#guide"><tt><b>guide</b></tt></a>
1270
+ </div>
1271
+ <div class="member-description hidden">
1272
+
1273
+ <div class="member-text">
1274
+ <p>Specifies whether the item functions as a guide. When set to <code>true</code>, the item is drawn as usual, but left out of hit-tests and mouse interactions. Hit-tests only find guides when <code>options.guides</code> is set, and then only them, see <a href="../classes/Item.html#hittest-point"><tt>hitTest(point[, options])</tt></a>.</p>
1275
+
1276
+
1277
+
1278
+ <ul class="member-list">
1279
+ <h4>Default:</h4>
1280
+ <li><tt>false</tt></li>
1281
+ </ul>
1282
+
1283
+ <ul class="member-list">
1284
+ <h4>Type:</h4>
1285
+ <li>
1286
+ <tt>Boolean</tt>
1287
+ </li>
1288
+ </ul>
1289
+
1290
+
1291
+
1234
1292
  </div>
1235
1293
 
1236
1294
  </div>
@@ -1821,6 +1879,34 @@ circle.position.x += 100;
1821
1879
 
1822
1880
 
1823
1881
 
1882
+ </div>
1883
+
1884
+ </div>
1885
+ </div>
1886
+
1887
+
1888
+ <div id="scope" class="member">
1889
+ <div class="member-link">
1890
+ <a name="scope" href="#scope"><tt><b>scope</b></tt></a>
1891
+ </div>
1892
+ <div class="member-description hidden">
1893
+
1894
+ <div class="member-text">
1895
+ <p>The scope that this item belongs to, through its project.</p>
1896
+
1897
+ <p>Read only.</p>
1898
+
1899
+
1900
+
1901
+ <ul class="member-list">
1902
+ <h4>Type:</h4>
1903
+ <li>
1904
+ <a href="../classes/PaperScope.html"><tt>PaperScope</tt></a>
1905
+ </li>
1906
+ </ul>
1907
+
1908
+
1909
+
1824
1910
  </div>
1825
1911
 
1826
1912
  </div>
@@ -1934,6 +2020,7 @@ console.log(group.children[0] == path); // true</code></pre>
1934
2020
 
1935
2021
  <div class="member-text">
1936
2022
  <p>The children items contained within this item. Items that define a <a href="../classes/Item.html#name"><tt>name</tt></a> can also be accessed by name.</p>
2023
+ <p>Only <a href="../classes/Group.html"><tt>Group</tt></a>, <a href="../classes/Layer.html"><tt>Layer</tt></a> and <a href="../classes/CompoundPath.html"><tt>CompoundPath</tt></a> items can have children. On all other items, such as <a href="../classes/Path.html"><tt>Path</tt></a>, <a href="../classes/Shape.html"><tt>Shape</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/SymbolItem.html"><tt>SymbolItem</tt></a> and <a href="../classes/PointText.html"><tt>PointText</tt></a>, <code>children</code> is <code>undefined</code>.</p>
1937
2024
  <p><b>Please note:</b> The children array should not be modified directly using array functions. To remove single items from the children list, use <a href="../classes/Item.html#remove"><tt>item.remove</tt></a>(), to remove all items from the children list, use <a href="../classes/Item.html#removechildren"><tt>item.removeChildren</tt></a>(). To add items to the children list, use <a href="../classes/Item.html#addchild-item"><tt>item.addChild(item)</tt></a> or <a href="../classes/Item.html#insertchild-index-item"><tt>item.insertChild(index, item)</tt></a>.</p>
1938
2025
 
1939
2026
 
@@ -2435,7 +2522,7 @@ path3.strokeJoin = 'bevel';
2435
2522
  <div class="member-description hidden">
2436
2523
 
2437
2524
  <div class="member-text">
2438
- <p>Specifies whether the stroke is to be drawn taking the current affine transformation into account (the default behavior), or whether it should appear as a non-scaling stroke.</p>
2525
+ <p>Specifies whether the stroke is to be drawn taking the current affine transformation into account (the default behavior), or whether it should appear as a non-scaling stroke. On text, non-scaling strokes are exact for uniform scaling only, as the glyphs are always stroked through the transformation.</p>
2439
2526
 
2440
2527
 
2441
2528
 
@@ -3874,22 +3961,22 @@ function onMouseDown(event) {
3874
3961
  <div class="member-description hidden">
3875
3962
  <div class="member-text">
3876
3963
  <p>Performs a hit-test on the item and its children (if it is a <a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point, returning the first found hit.</p>
3877
- <p>The options object allows you to control the specifics of the hit- test and may contain a combination of the following values:</p>
3964
+ <p>The options object allows you to control the specifics of the hit-test. Without options, <code>fill</code>, <code>stroke</code> and <code>segments</code> are hit-tested. As soon as an options object is passed, only the hit-tests that it sets to <code>true</code> are performed. It may contain a combination of the following values:</p>
3878
3965
  <ul class="member-list">
3879
3966
  <h4>Options:</h4>
3880
- <li><tt>options.tolerance: <tt>Number</tt></tt> &mdash; the tolerance of the hit-test &mdash;&nbsp;default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.hitTolerance</tt></li>
3967
+ <li><tt>options.tolerance: <tt>Number</tt></tt> &mdash; the tolerance of the hit-test, in project coordinates &mdash;&nbsp;default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.hitTolerance</tt></li>
3881
3968
  <li><tt>options.class: <tt>Function</tt></tt> &mdash; only hit-test against a specific item class, or any of its sub-classes, by providing the constructor function against which an <code>instanceof</code> check is performed: <tt>Group</tt>, <tt>Layer</tt>, <tt>Path</tt>, <tt>CompoundPath</tt>, <tt>Shape</tt>, <tt>Raster</tt>, <tt>SymbolItem</tt>, <tt>PointText</tt>, &hellip;</li>
3882
3969
  <li><tt>options.match: <tt>Function</tt></tt> &mdash; a match function to be called for each found hit result: Return <code>true</code> to return the result, <code>false</code> to keep searching</li>
3883
- <li><tt>options.fill: <tt>Boolean</tt></tt> &mdash; hit-test the fill of items &mdash;&nbsp;default: <tt>true</tt></li>
3884
- <li><tt>options.stroke: <tt>Boolean</tt></tt> &mdash; hit-test the stroke of path items, taking into account the setting of stroke color and width &mdash;&nbsp;default: <tt>true</tt></li>
3885
- <li><tt>options.segments: <tt>Boolean</tt></tt> &mdash; hit-test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of <a href="../classes/Path.html"><tt>Path</tt></a> items &mdash;&nbsp;default: <tt>true</tt></li>
3970
+ <li><tt>options.fill: <tt>Boolean</tt></tt> &mdash; hit-test the fill of items</li>
3971
+ <li><tt>options.stroke: <tt>Boolean</tt></tt> &mdash; hit-test the stroke of path items, taking into account the setting of stroke color and width</li>
3972
+ <li><tt>options.segments: <tt>Boolean</tt></tt> &mdash; hit-test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of <a href="../classes/Path.html"><tt>Path</tt></a> items</li>
3886
3973
  <li><tt>options.curves: <tt>Boolean</tt></tt> &mdash; hit-test the curves of path items, without taking the stroke color or width into account</li>
3887
3974
  <li><tt>options.handles: <tt>Boolean</tt></tt> &mdash; hit-test for the handles (<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</li>
3888
3975
  <li><tt>options.ends: <tt>Boolean</tt></tt> &mdash; only hit-test for the first or last segment points of open path items</li>
3889
3976
  <li><tt>options.position: <tt>Boolean</tt></tt> &mdash; hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
3890
3977
  <li><tt>options.center: <tt>Boolean</tt></tt> &mdash; hit-test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a> of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>)</li>
3891
3978
  <li><tt>options.bounds: <tt>Boolean</tt></tt> &mdash; hit-test the corners and side-centers of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>)</li>
3892
- <li><tt>options.guides: <tt>Boolean</tt></tt> &mdash; hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
3979
+ <li><tt>options.guides: <tt>Boolean</tt></tt> &mdash; only hit-test items that have <a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <code>true</code></li>
3893
3980
  <li><tt>options.selected: <tt>Boolean</tt></tt> &mdash; only hit selected items</li>
3894
3981
  </ul>
3895
3982
 
@@ -4128,7 +4215,7 @@ function onMouseDown(event) {
4128
4215
  <h4>Returns:</h4>
4129
4216
 
4130
4217
  <li>
4131
- <tt>Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the list of matching descendant items
4218
+ <tt>Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the list of matching descendant items, in their stacking order from bottom to top, with each item listed before its own descendants
4132
4219
  </li>
4133
4220
 
4134
4221
 
@@ -4301,6 +4388,8 @@ function onMouseDown(event) {
4301
4388
  <li><tt>options.precision: <tt>Number</tt></tt> &mdash; the amount of fractional digits in numbers used in SVG data &mdash;&nbsp;default: <tt>5</tt></li>
4302
4389
  <li><tt>options.matchShapes: <tt>Boolean</tt></tt> &mdash; whether path items should tried to be converted to SVG shape items (rect, circle, ellipse, line, polyline, polygon), if their geometries match &mdash;&nbsp;default: <tt>false</tt></li>
4303
4390
  <li><tt>options.embedImages: <tt>Boolean</tt></tt> &mdash; whether raster images should be embedded as base64 data inlined in the xlink:href attribute, or kept as a link to their external URL. &mdash;&nbsp;default: <tt>true</tt></li>
4391
+ <li><tt>options.reuseImages: <tt>Boolean</tt></tt> &mdash; whether raster images with the same content should only be exported once into the <code>&lt;defs&gt;</code> element, and placed through <code>&lt;use&gt;</code> elements referencing it &mdash;&nbsp;default: <tt>false</tt></li>
4392
+ <li><tt>options.idPrefix: <tt>String</tt></tt> &mdash; a prefix for the ids generated for definitions such as gradients, clip paths and symbols, to keep them unique when several exported SVGs are placed in one document &mdash;&nbsp;default: <tt>&rsquo;&rsquo;</tt></li>
4304
4393
  <li><tt>options.reduceAttributes: <tt>Boolean</tt></tt> &mdash; wether to only include style attributes in the SVG output that differ from their parents, or to always include them (much faster but leading to redundancies). &mdash;&nbsp;default: <tt>true</tt></li>
4305
4394
  </ul>
4306
4395
 
@@ -4343,9 +4432,13 @@ function onMouseDown(event) {
4343
4432
  <div class="member-description hidden">
4344
4433
  <div class="member-text">
4345
4434
  <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>
4435
+ <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>
4346
4436
  <ul class="member-list">
4347
4437
  <h4>Options:</h4>
4348
4438
  <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>
4439
+ <li>[options.crossOrigin] {String} the {@link Raster#crossOrigin}
4440
+ value of the rasters created for `<image>` elements, to load their
4441
+ images with CORS</li>
4349
4442
  <li><tt>options.onLoad: <tt>Function</tt></tt> &mdash; the callback function to call once the SVG content is loaded from the given URL receiving two arguments: the converted <code>item</code> and the original <code>svg</code> data as a string. Only required when loading from external resources.</li>
4350
4443
  <li><tt>options.onError: <tt>Function</tt></tt> &mdash; the callback function to call if an error occurs during loading. Only required when loading from external resources.</li>
4351
4444
  <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the imported items should be added to the item that <code>importSVG()</code> is called on &mdash;&nbsp;default: <tt>true</tt></li>
@@ -4821,9 +4914,9 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4821
4914
  </div>
4822
4915
 
4823
4916
 
4824
- <div id="reduce-options" class="member">
4917
+ <div id="reduce" class="member">
4825
4918
  <div class="member-link">
4826
- <a name="reduce-options" href="#reduce-options"><tt><b>reduce</b>(options)</tt></a>
4919
+ <a name="reduce" href="#reduce"><tt><b>reduce</b>([options])</tt></a>
4827
4920
  </div>
4828
4921
  <div class="member-description hidden">
4829
4922
  <div class="member-text">
@@ -4835,9 +4928,9 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4835
4928
 
4836
4929
  <li>
4837
4930
  <tt>options:</tt>
4838
-
4839
-
4840
-
4931
+ <tt>Object</tt>
4932
+ &mdash;&nbsp;the options passed on to <a href="../classes/Path.html#reduce-options"><tt>path.reduce(options)</tt></a>
4933
+ &mdash;&nbsp;optional
4841
4934
  </li>
4842
4935
 
4843
4936
  </ul>
@@ -5079,7 +5172,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
5079
5172
  </div>
5080
5173
  <div class="member-description hidden">
5081
5174
  <div class="member-text">
5082
- <p>Checks whether the item has a fill.</p>
5175
+ <p>Checks whether the item has a visible fill, a fill color with an alpha above 0. Hit-tests also hit transparent fills, see <a href="../classes/Item.html#hittest"><tt>hitTest</tt></a>.</p>
5083
5176
 
5084
5177
 
5085
5178
 
@@ -5087,7 +5180,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
5087
5180
  <h4>Returns:</h4>
5088
5181
 
5089
5182
  <li>
5090
- <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item has a fill, <tt>false</tt> otherwise
5183
+ <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item has a visible fill, <tt>false</tt> otherwise
5091
5184
  </li>
5092
5185
 
5093
5186
 
@@ -5226,7 +5319,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
5226
5319
  </div>
5227
5320
  <div class="member-description hidden">
5228
5321
  <div class="member-text">
5229
- <p>Checks if this item is above the specified item in the stacking order of the project.</p>
5322
+ <p>Checks if this item is above the specified item in the stacking order of the project. If one item is a descendant of the other, neither is above the other and <code>false</code> is returned.</p>
5230
5323
 
5231
5324
 
5232
5325
  <ul class="member-list">
@@ -5267,7 +5360,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
5267
5360
  </div>
5268
5361
  <div class="member-description hidden">
5269
5362
  <div class="member-text">
5270
- <p>Checks if the item is below the specified item in the stacking order of the project.</p>
5363
+ <p>Checks if the item is below the specified item in the stacking order of the project. If one item is a descendant of the other, neither is below the other and <code>false</code> is returned.</p>
5271
5364
 
5272
5365
 
5273
5366
  <ul class="member-list">
@@ -6225,11 +6318,11 @@ circle.scale(3, 1);
6225
6318
 
6226
6319
  <div id="fitbounds-rectangle" class="member">
6227
6320
  <div class="member-link">
6228
- <a name="fitbounds-rectangle" href="#fitbounds-rectangle"><tt><b>fitBounds</b>(rectangle[, fill])</tt></a>
6321
+ <a name="fitbounds-rectangle" href="#fitbounds-rectangle"><tt><b>fitBounds</b>(rectangle[, fit])</tt></a>
6229
6322
  </div>
6230
6323
  <div class="member-description hidden">
6231
6324
  <div class="member-text">
6232
- <p>Transform the item so that its <a href="../classes/Item.html#bounds"><tt>bounds</tt></a> fit within the specified rectangle, without changing its aspect ratio.</p>
6325
+ <p>Transform the item so that its <a href="../classes/Item.html#bounds"><tt>bounds</tt></a> are centered in the specified rectangle and fitted to it as described by <code>fit</code>.</p>
6233
6326
 
6234
6327
 
6235
6328
  <ul class="member-list">
@@ -6243,10 +6336,10 @@ circle.scale(3, 1);
6243
6336
  </li>
6244
6337
 
6245
6338
  <li>
6246
- <tt>fill:</tt>
6247
- <tt>Boolean</tt>
6248
-
6249
- &mdash;&nbsp;optional, default: <tt>false</tt>
6339
+ <tt>fit:</tt>
6340
+ <tt>String</tt>⟋<tt>Boolean</tt>
6341
+ &mdash;&nbsp;how to fit the item, as in CSS&rsquo;s <code>object-fit</code>: <code>&#39;contain&#39;</code> fits all of it within the rectangle, <code>&#39;cover&#39;</code> makes it cover the whole rectangle, and <code>&#39;fill&#39;</code> stretches it to the rectangle, changing its aspect ratio. The deprecated <code>true</code> and <code>false</code> stand for <code>&#39;cover&#39;</code> and <code>&#39;contain&#39;</code>.
6342
+ &mdash;&nbsp;optional, default: <tt>&lsquo;contain&rsquo;</tt>
6250
6343
  </li>
6251
6344
 
6252
6345
  </ul>
@@ -6288,7 +6381,7 @@ circlePath.fitBounds(path.bounds);
6288
6381
  </div>
6289
6382
 
6290
6383
 
6291
- <h4>Example:<span class="description">Fitting an item to the bounding rectangle of another item's bounding rectangle with the fill parameter set to true:</span></h4>
6384
+ <h4>Example:<span class="description">Fitting an item to the bounding rectangle of another item's bounding rectangle, covering all of it:</span></h4>
6292
6385
 
6293
6386
  <div class="paperscript split">
6294
6387
 
@@ -6315,7 +6408,7 @@ var circlePath = new Path.Circle({
6315
6408
 
6316
6409
  // Fit the circlePath to the bounding rectangle of
6317
6410
  // the rectangular path:
6318
- circlePath.fitBounds(path.bounds, true);
6411
+ circlePath.fitBounds(path.bounds, 'cover');
6319
6412
  </script>
6320
6413
  <div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
6321
6414
  </div>
@@ -6965,7 +7058,7 @@ function onMouseDown(event) {
6965
7058
  <ul class="member-list">
6966
7059
  <h4>Options:</h4>
6967
7060
  <li><tt>options.duration: <tt>Number</tt></tt> &mdash; the duration of the tweening</li>
6968
- <li><tt>options.easing: <tt>Function</tt>⟋<tt>String</tt></tt> &mdash; an easing function or the type of the easing: <tt>&lsquo;linear&rsquo; &lsquo;easeInQuad&rsquo; &lsquo;easeOutQuad&rsquo; &lsquo;easeInOutQuad&rsquo; &lsquo;easeInCubic&rsquo; &lsquo;easeOutCubic&rsquo; &lsquo;easeInOutCubic&rsquo; &lsquo;easeInQuart&rsquo; &lsquo;easeOutQuart&rsquo; &lsquo;easeInOutQuart&rsquo; &lsquo;easeInQuint&rsquo; &lsquo;easeOutQuint&rsquo; &lsquo;easeInOutQuint&rsquo;</tt> &mdash;&nbsp;default: <tt>&lsquo;linear&rsquo;</tt></li>
7061
+ <li><tt>options.easing: <tt>Function</tt>⟋<tt>String</tt></tt> &mdash; an easing function or the type of the easing: <tt>&lsquo;linear&rsquo; &lsquo;easeInQuad&rsquo; &lsquo;easeOutQuad&rsquo; &lsquo;easeInOutQuad&rsquo; &lsquo;easeInCubic&rsquo; &lsquo;easeOutCubic&rsquo; &lsquo;easeInOutCubic&rsquo; &lsquo;easeInQuart&rsquo; &lsquo;easeOutQuart&rsquo; &lsquo;easeInOutQuart&rsquo; &lsquo;easeInQuint&rsquo; &lsquo;easeOutQuint&rsquo; &lsquo;easeInOutQuint&rsquo; &lsquo;easeInSine&rsquo; &lsquo;easeOutSine&rsquo; &lsquo;easeInOutSine&rsquo; &lsquo;easeInExpo&rsquo; &lsquo;easeOutExpo&rsquo; &lsquo;easeInOutExpo&rsquo; &lsquo;easeInCirc&rsquo; &lsquo;easeOutCirc&rsquo; &lsquo;easeInOutCirc&rsquo;</tt> &mdash;&nbsp;default: <tt>&lsquo;linear&rsquo;</tt></li>
6969
7062
  <li><tt>options.start: <tt>Boolean</tt></tt> &mdash; whether to start tweening automatically &mdash;&nbsp;default: <tt>true</tt></li>
6970
7063
  </ul>
6971
7064
 
@@ -7353,7 +7446,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7353
7446
 
7354
7447
  <!-- =========================== copyright notice ========================== -->
7355
7448
  <p class="footer">
7356
- Paper.js v0.12.20<br>
7449
+ Paper.js v0.14.0<br>
7357
7450
  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>
7358
7451
  <div class="content-end"></div>
7359
7452
 
@@ -320,7 +320,8 @@ console.log(size.height); // 50</code></pre>
320
320
 
321
321
 
322
322
  <pre><code>var size = new Size(5, 10);
323
- var result = size + 20;
323
+ var result = size + 20; // PaperScript
324
+ var result = size.add(20); // JavaScript
324
325
  console.log(result); // {width: 25, height: 30}</code></pre>
325
326
 
326
327
  </div>
@@ -361,7 +362,8 @@ console.log(result); // {width: 25, height: 30}</code></pre>
361
362
 
362
363
  <pre><code>var size1 = new Size(5, 10);
363
364
  var size2 = new Size(10, 20);
364
- var result = size1 + size2;
365
+ var result = size1 + size2; // PaperScript
366
+ var result = size1.add(size2); // JavaScript
365
367
  console.log(result); // {width: 15, height: 30}</code></pre>
366
368
 
367
369
  </div>
@@ -411,7 +413,8 @@ console.log(result); // {width: 15, height: 30}</code></pre>
411
413
 
412
414
 
413
415
  <pre><code>var size = new Size(10, 20);
414
- var result = size - 5;
416
+ var result = size - 5; // PaperScript
417
+ var result = size.subtract(5); // JavaScript
415
418
  console.log(result); // {width: 5, height: 15}</code></pre>
416
419
 
417
420
  </div>
@@ -452,7 +455,8 @@ console.log(result); // {width: 5, height: 15}</code></pre>
452
455
 
453
456
  <pre><code>var firstSize = new Size(10, 20);
454
457
  var secondSize = new Size(5, 5);
455
- var result = firstSize - secondSize;
458
+ var result = firstSize - secondSize; // PaperScript
459
+ var result = firstSize.subtract(secondSize); // JavaScript
456
460
  console.log(result); // {width: 5, height: 15}</code></pre>
457
461
 
458
462
  </div>
@@ -502,7 +506,8 @@ console.log(result); // {width: 5, height: 15}</code></pre>
502
506
 
503
507
 
504
508
  <pre><code>var size = new Size(10, 20);
505
- var result = size * 2;
509
+ var result = size * 2; // PaperScript
510
+ var result = size.multiply(2); // JavaScript
506
511
  console.log(result); // {width: 20, height: 40}</code></pre>
507
512
 
508
513
  </div>
@@ -543,7 +548,8 @@ console.log(result); // {width: 20, height: 40}</code></pre>
543
548
 
544
549
  <pre><code>var firstSize = new Size(5, 10);
545
550
  var secondSize = new Size(4, 2);
546
- var result = firstSize * secondSize;
551
+ var result = firstSize * secondSize; // PaperScript
552
+ var result = firstSize.multiply(secondSize); // JavaScript
547
553
  console.log(result); // {width: 20, height: 20}</code></pre>
548
554
 
549
555
  </div>
@@ -593,7 +599,8 @@ console.log(result); // {width: 20, height: 20}</code></pre>
593
599
 
594
600
 
595
601
  <pre><code>var size = new Size(10, 20);
596
- var result = size / 2;
602
+ var result = size / 2; // PaperScript
603
+ var result = size.divide(2); // JavaScript
597
604
  console.log(result); // {width: 5, height: 10}</code></pre>
598
605
 
599
606
  </div>
@@ -634,7 +641,8 @@ console.log(result); // {width: 5, height: 10}</code></pre>
634
641
 
635
642
  <pre><code>var firstSize = new Size(8, 10);
636
643
  var secondSize = new Size(2, 5);
637
- var result = firstSize / secondSize;
644
+ var result = firstSize / secondSize; // PaperScript
645
+ var result = firstSize.divide(secondSize); // JavaScript
638
646
  console.log(result); // {width: 4, height: 2}</code></pre>
639
647
 
640
648
  </div>
@@ -684,7 +692,9 @@ console.log(result); // {width: 4, height: 2}</code></pre>
684
692
 
685
693
 
686
694
  <pre><code>var size = new Size(12, 6);
687
- console.log(size % 5); // {width: 2, height: 1}</code></pre>
695
+ var result = size % 5; // PaperScript
696
+ var result = size.modulo(5); // JavaScript
697
+ console.log(result); // {width: 2, height: 1}</code></pre>
688
698
 
689
699
  </div>
690
700
 
@@ -723,7 +733,9 @@ console.log(size % 5); // {width: 2, height: 1}</code></pre>
723
733
 
724
734
 
725
735
  <pre><code>var size = new Size(12, 6);
726
- console.log(size % new Size(5, 2)); // {width: 2, height: 0}</code></pre>
736
+ var result = size % new Size(5, 2); // PaperScript
737
+ var result = size.modulo(new Size(5, 2)); // JavaScript
738
+ console.log(result); // {width: 2, height: 0}</code></pre>
727
739
 
728
740
  </div>
729
741
 
@@ -945,6 +957,42 @@ console.log(size != new Size(1, 1)); // true</code></pre>
945
957
 
946
958
 
947
959
 
960
+ </div>
961
+ </div>
962
+ </div>
963
+
964
+
965
+ <div id="negate" class="member">
966
+ <div class="member-link">
967
+ <a name="negate" href="#negate"><tt><b>negate</b>()</tt></a>
968
+ </div>
969
+ <div class="member-description hidden">
970
+ <div class="member-text">
971
+ <p>Returns a new size with both dimensions negated. PaperScript uses it for the unary minus operator. The object itself is not modified!</p>
972
+
973
+
974
+
975
+ <ul class="member-list">
976
+ <h4>Returns:</h4>
977
+
978
+ <li>
979
+ <tt><a href="../classes/Size.html"><tt>Size</tt></a></tt>&nbsp;&mdash;&nbsp;the negation of the size as a new size
980
+ </li>
981
+
982
+
983
+ </ul>
984
+
985
+
986
+
987
+
988
+ <h4>Example:</h4>
989
+
990
+
991
+ <pre><code>var size = new Size(12, -6);
992
+ var result = -size; // PaperScript
993
+ var result = size.negate(); // JavaScript
994
+ console.log(result); // {width: -12, height: 6}</code></pre>
995
+
948
996
  </div>
949
997
  </div>
950
998
  </div>
@@ -1196,7 +1244,8 @@ console.log(absSize); // {x: 5, y: 10}</code></pre>
1196
1244
 
1197
1245
 
1198
1246
  <pre><code>var size = new Size(5, 10);
1199
- var result = size + 20;
1247
+ var result = size + 20; // PaperScript
1248
+ var result = size.add(20); // JavaScript
1200
1249
  console.log(result); // {width: 25, height: 30}</code></pre>
1201
1250
 
1202
1251
  </div>
@@ -1244,7 +1293,8 @@ console.log(result); // {width: 25, height: 30}</code></pre>
1244
1293
 
1245
1294
  <pre><code>var size1 = new Size(5, 10);
1246
1295
  var size2 = new Size(10, 20);
1247
- var result = size1 + size2;
1296
+ var result = size1 + size2; // PaperScript
1297
+ var result = size1.add(size2); // JavaScript
1248
1298
  console.log(result); // {width: 15, height: 30}</code></pre>
1249
1299
 
1250
1300
  </div>
@@ -1294,7 +1344,8 @@ console.log(result); // {width: 15, height: 30}</code></pre>
1294
1344
 
1295
1345
 
1296
1346
  <pre><code>var size = new Size(10, 20);
1297
- var result = size - 5;
1347
+ var result = size - 5; // PaperScript
1348
+ var result = size.subtract(5); // JavaScript
1298
1349
  console.log(result); // {width: 5, height: 15}</code></pre>
1299
1350
 
1300
1351
  </div>
@@ -1342,7 +1393,8 @@ console.log(result); // {width: 5, height: 15}</code></pre>
1342
1393
 
1343
1394
  <pre><code>var firstSize = new Size(10, 20);
1344
1395
  var secondSize = new Size(5, 5);
1345
- var result = firstSize - secondSize;
1396
+ var result = firstSize - secondSize; // PaperScript
1397
+ var result = firstSize.subtract(secondSize); // JavaScript
1346
1398
  console.log(result); // {width: 5, height: 15}</code></pre>
1347
1399
 
1348
1400
  </div>
@@ -1392,7 +1444,8 @@ console.log(result); // {width: 5, height: 15}</code></pre>
1392
1444
 
1393
1445
 
1394
1446
  <pre><code>var size = new Size(10, 20);
1395
- var result = size * 2;
1447
+ var result = size * 2; // PaperScript
1448
+ var result = size.multiply(2); // JavaScript
1396
1449
  console.log(result); // {width: 20, height: 40}</code></pre>
1397
1450
 
1398
1451
  </div>
@@ -1440,7 +1493,8 @@ console.log(result); // {width: 20, height: 40}</code></pre>
1440
1493
 
1441
1494
  <pre><code>var firstSize = new Size(5, 10);
1442
1495
  var secondSize = new Size(4, 2);
1443
- var result = firstSize * secondSize;
1496
+ var result = firstSize * secondSize; // PaperScript
1497
+ var result = firstSize.multiply(secondSize); // JavaScript
1444
1498
  console.log(result); // {width: 20, height: 20}</code></pre>
1445
1499
 
1446
1500
  </div>
@@ -1490,7 +1544,8 @@ console.log(result); // {width: 20, height: 20}</code></pre>
1490
1544
 
1491
1545
 
1492
1546
  <pre><code>var size = new Size(10, 20);
1493
- var result = size / 2;
1547
+ var result = size / 2; // PaperScript
1548
+ var result = size.divide(2); // JavaScript
1494
1549
  console.log(result); // {width: 5, height: 10}</code></pre>
1495
1550
 
1496
1551
  </div>
@@ -1538,7 +1593,8 @@ console.log(result); // {width: 5, height: 10}</code></pre>
1538
1593
 
1539
1594
  <pre><code>var firstSize = new Size(8, 10);
1540
1595
  var secondSize = new Size(2, 5);
1541
- var result = firstSize / secondSize;
1596
+ var result = firstSize / secondSize; // PaperScript
1597
+ var result = firstSize.divide(secondSize); // JavaScript
1542
1598
  console.log(result); // {width: 4, height: 2}</code></pre>
1543
1599
 
1544
1600
  </div>
@@ -1588,7 +1644,9 @@ console.log(result); // {width: 4, height: 2}</code></pre>
1588
1644
 
1589
1645
 
1590
1646
  <pre><code>var size = new Size(12, 6);
1591
- console.log(size % 5); // {width: 2, height: 1}</code></pre>
1647
+ var result = size % 5; // PaperScript
1648
+ var result = size.modulo(5); // JavaScript
1649
+ console.log(result); // {width: 2, height: 1}</code></pre>
1592
1650
 
1593
1651
  </div>
1594
1652
  </div>
@@ -1634,7 +1692,9 @@ console.log(size % 5); // {width: 2, height: 1}</code></pre>
1634
1692
 
1635
1693
 
1636
1694
  <pre><code>var size = new Size(12, 6);
1637
- console.log(size % new Size(5, 2)); // {width: 2, height: 0}</code></pre>
1695
+ var result = size % new Size(5, 2); // PaperScript
1696
+ var result = size.modulo(new Size(5, 2)); // JavaScript
1697
+ console.log(result); // {width: 2, height: 0}</code></pre>
1638
1698
 
1639
1699
  </div>
1640
1700
  </div>
@@ -1816,7 +1876,7 @@ var size = maxSize * randomSize;</code></pre>
1816
1876
 
1817
1877
  <!-- =========================== copyright notice ========================== -->
1818
1878
  <p class="footer">
1819
- Paper.js v0.12.20<br>
1879
+ Paper.js v0.14.0<br>
1820
1880
  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>
1821
1881
  <div class="content-end"></div>
1822
1882
 
@@ -17,6 +17,7 @@
17
17
 
18
18
  <p>Style is used for changing the visual styles of items contained within a Paper.js project and is returned by <a href="../classes/Item.html#style"><tt>item.style</tt></a> and <a href="../classes/Project.html#currentstyle"><tt>project.currentStyle</tt></a>.</p>
19
19
  <p>All properties of Style are also reflected directly in <a href="../classes/Item.html"><tt>Item</tt></a>, i.e.: <a href="../classes/Item.html#fillcolor"><tt>item.fillColor</tt></a>.</p>
20
+ <p>Styles set on a <a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a> are applied to the children that it contains at that moment. Items added to it later do not receive them.</p>
20
21
  <p>To set multiple style properties in one go, you can pass an object to <a href="../classes/Item.html#style"><tt>item.style</tt></a>. This is a convenient way to define a style once and apply it to a series of items:</p>
21
22
  <h4>Example:<span class="description">Styling paths</span></h4>
22
23
 
@@ -83,7 +84,7 @@ var path2 = new Path.Rectangle({
83
84
  var group = new Group(path1, path2);
84
85
 
85
86
  // All styles set on a group are automatically
86
- // set on the children of the group:
87
+ // set on the current children of the group:
87
88
  group.style = {
88
89
  strokeColor: 'black',
89
90
  dashArray: [4, 10],
@@ -375,7 +376,7 @@ path3.strokeJoin = 'bevel';
375
376
  <div class="member-description hidden">
376
377
 
377
378
  <div class="member-text">
378
- <p>Specifies whether the stroke is to be drawn taking the current affine transformation into account (the default behavior), or whether it should appear as a non-scaling stroke.</p>
379
+ <p>Specifies whether the stroke is to be drawn taking the current affine transformation into account (the default behavior), or whether it should appear as a non-scaling stroke. On text, non-scaling strokes are exact for uniform scaling only, as the glyphs are always stroked through the transformation.</p>
379
380
 
380
381
 
381
382
 
@@ -856,6 +857,37 @@ var circle = new Path.Circle({
856
857
 
857
858
 
858
859
 
860
+ </div>
861
+
862
+ </div>
863
+ </div>
864
+
865
+
866
+ <div id="tracking" class="member">
867
+ <div class="member-link">
868
+ <a name="tracking" href="#tracking"><tt><b>tracking</b></tt></a>
869
+ </div>
870
+ <div class="member-description hidden">
871
+
872
+ <div class="member-text">
873
+ <p>The tracking of text content: the space added after each character, in thousandths of an em, as in Adobe Illustrator and InDesign. A tracking of 100 adds a tenth of the font size.</p>
874
+
875
+
876
+
877
+ <ul class="member-list">
878
+ <h4>Default:</h4>
879
+ <li><tt>0</tt></li>
880
+ </ul>
881
+
882
+ <ul class="member-list">
883
+ <h4>Type:</h4>
884
+ <li>
885
+ <tt>Number</tt>
886
+ </li>
887
+ </ul>
888
+
889
+
890
+
859
891
  </div>
860
892
 
861
893
  </div>
@@ -910,7 +942,7 @@ var circle = new Path.Circle({
910
942
 
911
943
  <!-- =========================== copyright notice ========================== -->
912
944
  <p class="footer">
913
- Paper.js v0.12.20<br>
945
+ Paper.js v0.14.0<br>
914
946
  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>
915
947
  <div class="content-end"></div>
916
948
 
@@ -302,7 +302,7 @@ for (var i = 0; i < 100; i++) {
302
302
 
303
303
  <!-- =========================== copyright notice ========================== -->
304
304
  <p class="footer">
305
- Paper.js v0.12.20<br>
305
+ Paper.js v0.14.0<br>
306
306
  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>
307
307
  <div class="content-end"></div>
308
308