paper 0.16.0 → 0.17.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 +95 -0
- package/dist/docs/assets/js/paper.js +4565 -733
- package/dist/docs/classes/AreaText.html +720 -242
- package/dist/docs/classes/ChangeFlag.html +1 -1
- package/dist/docs/classes/Color.html +218 -21
- package/dist/docs/classes/CompoundPath.html +1146 -296
- package/dist/docs/classes/Curve.html +1 -1
- package/dist/docs/classes/CurveLocation.html +1 -1
- package/dist/docs/classes/DrawEvent.html +69 -0
- package/dist/docs/classes/Effect.html +434 -0
- package/dist/docs/classes/EffectInstance.html +304 -0
- 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 +792 -243
- package/dist/docs/classes/HitResult.html +1 -1
- package/dist/docs/classes/HostItem.html +720 -242
- package/dist/docs/classes/Item.html +777 -242
- package/dist/docs/classes/Key.html +1 -1
- package/dist/docs/classes/KeyEvent.html +1 -1
- package/dist/docs/classes/Layer.html +734 -185
- package/dist/docs/classes/Matrix.html +1 -1
- package/dist/docs/classes/MouseEvent.html +1 -1
- package/dist/docs/classes/PaperScope.html +1 -1
- package/dist/docs/classes/PaperScript.html +4 -2
- package/dist/docs/classes/Path.html +1195 -252
- package/dist/docs/classes/PathItem.html +1148 -298
- package/dist/docs/classes/PathText.html +720 -242
- package/dist/docs/classes/PatternDefinition.html +367 -0
- package/dist/docs/classes/Point.html +1 -1
- package/dist/docs/classes/PointText.html +720 -242
- package/dist/docs/classes/Project.html +177 -7
- package/dist/docs/classes/Raster.html +720 -242
- package/dist/docs/classes/Rectangle.html +1 -1
- package/dist/docs/classes/Segment.html +3 -3
- package/dist/docs/classes/Shape.html +720 -242
- package/dist/docs/classes/Size.html +1 -1
- package/dist/docs/classes/StrokeProfileStop.html +346 -0
- package/dist/docs/classes/Style.html +1 -1
- package/dist/docs/classes/SymbolDefinition.html +28 -2
- package/dist/docs/classes/SymbolItem.html +720 -242
- package/dist/docs/classes/TextItem.html +720 -242
- package/dist/docs/classes/TextRange.html +1 -1
- package/dist/docs/classes/TextStory.html +1 -1
- package/dist/docs/classes/Tool.html +2 -2
- package/dist/docs/classes/ToolEvent.html +1 -1
- package/dist/docs/classes/Tween.html +1 -1
- package/dist/docs/classes/View.html +2 -2
- 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/browser.js +15 -0
- package/dist/paper-core.js +4476 -674
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +4565 -733
- package/dist/paper-full.min.js +3 -3
- package/dist/paper-hosted.js +5111 -823
- package/dist/paper.d.ts +898 -47
- package/examples/Paperjs.org/LiveEffects.html +366 -0
- package/examples/Paperjs.org/Offsetting.html +379 -0
- package/examples/Paperjs.org/StrokeProfiles.html +706 -0
- package/examples/Scripts/Patterns.html +57 -0
- package/package.json +5 -3
package/dist/paper.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Paper.js v0.
|
|
2
|
+
* Paper.js v0.17.0 - The Swiss Army Knife of Vector Graphics Scripting.
|
|
3
3
|
* http://paperjs.org/
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2011 - 2020, Jürg Lehni & Jonathan Puckey
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* All rights reserved.
|
|
11
11
|
*
|
|
12
|
-
* Date:
|
|
12
|
+
* Date: Tue Nov 3 20:27:46 2026 +0100
|
|
13
13
|
*
|
|
14
14
|
* This is an auto-generated type definition.
|
|
15
15
|
*/
|
|
@@ -60,6 +60,7 @@ declare namespace paper {
|
|
|
60
60
|
destination: PointLike,
|
|
61
61
|
highlight?: PointLike
|
|
62
62
|
}
|
|
63
|
+
| { pattern: PatternDefinition, matrix?: Matrix }
|
|
63
64
|
)
|
|
64
65
|
|
|
65
66
|
type GradientStopLike = GradientStop | ColorLike | [ ColorLike, number ]
|
|
@@ -286,6 +287,25 @@ declare namespace paper {
|
|
|
286
287
|
get highlight(): Point
|
|
287
288
|
set highlight(value: PointLike)
|
|
288
289
|
|
|
290
|
+
/**
|
|
291
|
+
* The aspect of a radial gradient: its radius across the line from
|
|
292
|
+
* the origin to the destination, as a factor of its radius along it,
|
|
293
|
+
* which makes it an ellipse. Transforming a gradient color sets it, so
|
|
294
|
+
* that the gradient stretches, shears and rotates with its item.
|
|
295
|
+
*/
|
|
296
|
+
aspect: number
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* The pattern whose tiles the color repeats.
|
|
300
|
+
*/
|
|
301
|
+
pattern: PatternDefinition
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* The matrix that places the tiles of the pattern in the item's
|
|
305
|
+
* coordinates.
|
|
306
|
+
*/
|
|
307
|
+
matrix: Matrix
|
|
308
|
+
|
|
289
309
|
|
|
290
310
|
/**
|
|
291
311
|
* Creates a RGB Color object.
|
|
@@ -327,11 +347,18 @@ declare namespace paper {
|
|
|
327
347
|
/**
|
|
328
348
|
* Creates a gradient Color object.
|
|
329
349
|
*/
|
|
330
|
-
constructor(gradient: Gradient, origin: PointLike, destination: PointLike, highlight?: PointLike)
|
|
350
|
+
constructor(gradient: Gradient, origin: PointLike, destination: PointLike, highlight?: PointLike, aspect?: number)
|
|
331
351
|
|
|
332
352
|
/**
|
|
333
|
-
* Creates a
|
|
334
|
-
* the
|
|
353
|
+
* Creates a pattern Color object, which repeats the tiles of the
|
|
354
|
+
* pattern, placed by the matrix in the item's coordinates. As with
|
|
355
|
+
* gradient colors, the matrix is transformed along with the item.
|
|
356
|
+
*/
|
|
357
|
+
constructor(pattern: PatternDefinition, matrix?: Matrix)
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Creates a HSB, HSL, gradient or pattern Color object from the
|
|
361
|
+
* properties of the provided object:
|
|
335
362
|
*
|
|
336
363
|
* @option hsb.hue {Number} the hue of the color as a value in degrees
|
|
337
364
|
* between `0` and `360`
|
|
@@ -358,6 +385,10 @@ declare namespace paper {
|
|
|
358
385
|
* the gradient, as an alternative to providing a gradient object
|
|
359
386
|
* @option gradient.radial {Boolean} controls whether the gradient is
|
|
360
387
|
* radial, as an alternative to providing a gradient object
|
|
388
|
+
* @option pattern.pattern {PatternDefinition} the pattern whose tiles
|
|
389
|
+
* the color repeats
|
|
390
|
+
* @option pattern.matrix {Matrix} the matrix that places the tiles in
|
|
391
|
+
* the item's coordinates
|
|
361
392
|
*
|
|
362
393
|
* @param object - an object describing the components and
|
|
363
394
|
* properties of the color
|
|
@@ -419,9 +450,13 @@ declare namespace paper {
|
|
|
419
450
|
toCSS(hex: boolean): string
|
|
420
451
|
|
|
421
452
|
/**
|
|
422
|
-
* Transform the gradient color by the specified matrix.
|
|
453
|
+
* Transform the gradient or pattern color by the specified matrix.
|
|
454
|
+
* Radial gradients become ellipses, see {@link #aspect}, and the
|
|
455
|
+
* stripes of linear gradients keep running across them, also when the
|
|
456
|
+
* matrix scales unevenly or shears. Pattern colors transform their
|
|
457
|
+
* {@link #matrix}.
|
|
423
458
|
*
|
|
424
|
-
* @param matrix - the matrix to transform the
|
|
459
|
+
* @param matrix - the matrix to transform the color by
|
|
425
460
|
*/
|
|
426
461
|
transform(matrix: Matrix): void
|
|
427
462
|
|
|
@@ -1434,6 +1469,175 @@ declare namespace paper {
|
|
|
1434
1469
|
|
|
1435
1470
|
}
|
|
1436
1471
|
|
|
1472
|
+
/**
|
|
1473
|
+
* The DrawEvent object is received by the {@link Item}'s drawing
|
|
1474
|
+
* handlers {@link Item#onDraw} and {@link Item#onDrawSelection}, which
|
|
1475
|
+
* describe its fields.
|
|
1476
|
+
*/
|
|
1477
|
+
class DrawEvent {
|
|
1478
|
+
|
|
1479
|
+
/**
|
|
1480
|
+
* Skips the item's default drawing, as returning `false` from the handler
|
|
1481
|
+
* does.
|
|
1482
|
+
*/
|
|
1483
|
+
preventDefault(): void
|
|
1484
|
+
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* A live effect, which derives what is drawn from an item without
|
|
1489
|
+
* changing the item itself, as the effects in Illustrator do. Creating one
|
|
1490
|
+
* registers it under its type, replacing any effect registered there before,
|
|
1491
|
+
* and items use it by that type, see {@link Item#effects}, each through an
|
|
1492
|
+
* {@link EffectInstance} with its own parameters.
|
|
1493
|
+
*/
|
|
1494
|
+
class Effect {
|
|
1495
|
+
/**
|
|
1496
|
+
* The type that the effect is registered under, and that items use it
|
|
1497
|
+
* by.
|
|
1498
|
+
*/
|
|
1499
|
+
readonly type: string
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* The label of the effect, for hosts to show to users.
|
|
1503
|
+
*/
|
|
1504
|
+
readonly label: string
|
|
1505
|
+
|
|
1506
|
+
/**
|
|
1507
|
+
* The declared parameters of the effect by their names, as objects
|
|
1508
|
+
* that describe them for hosts to build their settings from, with the
|
|
1509
|
+
* default as their `value`, e.g.
|
|
1510
|
+
* `{ label: 'Amount', type: 'number', range: [0, 100], value: 10 }`.
|
|
1511
|
+
* The instances of the effect have them as properties.
|
|
1512
|
+
*/
|
|
1513
|
+
readonly parameters: any
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* The function that applies the effect, called with the instance as
|
|
1517
|
+
* `this`, and returning what the effect makes of the art that it gets,
|
|
1518
|
+
* which it doesn't change.
|
|
1519
|
+
*
|
|
1520
|
+
* @option event.art {Item} the item to apply the effect to, or what
|
|
1521
|
+
* the effect before it returned
|
|
1522
|
+
* @option event.item {Item} the item that the instance is part of
|
|
1523
|
+
*/
|
|
1524
|
+
onApply: Function | null
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* The function that hosts call when the user edits the parameters of
|
|
1528
|
+
* an instance, with the instance as `this`, to set its properties.
|
|
1529
|
+
* Paper.js itself doesn't call it.
|
|
1530
|
+
*/
|
|
1531
|
+
onEditParameters: Function | null
|
|
1532
|
+
|
|
1533
|
+
|
|
1534
|
+
/**
|
|
1535
|
+
* Creates an effect and registers it under its type.
|
|
1536
|
+
*
|
|
1537
|
+
* @param props - the {@link #type} of the effect, its
|
|
1538
|
+
* {@link #label} and {@link #parameters}, and {@link #onApply}
|
|
1539
|
+
* and {@link #onEditParameters}
|
|
1540
|
+
*/
|
|
1541
|
+
constructor(props: object)
|
|
1542
|
+
|
|
1543
|
+
/**
|
|
1544
|
+
* Removes the effect from the registered effects.
|
|
1545
|
+
*
|
|
1546
|
+
* @return true if the effect was registered
|
|
1547
|
+
*/
|
|
1548
|
+
remove(): boolean
|
|
1549
|
+
|
|
1550
|
+
/**
|
|
1551
|
+
* Registers the effect under its type, replacing any effect
|
|
1552
|
+
* registered there before. Effects register themselves when they
|
|
1553
|
+
* are created.
|
|
1554
|
+
*
|
|
1555
|
+
* @return the effect
|
|
1556
|
+
*/
|
|
1557
|
+
static add(effect: Effect): Effect
|
|
1558
|
+
|
|
1559
|
+
/**
|
|
1560
|
+
* Returns the effect registered under the type.
|
|
1561
|
+
*
|
|
1562
|
+
* @return the effect, or `null`
|
|
1563
|
+
*/
|
|
1564
|
+
static get(type: string): Effect | null
|
|
1565
|
+
|
|
1566
|
+
/**
|
|
1567
|
+
* Returns all registered effects.
|
|
1568
|
+
*
|
|
1569
|
+
* @return the effects
|
|
1570
|
+
*/
|
|
1571
|
+
static getAll(): Effect[]
|
|
1572
|
+
|
|
1573
|
+
/**
|
|
1574
|
+
* Removes the effect from the registered effects.
|
|
1575
|
+
*
|
|
1576
|
+
* @return true if the effect was registered
|
|
1577
|
+
*/
|
|
1578
|
+
static remove(effect: Effect): boolean
|
|
1579
|
+
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
/**
|
|
1583
|
+
* The use of an {@link Effect} on an item, see {@link Item#effects},
|
|
1584
|
+
* with its parameters. The parameters that the effect declares are also its
|
|
1585
|
+
* properties. Instances of effects that aren't registered keep their
|
|
1586
|
+
* parameters and leave what they get as it is, so that they still round-trip.
|
|
1587
|
+
*/
|
|
1588
|
+
class EffectInstance {
|
|
1589
|
+
/**
|
|
1590
|
+
* The type of the effect that the instance uses, also when it isn't
|
|
1591
|
+
* registered.
|
|
1592
|
+
*/
|
|
1593
|
+
readonly type: string
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* The effect that the instance uses, registered under its {@link #type},
|
|
1597
|
+
* or `null` if there is none.
|
|
1598
|
+
*/
|
|
1599
|
+
readonly effect: Effect | null
|
|
1600
|
+
|
|
1601
|
+
/**
|
|
1602
|
+
* Whether the effect applies. Effects that aren't visible are skipped.
|
|
1603
|
+
*/
|
|
1604
|
+
visible: boolean
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* The parameters of the instance. Changing them on the returned object
|
|
1608
|
+
* updates it, as setting them as its properties does. Parameters that it
|
|
1609
|
+
* doesn't have yet are added by setting them all, as are changes within
|
|
1610
|
+
* values such as arrays.
|
|
1611
|
+
*/
|
|
1612
|
+
parameters: any
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* The item that the instance is part of.
|
|
1616
|
+
*/
|
|
1617
|
+
readonly item: Item | null
|
|
1618
|
+
|
|
1619
|
+
/**
|
|
1620
|
+
* The index of the instance in the {@link Item#effects} of its item.
|
|
1621
|
+
*/
|
|
1622
|
+
readonly index: number | null
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
/**
|
|
1626
|
+
* Removes the instance from its item.
|
|
1627
|
+
*
|
|
1628
|
+
* @return true if the instance was removed
|
|
1629
|
+
*/
|
|
1630
|
+
remove(): boolean
|
|
1631
|
+
|
|
1632
|
+
/**
|
|
1633
|
+
* Checks whether the instance is equal to the supplied one.
|
|
1634
|
+
*
|
|
1635
|
+
* @return true if they are equal
|
|
1636
|
+
*/
|
|
1637
|
+
equals(instance: EffectInstance): boolean
|
|
1638
|
+
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1437
1641
|
/**
|
|
1438
1642
|
* The Event object is the base class for any of the other event types,
|
|
1439
1643
|
* such as {@link MouseEvent}, {@link ToolEvent} and {@link KeyEvent}.
|
|
@@ -1572,10 +1776,43 @@ declare namespace paper {
|
|
|
1572
1776
|
* like CSS's `isolation: isolate`. Without it, a compositing mode such as
|
|
1573
1777
|
* `'destination-out'` affects everything drawn below the group, also in
|
|
1574
1778
|
* other layers. Groups with an {@link Item#opacity} below 1 or a
|
|
1575
|
-
* {@link Item#blendMode} are isolated anyway
|
|
1779
|
+
* {@link Item#blendMode} are isolated anyway, and buffered groups always,
|
|
1780
|
+
* see {@link #buffered}.
|
|
1576
1781
|
*/
|
|
1577
1782
|
isolated: boolean
|
|
1578
1783
|
|
|
1784
|
+
/**
|
|
1785
|
+
* Specifies whether the group is buffered: when a view draws it, it draws
|
|
1786
|
+
* its content into a canvas of its own, which it keeps, and only draws
|
|
1787
|
+
* into it again when something in the group changes, or the part of it
|
|
1788
|
+
* that the view shows does, e.g. after zooming or panning. Otherwise, the
|
|
1789
|
+
* view only composites the buffer, with the group's {@link Item#opacity}
|
|
1790
|
+
* and {@link Item#blendMode}. This pays off for large groups and layers
|
|
1791
|
+
* that rarely change, such as a complex background below animated items.
|
|
1792
|
+
*
|
|
1793
|
+
* It doesn't pay off when the buffer is drawn again on every frame: while
|
|
1794
|
+
* the view pans or zooms on every frame, while the group itself is moved
|
|
1795
|
+
* or transformed, or when an item inside it is animated. Put animated
|
|
1796
|
+
* items into another group or layer instead.
|
|
1797
|
+
*
|
|
1798
|
+
* The buffer costs memory: it covers the part of the group that the view
|
|
1799
|
+
* shows, at up to `width × height × 4 × pixelRatio²` bytes for a group
|
|
1800
|
+
* that fills the whole view.
|
|
1801
|
+
*
|
|
1802
|
+
* Buffered groups are always {@link #isolated}: the blend modes of their
|
|
1803
|
+
* children only apply within them, not to the items below them, also in
|
|
1804
|
+
* other layers.
|
|
1805
|
+
*
|
|
1806
|
+
* Hit-testing, SVG export, {@link Item#rasterize} and drawing into other
|
|
1807
|
+
* canvases than the view's don't use the buffer.
|
|
1808
|
+
*
|
|
1809
|
+
* A buffered group keeps one buffer, so inside a {@link SymbolDefinition}
|
|
1810
|
+
* that is placed several times, it draws into it again for each placement.
|
|
1811
|
+
* Changes to any symbol definition make all buffers stale, as do forced
|
|
1812
|
+
* updates through `view.update(true)`.
|
|
1813
|
+
*/
|
|
1814
|
+
buffered: boolean
|
|
1815
|
+
|
|
1579
1816
|
|
|
1580
1817
|
/**
|
|
1581
1818
|
* Creates a new Group item and places it at the top of the active layer.
|
|
@@ -1684,6 +1921,36 @@ declare namespace paper {
|
|
|
1684
1921
|
* that they inherit from Item.
|
|
1685
1922
|
*/
|
|
1686
1923
|
class Item {
|
|
1924
|
+
/**
|
|
1925
|
+
* The live effects of the item, in the order in which they apply, as
|
|
1926
|
+
* the instances of the {@link Effect effects} that they use. They
|
|
1927
|
+
* derive what is drawn from the item without changing it: drawing
|
|
1928
|
+
* draws their output, and {@link #previewBounds} measures it, while
|
|
1929
|
+
* hit testing, {@link #bounds} and {@link #strokeBounds} stay with the
|
|
1930
|
+
* item itself. It is set to plain objects describing them, `{ type,
|
|
1931
|
+
* parameters, visible }`, with the `type` of the effect.
|
|
1932
|
+
* Changing the returned array directly isn't tracked, as with
|
|
1933
|
+
* {@link Path#segments}.
|
|
1934
|
+
*
|
|
1935
|
+
* Paper.js has these effects, and {@link Effect} creates more:
|
|
1936
|
+
*
|
|
1937
|
+
* - `offset`: offsets the paths, see {@link PathItem#offset}, with
|
|
1938
|
+
* the parameters `distance` (`0`), `join` (`'miter'`) and
|
|
1939
|
+
* `miterLimit` (`10`).
|
|
1940
|
+
* - `outline`: outlines the strokes of the paths as filled areas next
|
|
1941
|
+
* to their fills, see {@link PathItem#outline}, following their
|
|
1942
|
+
* {@link Path#strokeProfile}.
|
|
1943
|
+
*/
|
|
1944
|
+
effects: EffectInstance[]
|
|
1945
|
+
|
|
1946
|
+
/**
|
|
1947
|
+
* The bounds of what the item looks like with its effects, in the
|
|
1948
|
+
* coordinate space of its parent: of their output with its strokes, or of
|
|
1949
|
+
* its children's with their effects, and its {@link #strokeBounds}
|
|
1950
|
+
* without them, as Illustrator's "Use Preview Bounds".
|
|
1951
|
+
*/
|
|
1952
|
+
readonly previewBounds: Rectangle
|
|
1953
|
+
|
|
1687
1954
|
/**
|
|
1688
1955
|
* The key of the host's node that the item represents, in a project
|
|
1689
1956
|
* backed by a host document, see {@link Project#host}. It can only be
|
|
@@ -2179,6 +2446,136 @@ declare namespace paper {
|
|
|
2179
2446
|
*/
|
|
2180
2447
|
onMouseLeave: Function | null
|
|
2181
2448
|
|
|
2449
|
+
/**
|
|
2450
|
+
* The function to be called whenever the item is drawn: in views, in
|
|
2451
|
+
* {@link #rasterize}, and once for each placement of a symbol whose
|
|
2452
|
+
* definition contains it. It is called right before the item's default
|
|
2453
|
+
* drawing, and draws with the canvas API beneath it, or replaces it by
|
|
2454
|
+
* returning `false` or calling `event.preventDefault()`. The function
|
|
2455
|
+
* receives a {@link DrawEvent} object with these fields:
|
|
2456
|
+
*
|
|
2457
|
+
* @option event.item {Item} the item that is drawn
|
|
2458
|
+
* @option event.context {CanvasRenderingContext2D} the canvas context,
|
|
2459
|
+
* transformed into the item's coordinates
|
|
2460
|
+
* @option event.matrix {Matrix} the matrix from the item's coordinates to
|
|
2461
|
+
* the pixels of the view, without its pixel ratio, for drawing things
|
|
2462
|
+
* at a size in pixels
|
|
2463
|
+
* @option event.pixelRatio {Number} the device pixels per pixel: the
|
|
2464
|
+
* view's pixel ratio, or the resolution divided by 72 in
|
|
2465
|
+
* {@link #rasterize}
|
|
2466
|
+
* @option event.view {View} the view drawn into, or `null` in
|
|
2467
|
+
* {@link #rasterize}
|
|
2468
|
+
*
|
|
2469
|
+
* What the handler draws isn't part of the item's hit testing, its bounds
|
|
2470
|
+
* or its SVG export. In buffered groups, it is only called when the group
|
|
2471
|
+
* draws its buffer again, see {@link Group#buffered}.
|
|
2472
|
+
*/
|
|
2473
|
+
onDraw: Function | null
|
|
2474
|
+
|
|
2475
|
+
/**
|
|
2476
|
+
* The function to be called when the selection of the selected item is
|
|
2477
|
+
* drawn, over all the content. It is called right before the item's
|
|
2478
|
+
* default selection drawing, and draws with the canvas API beneath it, or
|
|
2479
|
+
* replaces it by returning `false` or calling `event.preventDefault()`. The
|
|
2480
|
+
* function receives a {@link DrawEvent} object with these fields:
|
|
2481
|
+
*
|
|
2482
|
+
* @option event.item {Item} the selected item
|
|
2483
|
+
* @option event.context {CanvasRenderingContext2D} the canvas context, in
|
|
2484
|
+
* the pixels of the view, with the selection color as its `strokeStyle`
|
|
2485
|
+
* and `fillStyle`, and a `lineWidth` of 1
|
|
2486
|
+
* @option event.matrix {Matrix} the matrix from the item's coordinates to
|
|
2487
|
+
* the pixels of the view
|
|
2488
|
+
* @option event.size {Number} the size of the handles, see
|
|
2489
|
+
* {@link PaperScope#settings}
|
|
2490
|
+
* @option event.color {Color} the selection color, see
|
|
2491
|
+
* {@link #selectedColor}
|
|
2492
|
+
* @option event.view {View} the view drawn into
|
|
2493
|
+
*
|
|
2494
|
+
* What the handler draws isn't part of the item's hit testing, its bounds
|
|
2495
|
+
* or its SVG export.
|
|
2496
|
+
*/
|
|
2497
|
+
onDrawSelection: Function | null
|
|
2498
|
+
|
|
2499
|
+
/**
|
|
2500
|
+
* The function to be called whenever any item of the class or of its
|
|
2501
|
+
* subclasses is drawn, as {@link #onDraw} is for a single item, e.g.
|
|
2502
|
+
* `Path.onDraw` for all paths, including the ones created later. The
|
|
2503
|
+
* item's own handlers are called first, then the ones of its class and of
|
|
2504
|
+
* the classes it inherits from, up to `Item`, with `this` set to the item.
|
|
2505
|
+
* `Path.on('draw', handler)` and `Path.off('draw', handler)` attach and
|
|
2506
|
+
* detach them too. Only the drawing events can be handled for classes of
|
|
2507
|
+
* items. Classes are shared by all {@link PaperScope} objects, and so are
|
|
2508
|
+
* their handlers.
|
|
2509
|
+
*/
|
|
2510
|
+
static onDraw: Function | null
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* The function to be called when the selection of any selected item of the
|
|
2514
|
+
* class or of its subclasses is drawn, as {@link #onDrawSelection} is for
|
|
2515
|
+
* a single item, e.g. `Path.onDrawSelection` for all paths, see
|
|
2516
|
+
* {@link Item.onDraw}.
|
|
2517
|
+
*/
|
|
2518
|
+
static onDrawSelection: Function | null
|
|
2519
|
+
|
|
2520
|
+
|
|
2521
|
+
/**
|
|
2522
|
+
* Adds an effect at the end of the item's effects.
|
|
2523
|
+
*
|
|
2524
|
+
* @param effect - the plain object describing the effect
|
|
2525
|
+
*
|
|
2526
|
+
* @return the added instance
|
|
2527
|
+
*/
|
|
2528
|
+
addEffect(effect: object): EffectInstance
|
|
2529
|
+
|
|
2530
|
+
/**
|
|
2531
|
+
* Inserts an effect into the item's effects at the given index.
|
|
2532
|
+
*
|
|
2533
|
+
* @param index - the index at which to insert the effect
|
|
2534
|
+
* @param effect - the plain object describing the effect
|
|
2535
|
+
*
|
|
2536
|
+
* @return the inserted instance
|
|
2537
|
+
*/
|
|
2538
|
+
insertEffect(index: number, effect: object): EffectInstance
|
|
2539
|
+
|
|
2540
|
+
/**
|
|
2541
|
+
* Inserts effects into the item's effects at the given index.
|
|
2542
|
+
*
|
|
2543
|
+
* @param index - the index at which to insert the effects
|
|
2544
|
+
* @param effects - the plain objects describing the effects
|
|
2545
|
+
*
|
|
2546
|
+
* @return the inserted instances
|
|
2547
|
+
*/
|
|
2548
|
+
insertEffects(index: number, effects: object[]): EffectInstance[]
|
|
2549
|
+
|
|
2550
|
+
/**
|
|
2551
|
+
* Removes the effect at the given index from the item's effects.
|
|
2552
|
+
*
|
|
2553
|
+
* @param index - the index of the effect to remove
|
|
2554
|
+
*
|
|
2555
|
+
* @return the removed instance, or `null`
|
|
2556
|
+
*/
|
|
2557
|
+
removeEffect(index: number): EffectInstance
|
|
2558
|
+
|
|
2559
|
+
/**
|
|
2560
|
+
* Removes the effects from the start index to the end index from the
|
|
2561
|
+
* item's effects, or all of them.
|
|
2562
|
+
*
|
|
2563
|
+
* @param start - the index of the first effect to remove
|
|
2564
|
+
* @param end - the index after the last one
|
|
2565
|
+
*
|
|
2566
|
+
* @return the removed instances
|
|
2567
|
+
*/
|
|
2568
|
+
removeEffects(start?: number, end?: number): EffectInstance[]
|
|
2569
|
+
|
|
2570
|
+
/**
|
|
2571
|
+
* Returns what the item's visible effects make of it, in the item's own
|
|
2572
|
+
* coordinates, outside of the scene graph, or `null` if it has none. It
|
|
2573
|
+
* is kept until the item, its content, its effects or the registered
|
|
2574
|
+
* effects change, so changing it isn't tracked.
|
|
2575
|
+
*
|
|
2576
|
+
* @return the output of the effects
|
|
2577
|
+
*/
|
|
2578
|
+
getEffectOutput(): Item | null
|
|
2182
2579
|
|
|
2183
2580
|
/**
|
|
2184
2581
|
* Sets the properties of the passed object literal on this item to the
|
|
@@ -2487,15 +2884,17 @@ declare namespace paper {
|
|
|
2487
2884
|
importJSON(json: string): Item
|
|
2488
2885
|
|
|
2489
2886
|
/**
|
|
2490
|
-
* Exports the item with its content and child items as an SVG DOM.
|
|
2887
|
+
* Exports the item with its content and child items as an SVG DOM. With
|
|
2888
|
+
* `options.bounds` or `options.matrix`, the item is wrapped in an `<svg>`
|
|
2889
|
+
* element sized to the bounds, as {@link Project#exportSVG} does.
|
|
2491
2890
|
*
|
|
2492
|
-
* @option [options.bounds
|
|
2493
|
-
*
|
|
2891
|
+
* @option [options.bounds] {String|Rectangle} the bounds of the area to
|
|
2892
|
+
* export, either as a string ({@values 'view', content'}), or a
|
|
2494
2893
|
* {@link Rectangle} object: `'view'` uses the view bounds,
|
|
2495
|
-
* `'content'` uses the stroke bounds of
|
|
2496
|
-
* @option [options.matrix
|
|
2497
|
-
*
|
|
2498
|
-
* `
|
|
2894
|
+
* `'content'` uses the stroke bounds of the item
|
|
2895
|
+
* @option [options.matrix] {Matrix} the matrix with which to transform the
|
|
2896
|
+
* exported content: If `options.bounds` is set to `'view'`,
|
|
2897
|
+
* `paper.view.matrix` is used, for all other settings of
|
|
2499
2898
|
* `options.bounds` the identity matrix is used.
|
|
2500
2899
|
* @option [options.asString=false] {Boolean} whether a SVG node or a
|
|
2501
2900
|
* `String` is to be returned
|
|
@@ -3105,7 +3504,7 @@ declare namespace paper {
|
|
|
3105
3504
|
*
|
|
3106
3505
|
* @param type - the type of event: {@values 'frame', mousedown',
|
|
3107
3506
|
* 'mouseup', 'mousedrag', 'click', 'doubleclick', 'mousemove',
|
|
3108
|
-
* 'mouseenter', 'mouseleave'}
|
|
3507
|
+
* 'mouseenter', 'mouseleave', 'draw', 'drawselection'}
|
|
3109
3508
|
* @param function - the function to be called when the event
|
|
3110
3509
|
* occurs, receiving a {@link MouseEvent} or {@link Event} object as its
|
|
3111
3510
|
* sole argument
|
|
@@ -3119,7 +3518,7 @@ declare namespace paper {
|
|
|
3119
3518
|
*
|
|
3120
3519
|
* @param object - an object containing one or more of the following
|
|
3121
3520
|
* properties: {@values frame, mousedown, mouseup, mousedrag, click,
|
|
3122
|
-
* doubleclick, mousemove, mouseenter, mouseleave}
|
|
3521
|
+
* doubleclick, mousemove, mouseenter, mouseleave, draw, drawselection}
|
|
3123
3522
|
*
|
|
3124
3523
|
* @return this item itself, so calls can be chained
|
|
3125
3524
|
*/
|
|
@@ -3130,7 +3529,7 @@ declare namespace paper {
|
|
|
3130
3529
|
*
|
|
3131
3530
|
* @param type - the type of event: {@values 'frame', mousedown',
|
|
3132
3531
|
* 'mouseup', 'mousedrag', 'click', 'doubleclick', 'mousemove',
|
|
3133
|
-
* 'mouseenter', 'mouseleave'}
|
|
3532
|
+
* 'mouseenter', 'mouseleave', 'draw', 'drawselection'}
|
|
3134
3533
|
* @param function - the function to be detached
|
|
3135
3534
|
*
|
|
3136
3535
|
* @return this item itself, so calls can be chained
|
|
@@ -3142,7 +3541,7 @@ declare namespace paper {
|
|
|
3142
3541
|
*
|
|
3143
3542
|
* @param object - an object containing one or more of the following
|
|
3144
3543
|
* properties: {@values frame, mousedown, mouseup, mousedrag, click,
|
|
3145
|
-
* doubleclick, mousemove, mouseenter, mouseleave}
|
|
3544
|
+
* doubleclick, mousemove, mouseenter, mouseleave, draw, drawselection}
|
|
3146
3545
|
*
|
|
3147
3546
|
* @return this item itself, so calls can be chained
|
|
3148
3547
|
*/
|
|
@@ -3153,7 +3552,7 @@ declare namespace paper {
|
|
|
3153
3552
|
*
|
|
3154
3553
|
* @param type - the type of event: {@values 'frame', mousedown',
|
|
3155
3554
|
* 'mouseup', 'mousedrag', 'click', 'doubleclick', 'mousemove',
|
|
3156
|
-
* 'mouseenter', 'mouseleave'}
|
|
3555
|
+
* 'mouseenter', 'mouseleave', 'draw', 'drawselection'}
|
|
3157
3556
|
* @param event - an object literal containing properties describing
|
|
3158
3557
|
* the event
|
|
3159
3558
|
*
|
|
@@ -3166,7 +3565,7 @@ declare namespace paper {
|
|
|
3166
3565
|
*
|
|
3167
3566
|
* @param type - the type of event: {@values 'frame', mousedown',
|
|
3168
3567
|
* 'mouseup', 'mousedrag', 'click', 'doubleclick', 'mousemove',
|
|
3169
|
-
* 'mouseenter', 'mouseleave'}
|
|
3568
|
+
* 'mouseenter', 'mouseleave', 'draw', 'drawselection'}
|
|
3170
3569
|
*
|
|
3171
3570
|
* @return true if the item has one or more event handlers of
|
|
3172
3571
|
* the specified type
|
|
@@ -3929,6 +4328,9 @@ declare namespace paper {
|
|
|
3929
4328
|
CompoundPath: typeof CompoundPath
|
|
3930
4329
|
Curve: typeof Curve
|
|
3931
4330
|
CurveLocation: typeof CurveLocation
|
|
4331
|
+
DrawEvent: typeof DrawEvent
|
|
4332
|
+
Effect: typeof Effect
|
|
4333
|
+
EffectInstance: typeof EffectInstance
|
|
3932
4334
|
Event: typeof Event
|
|
3933
4335
|
Gradient: typeof Gradient
|
|
3934
4336
|
GradientStop: typeof GradientStop
|
|
@@ -3946,6 +4348,7 @@ declare namespace paper {
|
|
|
3946
4348
|
Path: typeof Path
|
|
3947
4349
|
PathItem: typeof PathItem
|
|
3948
4350
|
PathText: typeof PathText
|
|
4351
|
+
PatternDefinition: typeof PatternDefinition
|
|
3949
4352
|
Point: typeof Point
|
|
3950
4353
|
PointText: typeof PointText
|
|
3951
4354
|
Project: typeof Project
|
|
@@ -3954,6 +4357,7 @@ declare namespace paper {
|
|
|
3954
4357
|
Segment: typeof Segment
|
|
3955
4358
|
Shape: typeof Shape
|
|
3956
4359
|
Size: typeof Size
|
|
4360
|
+
StrokeProfileStop: typeof StrokeProfileStop
|
|
3957
4361
|
Style: typeof Style
|
|
3958
4362
|
SymbolDefinition: typeof SymbolDefinition
|
|
3959
4363
|
SymbolItem: typeof SymbolItem
|
|
@@ -4079,18 +4483,25 @@ declare namespace paper {
|
|
|
4079
4483
|
* @option options.handlers {String[]} the names of further global
|
|
4080
4484
|
* handlers to export next to `onFrame`, `onResize` and the tool's
|
|
4081
4485
|
* handlers, for hosts that call them themselves
|
|
4486
|
+
* @option options.evaluate {Function} the evaluator for hosts that
|
|
4487
|
+
* evaluate code their own way: called with the source of a function
|
|
4488
|
+
* expression and `options.url`, and returning the function, e.g. by
|
|
4489
|
+
* evaluating the source as a script of that url
|
|
4082
4490
|
* @option options.load {Function} the loader for static `import`
|
|
4083
|
-
* statements, called with the specifier as written
|
|
4084
|
-
*
|
|
4085
|
-
*
|
|
4086
|
-
*
|
|
4087
|
-
*
|
|
4088
|
-
*
|
|
4491
|
+
* statements, called with the specifier as written, the `options.url`
|
|
4492
|
+
* of the importing script, and the import attributes as an object,
|
|
4493
|
+
* e.g. `{ type: 'paperscript' }` for `import x from 'm' with { type:
|
|
4494
|
+
* 'paperscript' }`, or `undefined` without them, and returning the
|
|
4495
|
+
* module's exports, e.g. the result of executing it. Modules with ES
|
|
4496
|
+
* `export` statements have their default export as `default` and are
|
|
4497
|
+
* marked with `__esModule`, so `import x` receives the default export,
|
|
4498
|
+
* and for CommonJS-style exports the whole exports. `import * as x`
|
|
4089
4499
|
* receives all exports, and for CommonJS-style exports, these as
|
|
4090
4500
|
* `default` too. Dynamic `import(specifier)` resolves to that
|
|
4091
4501
|
* namespace as a Promise, and its loader may return a Promise as well.
|
|
4092
|
-
*
|
|
4093
|
-
*
|
|
4502
|
+
* `import(specifier, options)` passes on `options.with` as the
|
|
4503
|
+
* attributes. The loader runs each module once and handles cycles.
|
|
4504
|
+
* Parsing `import` requires a current Acorn as `self.acorn`
|
|
4094
4505
|
*
|
|
4095
4506
|
* Code with top-level `await` runs as an async function. `execute()` then
|
|
4096
4507
|
* returns a Promise of the exports, and installs the global handlers once
|
|
@@ -4103,7 +4514,7 @@ declare namespace paper {
|
|
|
4103
4514
|
* @return the exports defined in the executed code, or
|
|
4104
4515
|
* with top-level `await`, a Promise of them
|
|
4105
4516
|
*/
|
|
4106
|
-
static execute(code: string, scope: PaperScope, options?: { url?: string, source?: string, handlers?: string[], load?: Function }): object | Promise<any>
|
|
4517
|
+
static execute(code: string, scope: PaperScope, options?: { url?: string, source?: string, handlers?: string[], evaluate?: Function, load?: Function }): object | Promise<any>
|
|
4107
4518
|
|
|
4108
4519
|
/**
|
|
4109
4520
|
* Loads, compiles and executes PaperScript code in the HTML document. Note
|
|
@@ -4129,6 +4540,38 @@ declare namespace paper {
|
|
|
4129
4540
|
* The path item represents a path in a Paper.js project.
|
|
4130
4541
|
*/
|
|
4131
4542
|
class Path extends PathItem {
|
|
4543
|
+
/**
|
|
4544
|
+
* The stroke profile of the path: the stops along it that set the pen
|
|
4545
|
+
* that draws its stroke, an ellipse with a width, as a factor of its
|
|
4546
|
+
* {@link Style#strokeWidth}, an aspect and an angle, see
|
|
4547
|
+
* {@link StrokeProfileStop}. The stops are sorted by their offsets.
|
|
4548
|
+
* Between the stops that set a value, it changes along the path,
|
|
4549
|
+
* easing into and out of smooth stops and in straight lines from the
|
|
4550
|
+
* others, see {@link StrokeProfileStop#smooth}, and beyond the ends
|
|
4551
|
+
* of open paths, it stays as at the first and last of them. Two stops
|
|
4552
|
+
* at the same offset make a step. The stops stay between the same
|
|
4553
|
+
* segments when they move. Without a stroke profile, the stroke is
|
|
4554
|
+
* drawn with a round pen of the stroke width all along.
|
|
4555
|
+
*
|
|
4556
|
+
* It is a property of the path, not of its style, as it is tied to
|
|
4557
|
+
* its segments. It can be set to stops or plain objects describing
|
|
4558
|
+
* them, `{ offset, width, aspect, angle, smooth }`, and JSON stores
|
|
4559
|
+
* them with the indices that tie them to the segments instead of
|
|
4560
|
+
* their offsets, `{ index, width, aspect, angle, smooth }`. Changing
|
|
4561
|
+
* the returned array directly isn't tracked, as with
|
|
4562
|
+
* {@link #segments}.
|
|
4563
|
+
*
|
|
4564
|
+
* The path draws its stroke as the area that the pens sweep, filled
|
|
4565
|
+
* with the stroke color, as {@link PathItem#outline} returns it,
|
|
4566
|
+
* and {@link Item#strokeBounds} and hit-testing measure that area.
|
|
4567
|
+
* The children of compound paths are drawn with the stroke of their
|
|
4568
|
+
* parent, without their profiles. With {@link Style#strokeScaling}
|
|
4569
|
+
* off, the profile scales with the view. {@link PathItem#offset},
|
|
4570
|
+
* the boolean operations, {@link PathItem#interpolate} and SVG
|
|
4571
|
+
* export return paths without the profile.
|
|
4572
|
+
*/
|
|
4573
|
+
strokeProfile: StrokeProfileStop[] | null
|
|
4574
|
+
|
|
4132
4575
|
/**
|
|
4133
4576
|
* The segments contained within the path. Segments that define a
|
|
4134
4577
|
* {@link Segment#name} can also be accessed by name.
|
|
@@ -4213,6 +4656,23 @@ declare namespace paper {
|
|
|
4213
4656
|
*/
|
|
4214
4657
|
constructor(object: object)
|
|
4215
4658
|
|
|
4659
|
+
/**
|
|
4660
|
+
* Returns the pen of the {@link #strokeProfile} at the given offset
|
|
4661
|
+
* along the path, as a stop that isn't on the path, with all its
|
|
4662
|
+
* values: its width as a factor of the {@link Style#strokeWidth}, its
|
|
4663
|
+
* aspect and its angle, `1`, `1` and `0` where no stop sets them.
|
|
4664
|
+
* Where the profile has a step, it returns the values after it. Adding
|
|
4665
|
+
* the stop to the profile keeps the values at the offset, and where
|
|
4666
|
+
* they change in straight lines, also around it if the stop isn't
|
|
4667
|
+
* smooth. As a smooth stop, the values ease into it and out of it.
|
|
4668
|
+
*
|
|
4669
|
+
* @param offset - the offset on the path, where `0` is at the
|
|
4670
|
+
* beginning of the path and {@link Path#length} at the end
|
|
4671
|
+
*
|
|
4672
|
+
* @return the pen at the offset
|
|
4673
|
+
*/
|
|
4674
|
+
getStrokeProfileAt(offset: number): StrokeProfileStop
|
|
4675
|
+
|
|
4216
4676
|
/**
|
|
4217
4677
|
* Adds one or more segments to the end of the {@link #segments} array of
|
|
4218
4678
|
* this path.
|
|
@@ -4861,6 +5321,82 @@ declare namespace paper {
|
|
|
4861
5321
|
*/
|
|
4862
5322
|
reorient(nonZero?: boolean, clockwise?: boolean): PathItem
|
|
4863
5323
|
|
|
5324
|
+
/**
|
|
5325
|
+
* Offsets the path item by the given distance and returns the result
|
|
5326
|
+
* as a new path item. Closed paths and compound paths grow by positive
|
|
5327
|
+
* distances and shrink by negative ones, open paths are offset along
|
|
5328
|
+
* their normals for positive distances, and against them for negative
|
|
5329
|
+
* ones. As with the boolean operations, the path item's matrix is
|
|
5330
|
+
* applied first.
|
|
5331
|
+
*
|
|
5332
|
+
* @option [options.join='miter'] {String} the shape of the corners
|
|
5333
|
+
* that the offset adds where the path turns away from it:
|
|
5334
|
+
* {@values 'miter', 'round', 'bevel'}
|
|
5335
|
+
* @option [options.miterLimit=10] {Number} the limit of miter corners,
|
|
5336
|
+
* see {@link Style#miterLimit}
|
|
5337
|
+
* @option [options.insert=true] {Boolean} whether the resulting item
|
|
5338
|
+
* should be inserted back into the scene graph, above this path
|
|
5339
|
+
*
|
|
5340
|
+
* @param distance - the distance to offset the path item by
|
|
5341
|
+
* @param options - the offset options
|
|
5342
|
+
*
|
|
5343
|
+
* @return the resulting path item
|
|
5344
|
+
*/
|
|
5345
|
+
offset(distance: number, options?: { join?: string, miterLimit?: number, insert?: boolean }): PathItem
|
|
5346
|
+
|
|
5347
|
+
/**
|
|
5348
|
+
* Outlines the stroke of the path item, and returns the area that it
|
|
5349
|
+
* covers as a new path item, filled with the stroke's color. As with
|
|
5350
|
+
* the boolean operations, the path item's matrix is applied first.
|
|
5351
|
+
* Dashed strokes are outlined as their dashes, each with the stroke's
|
|
5352
|
+
* caps, as the canvas draws them, see {@link #dash}.
|
|
5353
|
+
*
|
|
5354
|
+
* Paths with a {@link Path#strokeProfile} are outlined as the area
|
|
5355
|
+
* that its pens sweep. Their round joins and caps are the pens
|
|
5356
|
+
* themselves, and their other joins and caps connect the points where
|
|
5357
|
+
* the pens touch the sides of the stroke. Steps in the profile end
|
|
5358
|
+
* the parts of the stroke straight across, as butt caps do.
|
|
5359
|
+
*
|
|
5360
|
+
* @option [options.width=this.strokeWidth] {Number} the width of the
|
|
5361
|
+
* stroke
|
|
5362
|
+
* @option [options.join=this.strokeJoin] {String} the shape of the
|
|
5363
|
+
* stroke's corners: {@values 'miter', 'round', 'bevel'}
|
|
5364
|
+
* @option [options.cap=this.strokeCap] {String} the shape of the
|
|
5365
|
+
* stroke's ends: {@values 'round', 'square', 'butt'}
|
|
5366
|
+
* @option [options.miterLimit=this.miterLimit] {Number} the limit of
|
|
5367
|
+
* miter corners, see {@link Style#miterLimit}
|
|
5368
|
+
* @option [options.insert=true] {Boolean} whether the resulting item
|
|
5369
|
+
* should be inserted back into the scene graph, above this path
|
|
5370
|
+
*
|
|
5371
|
+
* @param options - the outline options
|
|
5372
|
+
*
|
|
5373
|
+
* @return the resulting path item
|
|
5374
|
+
*/
|
|
5375
|
+
outline(options?: { width?: number, join?: string, cap?: string, miterLimit?: number, insert?: boolean }): PathItem
|
|
5376
|
+
|
|
5377
|
+
/**
|
|
5378
|
+
* Cuts the stroke of the path item into its dashes, as the canvas draws
|
|
5379
|
+
* them with the {@link Style#dashArray} and {@link Style#dashOffset}
|
|
5380
|
+
* of the path item or those of the options, and returns them as a new
|
|
5381
|
+
* group of open paths with the path item's style, without its dash
|
|
5382
|
+
* pattern. The pattern starts over on each path of a compound path,
|
|
5383
|
+
* and the dashes keep the parts of the paths' stroke profiles. As with
|
|
5384
|
+
* the boolean operations, the path item's matrix is applied first.
|
|
5385
|
+
*
|
|
5386
|
+
* @option [options.dashArray=this.dashArray] {Number[]} the lengths of
|
|
5387
|
+
* the dashes and the gaps between them
|
|
5388
|
+
* @option [options.dashOffset=this.dashOffset] {Number} the offset
|
|
5389
|
+
* into the pattern at which the dashes start
|
|
5390
|
+
* @option [options.insert=true] {Boolean} whether the resulting group
|
|
5391
|
+
* should be inserted back into the scene graph, above this path
|
|
5392
|
+
* item
|
|
5393
|
+
*
|
|
5394
|
+
* @param options - the dash options
|
|
5395
|
+
*
|
|
5396
|
+
* @return the dashes, as a new group of paths
|
|
5397
|
+
*/
|
|
5398
|
+
dash(options?: { dashArray?: number[], dashOffset?: number, insert?: boolean }): Group
|
|
5399
|
+
|
|
4864
5400
|
/**
|
|
4865
5401
|
* Creates a path item from the given SVG path-data, determining if the
|
|
4866
5402
|
* data describes a plain path or a compound-path with multiple
|
|
@@ -5064,13 +5600,29 @@ declare namespace paper {
|
|
|
5064
5600
|
* This method can be used to process and simplify the point data received
|
|
5065
5601
|
* from a mouse or touch device.
|
|
5066
5602
|
*
|
|
5067
|
-
*
|
|
5068
|
-
*
|
|
5603
|
+
* With `options.from` and `options.to`, only the segments in that range
|
|
5604
|
+
* are replaced. The fitted curves join the curves outside of the range
|
|
5605
|
+
* tangentially where these have handles.
|
|
5606
|
+
*
|
|
5607
|
+
* @option [options.tolerance=2.5] {Number} the allowed maximum error when
|
|
5608
|
+
* fitting the curves through the segment points
|
|
5609
|
+
* @option options.from {Number|Segment|Curve} the segment or curve at which
|
|
5610
|
+
* to start simplifying, if not the full path shall be simplified
|
|
5611
|
+
* (inclusive). This can either be a segment index, or a segment or
|
|
5612
|
+
* curve object that is part of the path. If the passed number is
|
|
5613
|
+
* negative, the index is wrapped around the end of the path.
|
|
5614
|
+
* @option options.to {Number|Segment|Curve} the segment or curve up to
|
|
5615
|
+
* which to simplify (inclusive). This can either be a segment index,
|
|
5616
|
+
* or a segment or curve object that is part of the path. If the passed
|
|
5617
|
+
* number is negative, the index is wrapped around the end of the path.
|
|
5618
|
+
*
|
|
5619
|
+
* @param options - the simplification options, or the
|
|
5620
|
+
* tolerance as a number
|
|
5069
5621
|
*
|
|
5070
5622
|
* @return true if the method was capable of fitting curves
|
|
5071
5623
|
* through the path's segment points
|
|
5072
5624
|
*/
|
|
5073
|
-
simplify(
|
|
5625
|
+
simplify(options?: object | number): boolean
|
|
5074
5626
|
|
|
5075
5627
|
/**
|
|
5076
5628
|
* Interpolates between the two specified path items and uses the result
|
|
@@ -5155,6 +5707,35 @@ declare namespace paper {
|
|
|
5155
5707
|
*/
|
|
5156
5708
|
arcTo(to: PointLike, clockwise?: boolean): void
|
|
5157
5709
|
|
|
5710
|
+
/**
|
|
5711
|
+
* Adds an arc that sweeps the specified angle around the specified
|
|
5712
|
+
* `center` point, from the position of the last segment in the path, by
|
|
5713
|
+
* adding one or more segments to the path. Positive angles draw the arc in
|
|
5714
|
+
* clockwise direction, negative ones in anticlockwise direction.
|
|
5715
|
+
*
|
|
5716
|
+
* @param center - the center of the arc
|
|
5717
|
+
* @param angle - the angle in degrees that the arc sweeps over
|
|
5718
|
+
*/
|
|
5719
|
+
arcAround(center: PointLike, angle: number): void
|
|
5720
|
+
|
|
5721
|
+
/**
|
|
5722
|
+
* Adds an arc from the position of the last segment in the path to the
|
|
5723
|
+
* specified point, by adding one or more segments to the path. The arc
|
|
5724
|
+
* continues in the direction in which the path ends, without a corner.
|
|
5725
|
+
*
|
|
5726
|
+
* @param to - the point where the arc should end
|
|
5727
|
+
*/
|
|
5728
|
+
arcTowards(to: PointLike): void
|
|
5729
|
+
|
|
5730
|
+
/**
|
|
5731
|
+
* Adds an arc from the position of the last segment in the path to the
|
|
5732
|
+
* specified point, by adding one or more segments to the path. The arc
|
|
5733
|
+
* continues in the direction in which the path ends, without a corner.
|
|
5734
|
+
*
|
|
5735
|
+
* @param to - the point where the arc should end
|
|
5736
|
+
*/
|
|
5737
|
+
arcTowards(x: number, y: number): void
|
|
5738
|
+
|
|
5158
5739
|
/**
|
|
5159
5740
|
* Adds a curve from the last segment in the path through the specified
|
|
5160
5741
|
* `through` point, to the specified destination point by adding one segment
|
|
@@ -5357,6 +5938,71 @@ declare namespace paper {
|
|
|
5357
5938
|
|
|
5358
5939
|
}
|
|
5359
5940
|
|
|
5941
|
+
/**
|
|
5942
|
+
* A pattern definition repeats an item as the tile of pattern colors,
|
|
5943
|
+
* which fill and stroke items with it, see {@link Color#pattern}: a
|
|
5944
|
+
* {@link Raster} for image patterns, or any other item for vector patterns. As
|
|
5945
|
+
* with symbol definitions, the item is removed from the scene graph, and all
|
|
5946
|
+
* pattern colors that use the pattern share it, so they change along with it.
|
|
5947
|
+
*/
|
|
5948
|
+
class PatternDefinition {
|
|
5949
|
+
/**
|
|
5950
|
+
* The project that this pattern belongs to.
|
|
5951
|
+
*/
|
|
5952
|
+
readonly project: Project
|
|
5953
|
+
|
|
5954
|
+
/**
|
|
5955
|
+
* The name of the pattern.
|
|
5956
|
+
*/
|
|
5957
|
+
name: string
|
|
5958
|
+
|
|
5959
|
+
/**
|
|
5960
|
+
* The item that the pattern repeats. Unlike the items of symbols, it isn't
|
|
5961
|
+
* moved to 0, 0, so the tiles are at its own coordinates.
|
|
5962
|
+
*/
|
|
5963
|
+
item: Item
|
|
5964
|
+
|
|
5965
|
+
/**
|
|
5966
|
+
* The rectangle that is repeated, in the coordinates of the pattern's
|
|
5967
|
+
* item.
|
|
5968
|
+
*/
|
|
5969
|
+
get tile(): Rectangle
|
|
5970
|
+
set tile(value: RectangleLike)
|
|
5971
|
+
|
|
5972
|
+
/**
|
|
5973
|
+
* The gap between the tiles, horizontally and vertically.
|
|
5974
|
+
*/
|
|
5975
|
+
get spacing(): Size
|
|
5976
|
+
set spacing(value: SizeLike)
|
|
5977
|
+
|
|
5978
|
+
|
|
5979
|
+
/**
|
|
5980
|
+
* Creates a pattern definition.
|
|
5981
|
+
*
|
|
5982
|
+
* @option [options.tile] {Rectangle} the rectangle that is repeated,
|
|
5983
|
+
* the bounds of the item by default
|
|
5984
|
+
* @option [options.spacing=0] {Size} the gap between the tiles
|
|
5985
|
+
* @option [options.name] {String} the name of the pattern
|
|
5986
|
+
*
|
|
5987
|
+
* @param item - the item to repeat, which is removed from the scene
|
|
5988
|
+
* graph and becomes the pattern's tile content
|
|
5989
|
+
*/
|
|
5990
|
+
constructor(item: Item, options?: { tile?: RectangleLike, spacing?: SizeLike, name?: string })
|
|
5991
|
+
|
|
5992
|
+
/**
|
|
5993
|
+
* Returns a copy of the pattern, with a copy of its item and its name.
|
|
5994
|
+
*/
|
|
5995
|
+
clone(): PatternDefinition
|
|
5996
|
+
|
|
5997
|
+
/**
|
|
5998
|
+
* Checks whether the pattern is equal to the supplied pattern.
|
|
5999
|
+
*
|
|
6000
|
+
* @return true if they are equal
|
|
6001
|
+
*/
|
|
6002
|
+
equals(pattern: PatternDefinition): boolean
|
|
6003
|
+
|
|
6004
|
+
}
|
|
6005
|
+
|
|
5360
6006
|
/**
|
|
5361
6007
|
* The Point object represents a point in the two dimensional space
|
|
5362
6008
|
* of the Paper.js project. It is also used to represent two dimensional
|
|
@@ -6014,20 +6660,32 @@ declare namespace paper {
|
|
|
6014
6660
|
* The host document that the project's items come from. Setting it
|
|
6015
6661
|
* creates the project's layers from the host's records. All items
|
|
6016
6662
|
* are created as shells that load their content and children from the
|
|
6017
|
-
* host on first access.
|
|
6663
|
+
* host on first access. The host draws its items, so setting it also
|
|
6664
|
+
* turns off {@link View#autoUpdate}, which would draw them all and
|
|
6665
|
+
* load them in full.
|
|
6018
6666
|
*
|
|
6019
6667
|
* The host provides:
|
|
6020
6668
|
* - `getChildren(key)`, which returns the records of the children of
|
|
6021
6669
|
* the node with the given key, or of the top level for `null`, as
|
|
6022
6670
|
* columns: `keys`, `types` (indices into `typeNames`), `typeNames`,
|
|
6023
6671
|
* `flags` (selected: 1, visible: 2, locked: 4, strokeScaling: 8,
|
|
6024
|
-
* clipMask: 64, guide: 128, empty: 256), `boxes`
|
|
6025
|
-
* strokeBounds and roughBounds in the item's coordinates, 12
|
|
6026
|
-
* per item), and the sparse objects `names` and `matrices`.
|
|
6672
|
+
* clipMask: 64, guide: 128, empty: 256), optionally `boxes`
|
|
6673
|
+
* (bounds, strokeBounds and roughBounds in the item's coordinates, 12
|
|
6674
|
+
* numbers per item), and the sparse objects `names` and `matrices`.
|
|
6675
|
+
* - `getBounds(key)`, for hosts that don't send `boxes`, which returns
|
|
6676
|
+
* the node's 12 numbers, or `null` for an empty node. Items ask for
|
|
6677
|
+
* them when their bounds are needed, and again after the host sent
|
|
6678
|
+
* their record again.
|
|
6027
6679
|
* - `getItem(key)`, which returns the node's own content in the form
|
|
6028
6680
|
* of {@link Item#importJSON}, without children. Linked text
|
|
6029
6681
|
* gives `linked`, the keys of its story's text items in order, and
|
|
6030
|
-
* leaves out its story.
|
|
6682
|
+
* leaves out its story. Rasters give their `size` without a `source`
|
|
6683
|
+
* and `crossOrigin`.
|
|
6684
|
+
* - `getImage(key)`, for rasters, which returns the node's pixels as a
|
|
6685
|
+
* canvas with a 2D context, of the size that `getItem()` gives.
|
|
6686
|
+
* Rasters load them on first access to their pixels, and Paper.js
|
|
6687
|
+
* never loads them by itself, except to draw them. Rasters whose
|
|
6688
|
+
* pixels the host fails to give draw nothing.
|
|
6031
6689
|
* - `getStory(key)`, for linked text, which returns its story with the
|
|
6032
6690
|
* key of any of its text items: `content` or `runs`, `paragraphs`,
|
|
6033
6691
|
* and the character and paragraph styles, as
|
|
@@ -6049,6 +6707,53 @@ declare namespace paper {
|
|
|
6049
6707
|
* `content`, as for a hyphen, all in the item's coordinates. `key`
|
|
6050
6708
|
* is null for text that the host doesn't know yet. Without it,
|
|
6051
6709
|
* Paper.js lays out text itself.
|
|
6710
|
+
* - `getDefinition(key)`, for the pattern and symbol definitions that
|
|
6711
|
+
* the host shares between its items, which the JSON of its items
|
|
6712
|
+
* refers to as `['@key']`, as in `fillColor: ['pattern',
|
|
6713
|
+
* ['@pattern/Dots'], matrix]` or `definition: ['@symbol/Star']`.
|
|
6714
|
+
* It returns the definition in the form of
|
|
6715
|
+
* {@link Item#exportJSON}, with its whole item:
|
|
6716
|
+
* `['PatternDefinition', item, { tile, spacing }]` or
|
|
6717
|
+
* `['SymbolDefinition', item]`, always: for a key that it has no
|
|
6718
|
+
* definition of, an empty one of the type, as
|
|
6719
|
+
* `['SymbolDefinition', ['Group', {}]]`. Each definition loads
|
|
6720
|
+
* once, and the JSON of the items that use it, as
|
|
6721
|
+
* {@link Item#exportJSON} writes it, refers to it by its
|
|
6722
|
+
* key again. Definitions that scripts create have no key, and are
|
|
6723
|
+
* written out whole, until the host sets their `key`, which it can
|
|
6724
|
+
* only set once. {@link Project#takeChanges} lists those that the
|
|
6725
|
+
* changed items use first, nested ones first, as
|
|
6726
|
+
* `{ definition, flags }` with the `ChangeFlag.INSERTION` flag,
|
|
6727
|
+
* followed by the changes of the host's definitions. Renaming those
|
|
6728
|
+
* isn't supported.
|
|
6729
|
+
* - `getDefinitionKeys(type)`, which returns the keys of all the
|
|
6730
|
+
* host's definitions of the type, `'SymbolDefinition'` or
|
|
6731
|
+
* `'PatternDefinition'`, for {@link #symbolDefinitions} and
|
|
6732
|
+
* {@link #patternDefinitions}.
|
|
6733
|
+
*
|
|
6734
|
+
* Items that move into a project with another host load in full from
|
|
6735
|
+
* their own host first, and drop their keys, so they are new items
|
|
6736
|
+
* there. They bring copies without keys of the symbol and pattern
|
|
6737
|
+
* definitions of their host along, shared by the items of one
|
|
6738
|
+
* insertion or copy, so the new host takes them as new ones too.
|
|
6739
|
+
* Linked text brings a copy of its story along, which flows on through
|
|
6740
|
+
* the items that stay. Host items can't enter the project of another
|
|
6741
|
+
* host.
|
|
6742
|
+
*
|
|
6743
|
+
* The host draws the items, and the selection. To show what scripts
|
|
6744
|
+
* draw in {@link Item#onDraw} and {@link Item#onDrawSelection}, it
|
|
6745
|
+
* calls `project.draw(ctx, matrix, pixelRatio)`, which in a hosted
|
|
6746
|
+
* project only calls these handlers, with the context, the view's
|
|
6747
|
+
* matrix and pixel ratio that the host gives, for the visible items
|
|
6748
|
+
* that have them, and for the selected ones. Handlers of classes,
|
|
6749
|
+
* such as `Path.onDraw`, load all items once. The host asks
|
|
6750
|
+
* {@link #hasDrawHandlers} whether it needs to call it.
|
|
6751
|
+
*
|
|
6752
|
+
* {@link Project#takeChanges} marks the changes of the items whose
|
|
6753
|
+
* children changed in order other than by new items inserted and
|
|
6754
|
+
* items removed, which the other changes don't tell, with
|
|
6755
|
+
* `reordered: true`: the host reads their children whole, and can
|
|
6756
|
+
* place the others' new items by their indices.
|
|
6052
6757
|
*/
|
|
6053
6758
|
host: any
|
|
6054
6759
|
|
|
@@ -6059,6 +6764,37 @@ declare namespace paper {
|
|
|
6059
6764
|
*/
|
|
6060
6765
|
trackChanges: boolean
|
|
6061
6766
|
|
|
6767
|
+
/**
|
|
6768
|
+
* The function to be called when the project is activated through
|
|
6769
|
+
* {@link #activate}. The function receives the previously active
|
|
6770
|
+
* project, which is the project itself when it was already active.
|
|
6771
|
+
*/
|
|
6772
|
+
onActivate: Function | null
|
|
6773
|
+
|
|
6774
|
+
/**
|
|
6775
|
+
* The function to be called when another project is activated through
|
|
6776
|
+
* {@link #activate} while this one is active, or when this one is
|
|
6777
|
+
* removed while active.
|
|
6778
|
+
*/
|
|
6779
|
+
onDeactivate: Function | null
|
|
6780
|
+
|
|
6781
|
+
/**
|
|
6782
|
+
* The function to be called when any project is activated, as
|
|
6783
|
+
* {@link #onActivate} is for a single project, including the projects
|
|
6784
|
+
* that activate themselves when they are created, with `this` set to the
|
|
6785
|
+
* project. `Project.on('activate', handler)` and
|
|
6786
|
+
* `Project.off('activate', handler)` attach and detach them too. Classes
|
|
6787
|
+
* are shared by all {@link PaperScope} objects, and so are their handlers.
|
|
6788
|
+
*/
|
|
6789
|
+
static onActivate: Function | null
|
|
6790
|
+
|
|
6791
|
+
/**
|
|
6792
|
+
* The function to be called when any project is deactivated, as
|
|
6793
|
+
* {@link #onDeactivate} is for a single project, see
|
|
6794
|
+
* {@link Project.onActivate}.
|
|
6795
|
+
*/
|
|
6796
|
+
static onDeactivate: Function | null
|
|
6797
|
+
|
|
6062
6798
|
/**
|
|
6063
6799
|
* The scope that this project belongs to.
|
|
6064
6800
|
*/
|
|
@@ -6109,6 +6845,12 @@ declare namespace paper {
|
|
|
6109
6845
|
*/
|
|
6110
6846
|
readonly symbols: SymbolDefinition[]
|
|
6111
6847
|
|
|
6848
|
+
/**
|
|
6849
|
+
* The pattern definitions that the fill and stroke colors of the items in
|
|
6850
|
+
* the project use.
|
|
6851
|
+
*/
|
|
6852
|
+
readonly patternDefinitions: PatternDefinition[]
|
|
6853
|
+
|
|
6112
6854
|
/**
|
|
6113
6855
|
* The selected items contained within the project.
|
|
6114
6856
|
*/
|
|
@@ -6139,13 +6881,29 @@ declare namespace paper {
|
|
|
6139
6881
|
*/
|
|
6140
6882
|
getItemByKey(key: number): Item
|
|
6141
6883
|
|
|
6884
|
+
/**
|
|
6885
|
+
* Checks whether any item of the project or class has draw handlers,
|
|
6886
|
+
* {@link Item#onDraw} or, for the selected items,
|
|
6887
|
+
* {@link Item#onDrawSelection}, for hosts that draw the items
|
|
6888
|
+
* themselves, see {@link #host}.
|
|
6889
|
+
*
|
|
6890
|
+
* @return true if drawing the project calls any handlers
|
|
6891
|
+
*/
|
|
6892
|
+
hasDrawHandlers(): boolean
|
|
6893
|
+
|
|
6142
6894
|
/**
|
|
6143
6895
|
* Updates the items of changed host nodes, given in the column format
|
|
6144
6896
|
* of the host's `getChildren()`, with two more flags: 16 when the
|
|
6145
6897
|
* node's own content changed, so the item loads it again on next
|
|
6146
6898
|
* access, and 32 when its list of children changed, so it loads them
|
|
6147
6899
|
* again right away if it had loaded them, keeping the items of nodes
|
|
6148
|
-
* that remain. Nodes without items are skipped.
|
|
6900
|
+
* that remain. Nodes without items are skipped. `definitions` lists
|
|
6901
|
+
* the keys of changed definitions of the host's `getDefinition()`,
|
|
6902
|
+
* which load again right away into the same objects, so the colors
|
|
6903
|
+
* and symbol items that use them change along. A definition that the
|
|
6904
|
+
* host no longer has, for which `getDefinition()` may return `null`
|
|
6905
|
+
* here, is emptied and draws nothing. The columns may hold only
|
|
6906
|
+
* definitions.
|
|
6149
6907
|
*
|
|
6150
6908
|
* @param columns - the records of the changed nodes
|
|
6151
6909
|
*/
|
|
@@ -6155,10 +6913,14 @@ declare namespace paper {
|
|
|
6155
6913
|
* Returns the changes logged since tracking was activated or since the
|
|
6156
6914
|
* last call, and clears the log. Each item is listed once, with the
|
|
6157
6915
|
* {@link ChangeFlag} values of all its changes combined. Removed items are
|
|
6158
|
-
* listed with the `ChangeFlag.INSERTION` flag
|
|
6916
|
+
* listed with the `ChangeFlag.INSERTION` flag, and items that moved to
|
|
6917
|
+
* another project are left out, as that one lists them. Symbol and pattern
|
|
6918
|
+
* definitions whose item, tile, spacing or name changed are listed too,
|
|
6919
|
+
* as `{ definition, flags }`.
|
|
6159
6920
|
*
|
|
6160
|
-
* @return the changes as `{ item, flags }`
|
|
6161
|
-
* if {link #trackChanges}
|
|
6921
|
+
* @return the changes as `{ item, flags }` and
|
|
6922
|
+
* `{ definition, flags }` objects, or `null` if {link #trackChanges}
|
|
6923
|
+
* is off
|
|
6162
6924
|
*/
|
|
6163
6925
|
takeChanges(): object[]
|
|
6164
6926
|
|
|
@@ -7145,7 +7907,8 @@ declare namespace paper {
|
|
|
7145
7907
|
* by name through its path's segments list. If several segments share a
|
|
7146
7908
|
* name, the first one is found.
|
|
7147
7909
|
*
|
|
7148
|
-
* The name is stored in JSON,
|
|
7910
|
+
* The name is stored in JSON, and in SVG in the `data-paper-segments`
|
|
7911
|
+
* attribute of the path, see {@link Segment#data}.
|
|
7149
7912
|
*/
|
|
7150
7913
|
name: string | null
|
|
7151
7914
|
|
|
@@ -7153,7 +7916,10 @@ declare namespace paper {
|
|
|
7153
7916
|
* A plain javascript object which can be used to store arbitrary data on
|
|
7154
7917
|
* the segment.
|
|
7155
7918
|
*
|
|
7156
|
-
* The data is stored in JSON,
|
|
7919
|
+
* The data is stored in JSON, and in SVG in the `data-paper-segments`
|
|
7920
|
+
* attribute of the path, keyed by the index of the segment. Paper.js drops
|
|
7921
|
+
* it on import if the indices don't fit the path anymore, as happens when
|
|
7922
|
+
* another editor removes segments.
|
|
7157
7923
|
*/
|
|
7158
7924
|
data: any
|
|
7159
7925
|
|
|
@@ -7806,6 +8572,85 @@ declare namespace paper {
|
|
|
7806
8572
|
|
|
7807
8573
|
}
|
|
7808
8574
|
|
|
8575
|
+
/**
|
|
8576
|
+
* A stop of the stroke profile of a path, see
|
|
8577
|
+
* {@link Path#strokeProfile}: the pen that draws its stroke at an offset along
|
|
8578
|
+
* the path, an ellipse with a width, an aspect and an angle. Between the
|
|
8579
|
+
* stops, each of them changes along the path, easing into and out of smooth
|
|
8580
|
+
* stops and in straight lines from the others, see {@link #smooth}. A stop can set
|
|
8581
|
+
* only some of them, and leave the others to the stops around it.
|
|
8582
|
+
*/
|
|
8583
|
+
class StrokeProfileStop {
|
|
8584
|
+
/**
|
|
8585
|
+
* The path whose stroke profile the stop is part of.
|
|
8586
|
+
*/
|
|
8587
|
+
readonly path: Path | null
|
|
8588
|
+
|
|
8589
|
+
/**
|
|
8590
|
+
* The offset of the stop along its path, as in
|
|
8591
|
+
* {@link Path#getPointAt}. Unlike the offset of gradient stops, it
|
|
8592
|
+
* is a length, not a fraction. The stop stays between the same segments
|
|
8593
|
+
* when they move, so its offset changes with the lengths of the curves
|
|
8594
|
+
* before it.
|
|
8595
|
+
*/
|
|
8596
|
+
offset: number
|
|
8597
|
+
|
|
8598
|
+
/**
|
|
8599
|
+
* The width of the pen at the stop, as a factor of the path's
|
|
8600
|
+
* {@link Style#strokeWidth}: `1` for the stroke width, `2` for twice
|
|
8601
|
+
* as wide. Stops without a width leave it to the stops around them, and
|
|
8602
|
+
* without any, it is `1`.
|
|
8603
|
+
*/
|
|
8604
|
+
width: number | null
|
|
8605
|
+
|
|
8606
|
+
/**
|
|
8607
|
+
* The aspect of the pen at the stop: its height as a factor of its width,
|
|
8608
|
+
* `1` for a round pen, less for a flat nib. Stops without an aspect leave
|
|
8609
|
+
* it to the stops around them, and without any, it is `1`.
|
|
8610
|
+
*/
|
|
8611
|
+
aspect: number | null
|
|
8612
|
+
|
|
8613
|
+
/**
|
|
8614
|
+
* The angle of the pen at the stop, in degrees, in the path's coordinates.
|
|
8615
|
+
* Angles aren't wrapped: from `0` at one stop to `720` at the next, the
|
|
8616
|
+
* pen turns twice. Stops without an angle leave it to the stops around
|
|
8617
|
+
* them, and without any, it is `0`.
|
|
8618
|
+
*/
|
|
8619
|
+
angle: number | null
|
|
8620
|
+
|
|
8621
|
+
/**
|
|
8622
|
+
* Whether the values ease into and out of the stop: they arrive at it and
|
|
8623
|
+
* leave it flat, and between two smooth stops, a value follows a cubic
|
|
8624
|
+
* from one to the other, without overshooting them. As the slopes don't
|
|
8625
|
+
* depend on other stops, changing a stop only changes the values up to the
|
|
8626
|
+
* stops on either side of it. Without smoothing, the values change in
|
|
8627
|
+
* straight lines to the stops on either side.
|
|
8628
|
+
*/
|
|
8629
|
+
smooth: boolean
|
|
8630
|
+
|
|
8631
|
+
|
|
8632
|
+
/**
|
|
8633
|
+
* Creates a stroke profile stop.
|
|
8634
|
+
*
|
|
8635
|
+
* @param object - the properties of the stop, its `offset`,
|
|
8636
|
+
* `width`, `aspect`, `angle` and `smooth`
|
|
8637
|
+
*/
|
|
8638
|
+
constructor(object?: object)
|
|
8639
|
+
|
|
8640
|
+
/**
|
|
8641
|
+
* @return a copy of the stop, without a path
|
|
8642
|
+
*/
|
|
8643
|
+
clone(): StrokeProfileStop
|
|
8644
|
+
|
|
8645
|
+
/**
|
|
8646
|
+
* Checks whether the stop is equal to the supplied one.
|
|
8647
|
+
*
|
|
8648
|
+
* @return true if they are equal
|
|
8649
|
+
*/
|
|
8650
|
+
equals(stop: StrokeProfileStop): boolean
|
|
8651
|
+
|
|
8652
|
+
}
|
|
8653
|
+
|
|
7809
8654
|
/**
|
|
7810
8655
|
* Style is used for changing the visual styles of items
|
|
7811
8656
|
* contained within a Paper.js project and is returned by
|
|
@@ -8148,6 +8993,11 @@ declare namespace paper {
|
|
|
8148
8993
|
*/
|
|
8149
8994
|
readonly project: Project
|
|
8150
8995
|
|
|
8996
|
+
/**
|
|
8997
|
+
* The name of the symbol.
|
|
8998
|
+
*/
|
|
8999
|
+
name: string
|
|
9000
|
+
|
|
8151
9001
|
/**
|
|
8152
9002
|
* The item used as the symbol's definition.
|
|
8153
9003
|
*/
|
|
@@ -8175,7 +9025,7 @@ declare namespace paper {
|
|
|
8175
9025
|
place(position?: PointLike): SymbolItem
|
|
8176
9026
|
|
|
8177
9027
|
/**
|
|
8178
|
-
* Returns a copy of the symbol.
|
|
9028
|
+
* Returns a copy of the symbol, with a copy of its item and its name.
|
|
8179
9029
|
*/
|
|
8180
9030
|
clone(): SymbolDefinition
|
|
8181
9031
|
|
|
@@ -8771,7 +9621,8 @@ declare namespace paper {
|
|
|
8771
9621
|
|
|
8772
9622
|
/**
|
|
8773
9623
|
* The function to be called when another tool is activated through
|
|
8774
|
-
* {@link #activate}
|
|
9624
|
+
* {@link #activate} while this one is active, or when this one is
|
|
9625
|
+
* removed while active.
|
|
8775
9626
|
*/
|
|
8776
9627
|
onDeactivate: Function | null
|
|
8777
9628
|
|
|
@@ -9273,7 +10124,7 @@ declare namespace paper {
|
|
|
9273
10124
|
*
|
|
9274
10125
|
* @param force - whether to redraw the view even if nothing
|
|
9275
10126
|
* has changed, e.g. after a web font used by text items has finished
|
|
9276
|
-
* loading
|
|
10127
|
+
* loading, also in buffered groups, see {@link Group#buffered}
|
|
9277
10128
|
*
|
|
9278
10129
|
* @return true if the view was updated
|
|
9279
10130
|
*/
|