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.
- package/CHANGELOG.md +318 -0
- package/README.md +45 -26
- package/dist/docs/assets/js/paper.js +1210 -481
- package/dist/docs/classes/ChangeFlag.html +384 -0
- package/dist/docs/classes/Color.html +63 -47
- package/dist/docs/classes/CompoundPath.html +219 -62
- package/dist/docs/classes/Curve.html +9 -7
- package/dist/docs/classes/CurveLocation.html +1 -1
- package/dist/docs/classes/Event.html +1 -1
- package/dist/docs/classes/Gradient.html +1 -1
- package/dist/docs/classes/GradientStop.html +1 -1
- package/dist/docs/classes/Group.html +151 -27
- package/dist/docs/classes/HitResult.html +3 -2
- package/dist/docs/classes/HostItem.html +6721 -0
- package/dist/docs/classes/Item.html +120 -27
- package/dist/docs/classes/Key.html +1 -1
- package/dist/docs/classes/KeyEvent.html +1 -1
- package/dist/docs/classes/Layer.html +151 -27
- package/dist/docs/classes/Matrix.html +1 -1
- package/dist/docs/classes/MouseEvent.html +1 -1
- package/dist/docs/classes/PaperScope.html +88 -1
- package/dist/docs/classes/PaperScript.html +2 -1
- package/dist/docs/classes/Path.html +232 -72
- package/dist/docs/classes/PathItem.html +337 -180
- package/dist/docs/classes/Point.html +143 -21
- package/dist/docs/classes/PointText.html +151 -27
- package/dist/docs/classes/Project.html +201 -8
- package/dist/docs/classes/Raster.html +150 -38
- package/dist/docs/classes/Rectangle.html +12 -11
- package/dist/docs/classes/Segment.html +1 -1
- package/dist/docs/classes/Shape.html +120 -27
- package/dist/docs/classes/Size.html +81 -21
- package/dist/docs/classes/Style.html +35 -3
- package/dist/docs/classes/SymbolDefinition.html +1 -1
- package/dist/docs/classes/SymbolItem.html +121 -28
- package/dist/docs/classes/TextItem.html +151 -27
- package/dist/docs/classes/Tool.html +127 -1
- package/dist/docs/classes/ToolEvent.html +27 -1
- package/dist/docs/classes/Tween.html +1 -1
- package/dist/docs/classes/View.html +345 -10
- package/dist/docs/classes/global.html +1 -1
- package/dist/docs/classes/index.html +2 -2
- package/dist/docs/index.html +1 -1
- package/dist/node/canvas.js +1 -1
- package/dist/node/self.js +4 -3
- package/dist/paper-core.js +1182 -465
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +1210 -481
- package/dist/paper-full.min.js +3 -3
- package/dist/paper-sourced.js +18631 -0
- package/dist/paper.d.ts +606 -78
- package/examples/Rasters/Smoothing.html +1 -1
- package/package.json +6 -17
- package/dist/node/xml.js +0 -40
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
<p> Extends <b><a href="../classes/Item.html"><tt>Item</tt></a></b></p>
|
|
19
19
|
|
|
20
|
-
<p>A symbol item represents an instance of a symbol which has been placed in a Paper.js project.</p>
|
|
20
|
+
<p>A symbol item represents an instance of a symbol which has been placed in a Paper.js project. All instances share the symbol’s definition, which they draw as it is: styles set on a symbol item don’t reach the items of the definition, unlike <code><use></code> elements in SVG.</p>
|
|
21
21
|
|
|
22
22
|
</div>
|
|
23
23
|
|
|
@@ -162,6 +162,32 @@ for (var i = 0; i < 100; i++) {
|
|
|
162
162
|
<div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
163
163
|
|
|
164
164
|
|
|
165
|
+
<div id="key" class="member">
|
|
166
|
+
<div class="member-link">
|
|
167
|
+
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
168
|
+
</div>
|
|
169
|
+
<div class="member-description hidden">
|
|
170
|
+
|
|
171
|
+
<div class="member-text">
|
|
172
|
+
<p>The key of the host’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>
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
<ul class="member-list">
|
|
177
|
+
<h4>Type:</h4>
|
|
178
|
+
<li>
|
|
179
|
+
<tt>Number</tt>
|
|
180
|
+
</li>
|
|
181
|
+
</ul>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
</div>
|
|
186
|
+
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
|
|
165
191
|
<div id="id" class="member">
|
|
166
192
|
<div class="member-link">
|
|
167
193
|
<a name="id" href="#id"><tt><b>id</b></tt></a>
|
|
@@ -281,6 +307,7 @@ group.children['example'].fillColor = 'red';
|
|
|
281
307
|
|
|
282
308
|
<div class="member-text">
|
|
283
309
|
<p>The path style of the item.</p>
|
|
310
|
+
<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>
|
|
284
311
|
|
|
285
312
|
|
|
286
313
|
|
|
@@ -623,6 +650,37 @@ circle2.opacity = 0.5;
|
|
|
623
650
|
</div>
|
|
624
651
|
|
|
625
652
|
|
|
653
|
+
</div>
|
|
654
|
+
|
|
655
|
+
</div>
|
|
656
|
+
</div>
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
<div id="guide" class="member">
|
|
660
|
+
<div class="member-link">
|
|
661
|
+
<a name="guide" href="#guide"><tt><b>guide</b></tt></a>
|
|
662
|
+
</div>
|
|
663
|
+
<div class="member-description hidden">
|
|
664
|
+
|
|
665
|
+
<div class="member-text">
|
|
666
|
+
<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>
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
<ul class="member-list">
|
|
671
|
+
<h4>Default:</h4>
|
|
672
|
+
<li><tt>false</tt></li>
|
|
673
|
+
</ul>
|
|
674
|
+
|
|
675
|
+
<ul class="member-list">
|
|
676
|
+
<h4>Type:</h4>
|
|
677
|
+
<li>
|
|
678
|
+
<tt>Boolean</tt>
|
|
679
|
+
</li>
|
|
680
|
+
</ul>
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
626
684
|
</div>
|
|
627
685
|
|
|
628
686
|
</div>
|
|
@@ -1213,6 +1271,34 @@ circle.position.x += 100;
|
|
|
1213
1271
|
|
|
1214
1272
|
|
|
1215
1273
|
|
|
1274
|
+
</div>
|
|
1275
|
+
|
|
1276
|
+
</div>
|
|
1277
|
+
</div>
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
<div id="scope" class="member">
|
|
1281
|
+
<div class="member-link">
|
|
1282
|
+
<a name="scope" href="#scope"><tt><b>scope</b></tt></a>
|
|
1283
|
+
</div>
|
|
1284
|
+
<div class="member-description hidden">
|
|
1285
|
+
|
|
1286
|
+
<div class="member-text">
|
|
1287
|
+
<p>The scope that this item belongs to, through its project.</p>
|
|
1288
|
+
|
|
1289
|
+
<p>Read only.</p>
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
<ul class="member-list">
|
|
1294
|
+
<h4>Type:</h4>
|
|
1295
|
+
<li>
|
|
1296
|
+
<a href="../classes/PaperScope.html"><tt>PaperScope</tt></a>
|
|
1297
|
+
</li>
|
|
1298
|
+
</ul>
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
|
|
1216
1302
|
</div>
|
|
1217
1303
|
|
|
1218
1304
|
</div>
|
|
@@ -1326,6 +1412,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
1326
1412
|
|
|
1327
1413
|
<div class="member-text">
|
|
1328
1414
|
<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>
|
|
1415
|
+
<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>
|
|
1329
1416
|
<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>
|
|
1330
1417
|
|
|
1331
1418
|
|
|
@@ -1827,7 +1914,7 @@ path3.strokeJoin = 'bevel';
|
|
|
1827
1914
|
<div class="member-description hidden">
|
|
1828
1915
|
|
|
1829
1916
|
<div class="member-text">
|
|
1830
|
-
<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>
|
|
1917
|
+
<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>
|
|
1831
1918
|
|
|
1832
1919
|
|
|
1833
1920
|
|
|
@@ -3266,22 +3353,22 @@ function onMouseDown(event) {
|
|
|
3266
3353
|
<div class="member-description hidden">
|
|
3267
3354
|
<div class="member-text">
|
|
3268
3355
|
<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>
|
|
3269
|
-
<p>The options object allows you to control the specifics of the hit-
|
|
3356
|
+
<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>
|
|
3270
3357
|
<ul class="member-list">
|
|
3271
3358
|
<h4>Options:</h4>
|
|
3272
|
-
<li><tt>options.tolerance: <tt>Number</tt></tt> — the tolerance of the hit-test — default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.hitTolerance</tt></li>
|
|
3359
|
+
<li><tt>options.tolerance: <tt>Number</tt></tt> — the tolerance of the hit-test, in project coordinates — default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.hitTolerance</tt></li>
|
|
3273
3360
|
<li><tt>options.class: <tt>Function</tt></tt> — 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>, …</li>
|
|
3274
3361
|
<li><tt>options.match: <tt>Function</tt></tt> — 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>
|
|
3275
|
-
<li><tt>options.fill: <tt>Boolean</tt></tt> — hit-test the fill of items
|
|
3276
|
-
<li><tt>options.stroke: <tt>Boolean</tt></tt> — hit-test the stroke of path
|
|
3277
|
-
<li><tt>options.segments: <tt>Boolean</tt></tt> — hit-test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of
|
|
3362
|
+
<li><tt>options.fill: <tt>Boolean</tt></tt> — hit-test the fill of items</li>
|
|
3363
|
+
<li><tt>options.stroke: <tt>Boolean</tt></tt> — hit-test the stroke of path items, taking into account the setting of stroke color and width</li>
|
|
3364
|
+
<li><tt>options.segments: <tt>Boolean</tt></tt> — 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>
|
|
3278
3365
|
<li><tt>options.curves: <tt>Boolean</tt></tt> — hit-test the curves of path items, without taking the stroke color or width into account</li>
|
|
3279
3366
|
<li><tt>options.handles: <tt>Boolean</tt></tt> — 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>
|
|
3280
3367
|
<li><tt>options.ends: <tt>Boolean</tt></tt> — only hit-test for the first or last segment points of open path items</li>
|
|
3281
3368
|
<li><tt>options.position: <tt>Boolean</tt></tt> — 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>
|
|
3282
3369
|
<li><tt>options.center: <tt>Boolean</tt></tt> — 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>
|
|
3283
3370
|
<li><tt>options.bounds: <tt>Boolean</tt></tt> — 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>
|
|
3284
|
-
<li><tt>options.guides: <tt>Boolean</tt></tt> — hit-test items that have <
|
|
3371
|
+
<li><tt>options.guides: <tt>Boolean</tt></tt> — only hit-test items that have <a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <code>true</code></li>
|
|
3285
3372
|
<li><tt>options.selected: <tt>Boolean</tt></tt> — only hit selected items</li>
|
|
3286
3373
|
</ul>
|
|
3287
3374
|
|
|
@@ -3520,7 +3607,7 @@ function onMouseDown(event) {
|
|
|
3520
3607
|
<h4>Returns:</h4>
|
|
3521
3608
|
|
|
3522
3609
|
<li>
|
|
3523
|
-
<tt>Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects</tt> — the list of matching descendant items
|
|
3610
|
+
<tt>Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects</tt> — the list of matching descendant items, in their stacking order from bottom to top, with each item listed before its own descendants
|
|
3524
3611
|
</li>
|
|
3525
3612
|
|
|
3526
3613
|
|
|
@@ -3693,6 +3780,8 @@ function onMouseDown(event) {
|
|
|
3693
3780
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
3694
3781
|
<li><tt>options.matchShapes: <tt>Boolean</tt></tt> — whether path items should tried to be converted to SVG shape items (rect, circle, ellipse, line, polyline, polygon), if their geometries match — default: <tt>false</tt></li>
|
|
3695
3782
|
<li><tt>options.embedImages: <tt>Boolean</tt></tt> — whether raster images should be embedded as base64 data inlined in the xlink:href attribute, or kept as a link to their external URL. — default: <tt>true</tt></li>
|
|
3783
|
+
<li><tt>options.reuseImages: <tt>Boolean</tt></tt> — whether raster images with the same content should only be exported once into the <code><defs></code> element, and placed through <code><use></code> elements referencing it — default: <tt>false</tt></li>
|
|
3784
|
+
<li><tt>options.idPrefix: <tt>String</tt></tt> — 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 — default: <tt>’’</tt></li>
|
|
3696
3785
|
<li><tt>options.reduceAttributes: <tt>Boolean</tt></tt> — 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). — default: <tt>true</tt></li>
|
|
3697
3786
|
</ul>
|
|
3698
3787
|
|
|
@@ -3735,9 +3824,13 @@ function onMouseDown(event) {
|
|
|
3735
3824
|
<div class="member-description hidden">
|
|
3736
3825
|
<div class="member-text">
|
|
3737
3826
|
<p>Converts the provided SVG content into Paper.js items and adds them to the this item’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>
|
|
3827
|
+
<p><code><symbol></code> elements are imported as <a href="../classes/SymbolDefinition.html"><tt>SymbolDefinition</tt></a> items, and the <code><use></code> elements that place them as <a href="../classes/SymbolItem.html"><tt>SymbolItem</tt></a> items. The styles that <code><use></code> elements inherit don’t reach the symbols’ content.</p>
|
|
3738
3828
|
<ul class="member-list">
|
|
3739
3829
|
<h4>Options:</h4>
|
|
3740
3830
|
<li><tt>options.expandShapes: <tt>Boolean</tt></tt> — whether imported shape items should be expanded to path items — default: <tt>false</tt></li>
|
|
3831
|
+
<li>[options.crossOrigin] {String} the {@link Raster#crossOrigin}
|
|
3832
|
+
value of the rasters created for `<image>` elements, to load their
|
|
3833
|
+
images with CORS</li>
|
|
3741
3834
|
<li><tt>options.onLoad: <tt>Function</tt></tt> — 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>
|
|
3742
3835
|
<li><tt>options.onError: <tt>Function</tt></tt> — the callback function to call if an error occurs during loading. Only required when loading from external resources.</li>
|
|
3743
3836
|
<li><tt>options.insert: <tt>Boolean</tt></tt> — whether the imported items should be added to the item that <code>importSVG()</code> is called on — default: <tt>true</tt></li>
|
|
@@ -4213,9 +4306,9 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
4213
4306
|
</div>
|
|
4214
4307
|
|
|
4215
4308
|
|
|
4216
|
-
<div id="reduce
|
|
4309
|
+
<div id="reduce" class="member">
|
|
4217
4310
|
<div class="member-link">
|
|
4218
|
-
<a name="reduce
|
|
4311
|
+
<a name="reduce" href="#reduce"><tt><b>reduce</b>([options])</tt></a>
|
|
4219
4312
|
</div>
|
|
4220
4313
|
<div class="member-description hidden">
|
|
4221
4314
|
<div class="member-text">
|
|
@@ -4227,9 +4320,9 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
4227
4320
|
|
|
4228
4321
|
<li>
|
|
4229
4322
|
<tt>options:</tt>
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4323
|
+
<tt>Object</tt>
|
|
4324
|
+
— the options passed on to <a href="../classes/Path.html#reduce-options"><tt>path.reduce(options)</tt></a>
|
|
4325
|
+
— optional
|
|
4233
4326
|
</li>
|
|
4234
4327
|
|
|
4235
4328
|
</ul>
|
|
@@ -4471,7 +4564,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
4471
4564
|
</div>
|
|
4472
4565
|
<div class="member-description hidden">
|
|
4473
4566
|
<div class="member-text">
|
|
4474
|
-
<p>Checks whether the item has a fill
|
|
4567
|
+
<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>
|
|
4475
4568
|
|
|
4476
4569
|
|
|
4477
4570
|
|
|
@@ -4479,7 +4572,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
4479
4572
|
<h4>Returns:</h4>
|
|
4480
4573
|
|
|
4481
4574
|
<li>
|
|
4482
|
-
<tt><tt>Boolean</tt></tt> — <tt>true</tt> if the item has a fill, <tt>false</tt> otherwise
|
|
4575
|
+
<tt><tt>Boolean</tt></tt> — <tt>true</tt> if the item has a visible fill, <tt>false</tt> otherwise
|
|
4483
4576
|
</li>
|
|
4484
4577
|
|
|
4485
4578
|
|
|
@@ -4618,7 +4711,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
4618
4711
|
</div>
|
|
4619
4712
|
<div class="member-description hidden">
|
|
4620
4713
|
<div class="member-text">
|
|
4621
|
-
<p>Checks if this item is above the specified item in the stacking order of the project.</p>
|
|
4714
|
+
<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>
|
|
4622
4715
|
|
|
4623
4716
|
|
|
4624
4717
|
<ul class="member-list">
|
|
@@ -4659,7 +4752,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
4659
4752
|
</div>
|
|
4660
4753
|
<div class="member-description hidden">
|
|
4661
4754
|
<div class="member-text">
|
|
4662
|
-
<p>Checks if the item is below the specified item in the stacking order of the project.</p>
|
|
4755
|
+
<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>
|
|
4663
4756
|
|
|
4664
4757
|
|
|
4665
4758
|
<ul class="member-list">
|
|
@@ -5617,11 +5710,11 @@ circle.scale(3, 1);
|
|
|
5617
5710
|
|
|
5618
5711
|
<div id="fitbounds-rectangle" class="member">
|
|
5619
5712
|
<div class="member-link">
|
|
5620
|
-
<a name="fitbounds-rectangle" href="#fitbounds-rectangle"><tt><b>fitBounds</b>(rectangle[,
|
|
5713
|
+
<a name="fitbounds-rectangle" href="#fitbounds-rectangle"><tt><b>fitBounds</b>(rectangle[, fit])</tt></a>
|
|
5621
5714
|
</div>
|
|
5622
5715
|
<div class="member-description hidden">
|
|
5623
5716
|
<div class="member-text">
|
|
5624
|
-
<p>Transform the item so that its <a href="../classes/Item.html#bounds"><tt>bounds</tt></a>
|
|
5717
|
+
<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>
|
|
5625
5718
|
|
|
5626
5719
|
|
|
5627
5720
|
<ul class="member-list">
|
|
@@ -5635,10 +5728,10 @@ circle.scale(3, 1);
|
|
|
5635
5728
|
</li>
|
|
5636
5729
|
|
|
5637
5730
|
<li>
|
|
5638
|
-
<tt>
|
|
5639
|
-
<tt>Boolean</tt>
|
|
5640
|
-
|
|
5641
|
-
— optional, default: <tt
|
|
5731
|
+
<tt>fit:</tt>
|
|
5732
|
+
<tt>String</tt>⟋<tt>Boolean</tt>
|
|
5733
|
+
— how to fit the item, as in CSS’s <code>object-fit</code>: <code>'contain'</code> fits all of it within the rectangle, <code>'cover'</code> makes it cover the whole rectangle, and <code>'fill'</code> stretches it to the rectangle, changing its aspect ratio. The deprecated <code>true</code> and <code>false</code> stand for <code>'cover'</code> and <code>'contain'</code>.
|
|
5734
|
+
— optional, default: <tt>‘contain’</tt>
|
|
5642
5735
|
</li>
|
|
5643
5736
|
|
|
5644
5737
|
</ul>
|
|
@@ -5680,7 +5773,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
5680
5773
|
</div>
|
|
5681
5774
|
|
|
5682
5775
|
|
|
5683
|
-
<h4>Example:<span class="description">Fitting an item to the bounding rectangle of another item's bounding rectangle
|
|
5776
|
+
<h4>Example:<span class="description">Fitting an item to the bounding rectangle of another item's bounding rectangle, covering all of it:</span></h4>
|
|
5684
5777
|
|
|
5685
5778
|
<div class="paperscript split">
|
|
5686
5779
|
|
|
@@ -5707,7 +5800,7 @@ var circlePath = new Path.Circle({
|
|
|
5707
5800
|
|
|
5708
5801
|
// Fit the circlePath to the bounding rectangle of
|
|
5709
5802
|
// the rectangular path:
|
|
5710
|
-
circlePath.fitBounds(path.bounds,
|
|
5803
|
+
circlePath.fitBounds(path.bounds, 'cover');
|
|
5711
5804
|
</script>
|
|
5712
5805
|
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
5713
5806
|
</div>
|
|
@@ -6357,7 +6450,7 @@ function onMouseDown(event) {
|
|
|
6357
6450
|
<ul class="member-list">
|
|
6358
6451
|
<h4>Options:</h4>
|
|
6359
6452
|
<li><tt>options.duration: <tt>Number</tt></tt> — the duration of the tweening</li>
|
|
6360
|
-
<li><tt>options.easing: <tt>Function</tt>⟋<tt>String</tt></tt> — an easing function or the type of the easing: <tt>‘linear’ ‘easeInQuad’ ‘easeOutQuad’ ‘easeInOutQuad’ ‘easeInCubic’ ‘easeOutCubic’ ‘easeInOutCubic’ ‘easeInQuart’ ‘easeOutQuart’ ‘easeInOutQuart’ ‘easeInQuint’ ‘easeOutQuint’ ‘easeInOutQuint’</tt> — default: <tt>‘linear’</tt></li>
|
|
6453
|
+
<li><tt>options.easing: <tt>Function</tt>⟋<tt>String</tt></tt> — an easing function or the type of the easing: <tt>‘linear’ ‘easeInQuad’ ‘easeOutQuad’ ‘easeInOutQuad’ ‘easeInCubic’ ‘easeOutCubic’ ‘easeInOutCubic’ ‘easeInQuart’ ‘easeOutQuart’ ‘easeInOutQuart’ ‘easeInQuint’ ‘easeOutQuint’ ‘easeInOutQuint’ ‘easeInSine’ ‘easeOutSine’ ‘easeInOutSine’ ‘easeInExpo’ ‘easeOutExpo’ ‘easeInOutExpo’ ‘easeInCirc’ ‘easeOutCirc’ ‘easeInOutCirc’</tt> — default: <tt>‘linear’</tt></li>
|
|
6361
6454
|
<li><tt>options.start: <tt>Boolean</tt></tt> — whether to start tweening automatically — default: <tt>true</tt></li>
|
|
6362
6455
|
</ul>
|
|
6363
6456
|
|
|
@@ -6745,7 +6838,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
|
6745
6838
|
|
|
6746
6839
|
<!-- =========================== copyright notice ========================== -->
|
|
6747
6840
|
<p class="footer">
|
|
6748
|
-
Paper.js v0.
|
|
6841
|
+
Paper.js v0.14.0<br>
|
|
6749
6842
|
Copyright © 2011—2026 <a href="http://www.lehni.org" target="_blank">Jürg Lehni</a> & <a href="http://www.jonathanpuckey.com" target="_blank">Jonathan Puckey</a>. All Rights Reserved.</p>
|
|
6750
6843
|
<div class="content-end"></div>
|
|
6751
6844
|
|