paper 0.12.19 → 0.13.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 (51) hide show
  1. package/CHANGELOG.md +250 -0
  2. package/README.md +34 -27
  3. package/dist/docs/assets/js/paper.js +791 -366
  4. package/dist/docs/classes/Color.html +63 -47
  5. package/dist/docs/classes/CompoundPath.html +162 -59
  6. package/dist/docs/classes/Curve.html +9 -7
  7. package/dist/docs/classes/CurveLocation.html +1 -1
  8. package/dist/docs/classes/Event.html +1 -1
  9. package/dist/docs/classes/Gradient.html +1 -1
  10. package/dist/docs/classes/GradientStop.html +1 -1
  11. package/dist/docs/classes/Group.html +63 -24
  12. package/dist/docs/classes/HitResult.html +1 -1
  13. package/dist/docs/classes/Item.html +63 -24
  14. package/dist/docs/classes/Key.html +1 -1
  15. package/dist/docs/classes/KeyEvent.html +1 -1
  16. package/dist/docs/classes/Layer.html +63 -24
  17. package/dist/docs/classes/Matrix.html +1 -1
  18. package/dist/docs/classes/MouseEvent.html +1 -1
  19. package/dist/docs/classes/PaperScope.html +87 -1
  20. package/dist/docs/classes/PaperScript.html +1 -1
  21. package/dist/docs/classes/Path.html +174 -68
  22. package/dist/docs/classes/PathItem.html +280 -177
  23. package/dist/docs/classes/Point.html +143 -21
  24. package/dist/docs/classes/PointText.html +94 -24
  25. package/dist/docs/classes/Project.html +14 -8
  26. package/dist/docs/classes/Raster.html +93 -35
  27. package/dist/docs/classes/Rectangle.html +12 -11
  28. package/dist/docs/classes/Segment.html +1 -1
  29. package/dist/docs/classes/Shape.html +63 -24
  30. package/dist/docs/classes/Size.html +81 -21
  31. package/dist/docs/classes/Style.html +34 -2
  32. package/dist/docs/classes/SymbolDefinition.html +1 -1
  33. package/dist/docs/classes/SymbolItem.html +64 -25
  34. package/dist/docs/classes/TextItem.html +94 -24
  35. package/dist/docs/classes/Tool.html +2 -1
  36. package/dist/docs/classes/ToolEvent.html +27 -1
  37. package/dist/docs/classes/Tween.html +1 -1
  38. package/dist/docs/classes/View.html +203 -10
  39. package/dist/docs/classes/global.html +1 -1
  40. package/dist/docs/classes/index.html +2 -2
  41. package/dist/docs/index.html +1 -1
  42. package/dist/node/canvas.js +10 -8
  43. package/dist/node/self.js +13 -4
  44. package/dist/paper-core.js +772 -355
  45. package/dist/paper-core.min.js +3 -3
  46. package/dist/paper-full.js +791 -366
  47. package/dist/paper-full.min.js +3 -3
  48. package/dist/paper.d.ts +324 -73
  49. package/examples/Rasters/Smoothing.html +1 -1
  50. package/package.json +5 -11
  51. package/dist/node/xml.js +0 -40
@@ -889,6 +889,7 @@ group.children['example'].fillColor = 'red';
889
889
 
890
890
  <div class="member-text">
891
891
  <p>The path style of the item.</p>
892
+ <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
893
 
893
894
 
894
895
 
@@ -1231,6 +1232,37 @@ circle2.opacity = 0.5;
1231
1232
  </div>
1232
1233
 
1233
1234
 
1235
+ </div>
1236
+
1237
+ </div>
1238
+ </div>
1239
+
1240
+
1241
+ <div id="guide" class="member">
1242
+ <div class="member-link">
1243
+ <a name="guide" href="#guide"><tt><b>guide</b></tt></a>
1244
+ </div>
1245
+ <div class="member-description hidden">
1246
+
1247
+ <div class="member-text">
1248
+ <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>
1249
+
1250
+
1251
+
1252
+ <ul class="member-list">
1253
+ <h4>Default:</h4>
1254
+ <li><tt>false</tt></li>
1255
+ </ul>
1256
+
1257
+ <ul class="member-list">
1258
+ <h4>Type:</h4>
1259
+ <li>
1260
+ <tt>Boolean</tt>
1261
+ </li>
1262
+ </ul>
1263
+
1264
+
1265
+
1234
1266
  </div>
1235
1267
 
1236
1268
  </div>
@@ -1934,6 +1966,7 @@ console.log(group.children[0] == path); // true</code></pre>
1934
1966
 
1935
1967
  <div class="member-text">
1936
1968
  <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>
1969
+ <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
1970
  <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
1971
 
1939
1972
 
@@ -3874,22 +3907,22 @@ function onMouseDown(event) {
3874
3907
  <div class="member-description hidden">
3875
3908
  <div class="member-text">
3876
3909
  <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>
3910
+ <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
3911
  <ul class="member-list">
3879
3912
  <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>
3913
+ <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
3914
  <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
3915
  <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>
3916
+ <li><tt>options.fill: <tt>Boolean</tt></tt> &mdash; hit-test the fill of items</li>
3917
+ <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>
3918
+ <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
3919
  <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
3920
  <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
3921
  <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
3922
  <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
3923
  <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
3924
  <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>
3925
+ <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
3926
  <li><tt>options.selected: <tt>Boolean</tt></tt> &mdash; only hit selected items</li>
3894
3927
  </ul>
3895
3928
 
@@ -4128,7 +4161,7 @@ function onMouseDown(event) {
4128
4161
  <h4>Returns:</h4>
4129
4162
 
4130
4163
  <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
4164
+ <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
4165
  </li>
4133
4166
 
4134
4167
 
@@ -4301,6 +4334,8 @@ function onMouseDown(event) {
4301
4334
  <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
4335
  <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
4336
  <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>
4337
+ <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>
4338
+ <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
4339
  <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
4340
  </ul>
4306
4341
 
@@ -4343,9 +4378,13 @@ function onMouseDown(event) {
4343
4378
  <div class="member-description hidden">
4344
4379
  <div class="member-text">
4345
4380
  <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>
4381
+ <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
4382
  <ul class="member-list">
4347
4383
  <h4>Options:</h4>
4348
4384
  <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>
4385
+ <li>[options.crossOrigin] {String} the {@link Raster#crossOrigin}
4386
+ value of the rasters created for `<image>` elements, to load their
4387
+ images with CORS</li>
4349
4388
  <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
4389
  <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
4390
  <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 +4860,9 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4821
4860
  </div>
4822
4861
 
4823
4862
 
4824
- <div id="reduce-options" class="member">
4863
+ <div id="reduce" class="member">
4825
4864
  <div class="member-link">
4826
- <a name="reduce-options" href="#reduce-options"><tt><b>reduce</b>(options)</tt></a>
4865
+ <a name="reduce" href="#reduce"><tt><b>reduce</b>([options])</tt></a>
4827
4866
  </div>
4828
4867
  <div class="member-description hidden">
4829
4868
  <div class="member-text">
@@ -4835,9 +4874,9 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4835
4874
 
4836
4875
  <li>
4837
4876
  <tt>options:</tt>
4838
-
4839
-
4840
-
4877
+ <tt>Object</tt>
4878
+ &mdash;&nbsp;the options passed on to <a href="../classes/Path.html#reduce-options"><tt>path.reduce(options)</tt></a>
4879
+ &mdash;&nbsp;optional
4841
4880
  </li>
4842
4881
 
4843
4882
  </ul>
@@ -5226,7 +5265,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
5226
5265
  </div>
5227
5266
  <div class="member-description hidden">
5228
5267
  <div class="member-text">
5229
- <p>Checks if this item is above the specified item in the stacking order of the project.</p>
5268
+ <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
5269
 
5231
5270
 
5232
5271
  <ul class="member-list">
@@ -5267,7 +5306,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
5267
5306
  </div>
5268
5307
  <div class="member-description hidden">
5269
5308
  <div class="member-text">
5270
- <p>Checks if the item is below the specified item in the stacking order of the project.</p>
5309
+ <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
5310
 
5272
5311
 
5273
5312
  <ul class="member-list">
@@ -6225,11 +6264,11 @@ circle.scale(3, 1);
6225
6264
 
6226
6265
  <div id="fitbounds-rectangle" class="member">
6227
6266
  <div class="member-link">
6228
- <a name="fitbounds-rectangle" href="#fitbounds-rectangle"><tt><b>fitBounds</b>(rectangle[, fill])</tt></a>
6267
+ <a name="fitbounds-rectangle" href="#fitbounds-rectangle"><tt><b>fitBounds</b>(rectangle[, fit])</tt></a>
6229
6268
  </div>
6230
6269
  <div class="member-description hidden">
6231
6270
  <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>
6271
+ <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
6272
 
6234
6273
 
6235
6274
  <ul class="member-list">
@@ -6243,10 +6282,10 @@ circle.scale(3, 1);
6243
6282
  </li>
6244
6283
 
6245
6284
  <li>
6246
- <tt>fill:</tt>
6247
- <tt>Boolean</tt>
6248
-
6249
- &mdash;&nbsp;optional, default: <tt>false</tt>
6285
+ <tt>fit:</tt>
6286
+ <tt>String</tt>⟋<tt>Boolean</tt>
6287
+ &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>.
6288
+ &mdash;&nbsp;optional, default: <tt>&lsquo;contain&rsquo;</tt>
6250
6289
  </li>
6251
6290
 
6252
6291
  </ul>
@@ -6288,7 +6327,7 @@ circlePath.fitBounds(path.bounds);
6288
6327
  </div>
6289
6328
 
6290
6329
 
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>
6330
+ <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
6331
 
6293
6332
  <div class="paperscript split">
6294
6333
 
@@ -6315,7 +6354,7 @@ var circlePath = new Path.Circle({
6315
6354
 
6316
6355
  // Fit the circlePath to the bounding rectangle of
6317
6356
  // the rectangular path:
6318
- circlePath.fitBounds(path.bounds, true);
6357
+ circlePath.fitBounds(path.bounds, 'cover');
6319
6358
  </script>
6320
6359
  <div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
6321
6360
  </div>
@@ -6965,7 +7004,7 @@ function onMouseDown(event) {
6965
7004
  <ul class="member-list">
6966
7005
  <h4>Options:</h4>
6967
7006
  <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>
7007
+ <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
7008
  <li><tt>options.start: <tt>Boolean</tt></tt> &mdash; whether to start tweening automatically &mdash;&nbsp;default: <tt>true</tt></li>
6970
7009
  </ul>
6971
7010
 
@@ -7353,7 +7392,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7353
7392
 
7354
7393
  <!-- =========================== copyright notice ========================== -->
7355
7394
  <p class="footer">
7356
- Paper.js v0.12.19<br>
7395
+ Paper.js v0.13.0<br>
7357
7396
  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
7397
  <div class="content-end"></div>
7359
7398
 
@@ -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.19<br>
1879
+ Paper.js v0.13.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],
@@ -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.19<br>
945
+ Paper.js v0.13.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.19<br>
305
+ Paper.js v0.13.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