paper 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +16 -13
  3. package/dist/docs/assets/js/paper.js +434 -128
  4. package/dist/docs/classes/ChangeFlag.html +384 -0
  5. package/dist/docs/classes/Color.html +1 -1
  6. package/dist/docs/classes/CompoundPath.html +58 -4
  7. package/dist/docs/classes/Curve.html +1 -1
  8. package/dist/docs/classes/CurveLocation.html +1 -1
  9. package/dist/docs/classes/Event.html +1 -1
  10. package/dist/docs/classes/Gradient.html +1 -1
  11. package/dist/docs/classes/GradientStop.html +1 -1
  12. package/dist/docs/classes/Group.html +89 -4
  13. package/dist/docs/classes/HitResult.html +3 -2
  14. package/dist/docs/classes/HostItem.html +6721 -0
  15. package/dist/docs/classes/Item.html +58 -4
  16. package/dist/docs/classes/Key.html +1 -1
  17. package/dist/docs/classes/KeyEvent.html +1 -1
  18. package/dist/docs/classes/Layer.html +89 -4
  19. package/dist/docs/classes/Matrix.html +1 -1
  20. package/dist/docs/classes/MouseEvent.html +1 -1
  21. package/dist/docs/classes/PaperScope.html +2 -1
  22. package/dist/docs/classes/PaperScript.html +2 -1
  23. package/dist/docs/classes/Path.html +59 -5
  24. package/dist/docs/classes/PathItem.html +58 -4
  25. package/dist/docs/classes/Point.html +1 -1
  26. package/dist/docs/classes/PointText.html +58 -4
  27. package/dist/docs/classes/Project.html +188 -1
  28. package/dist/docs/classes/Raster.html +58 -4
  29. package/dist/docs/classes/Rectangle.html +1 -1
  30. package/dist/docs/classes/Segment.html +1 -1
  31. package/dist/docs/classes/Shape.html +58 -4
  32. package/dist/docs/classes/Size.html +1 -1
  33. package/dist/docs/classes/Style.html +2 -2
  34. package/dist/docs/classes/SymbolDefinition.html +1 -1
  35. package/dist/docs/classes/SymbolItem.html +58 -4
  36. package/dist/docs/classes/TextItem.html +58 -4
  37. package/dist/docs/classes/Tool.html +126 -1
  38. package/dist/docs/classes/ToolEvent.html +1 -1
  39. package/dist/docs/classes/Tween.html +1 -1
  40. package/dist/docs/classes/View.html +144 -2
  41. package/dist/docs/classes/global.html +1 -1
  42. package/dist/docs/classes/index.html +2 -2
  43. package/dist/docs/index.html +1 -1
  44. package/dist/paper-core.js +425 -123
  45. package/dist/paper-core.min.js +3 -3
  46. package/dist/paper-full.js +434 -128
  47. package/dist/paper-full.min.js +3 -3
  48. package/dist/paper-sourced.js +18631 -0
  49. package/dist/paper.d.ts +284 -7
  50. package/package.json +6 -10
@@ -307,6 +307,32 @@ function onMouseMove(event) {
307
307
  <div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
308
308
 
309
309
 
310
+ <div id="key" class="member">
311
+ <div class="member-link">
312
+ <a name="key" href="#key"><tt><b>key</b></tt></a>
313
+ </div>
314
+ <div class="member-description hidden">
315
+
316
+ <div class="member-text">
317
+ <p>The key of the host&rsquo;s node that the item represents, in a project backed by a host document, see <a href="../classes/Project.html#source"><tt>project.source</tt></a>. It can only be set once, on an item created by a script, to register the key that the host gave its new node.</p>
318
+
319
+
320
+
321
+ <ul class="member-list">
322
+ <h4>Type:</h4>
323
+ <li>
324
+ <tt>Number</tt>
325
+ </li>
326
+ </ul>
327
+
328
+
329
+
330
+ </div>
331
+
332
+ </div>
333
+ </div>
334
+
335
+
310
336
  <div id="id" class="member">
311
337
  <div class="member-link">
312
338
  <a name="id" href="#id"><tt><b>id</b></tt></a>
@@ -1390,6 +1416,34 @@ circle.position.x += 100;
1390
1416
 
1391
1417
 
1392
1418
 
1419
+ </div>
1420
+
1421
+ </div>
1422
+ </div>
1423
+
1424
+
1425
+ <div id="scope" class="member">
1426
+ <div class="member-link">
1427
+ <a name="scope" href="#scope"><tt><b>scope</b></tt></a>
1428
+ </div>
1429
+ <div class="member-description hidden">
1430
+
1431
+ <div class="member-text">
1432
+ <p>The scope that this item belongs to, through its project.</p>
1433
+
1434
+ <p>Read only.</p>
1435
+
1436
+
1437
+
1438
+ <ul class="member-list">
1439
+ <h4>Type:</h4>
1440
+ <li>
1441
+ <a href="../classes/PaperScope.html"><tt>PaperScope</tt></a>
1442
+ </li>
1443
+ </ul>
1444
+
1445
+
1446
+
1393
1447
  </div>
1394
1448
 
1395
1449
  </div>
@@ -2005,7 +2059,7 @@ path3.strokeJoin = 'bevel';
2005
2059
  <div class="member-description hidden">
2006
2060
 
2007
2061
  <div class="member-text">
2008
- <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>
2062
+ <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>
2009
2063
 
2010
2064
 
2011
2065
 
@@ -4655,7 +4709,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4655
4709
  </div>
4656
4710
  <div class="member-description hidden">
4657
4711
  <div class="member-text">
4658
- <p>Checks whether the item has a fill.</p>
4712
+ <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>
4659
4713
 
4660
4714
 
4661
4715
 
@@ -4663,7 +4717,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4663
4717
  <h4>Returns:</h4>
4664
4718
 
4665
4719
  <li>
4666
- <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item has a fill, <tt>false</tt> otherwise
4720
+ <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item has a visible fill, <tt>false</tt> otherwise
4667
4721
  </li>
4668
4722
 
4669
4723
 
@@ -6929,7 +6983,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
6929
6983
 
6930
6984
  <!-- =========================== copyright notice ========================== -->
6931
6985
  <p class="footer">
6932
- Paper.js v0.13.0<br>
6986
+ Paper.js v0.14.0<br>
6933
6987
  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>
6934
6988
  <div class="content-end"></div>
6935
6989
 
@@ -59,6 +59,34 @@ tool.onMouseDrag = function(event) {
59
59
  <h2>Properties</h2>
60
60
 
61
61
 
62
+ <div id="scope" class="member">
63
+ <div class="member-link">
64
+ <a name="scope" href="#scope"><tt><b>scope</b></tt></a>
65
+ </div>
66
+ <div class="member-description hidden">
67
+
68
+ <div class="member-text">
69
+ <p>The scope that this tool belongs to.</p>
70
+
71
+ <p>Read only.</p>
72
+
73
+
74
+
75
+ <ul class="member-list">
76
+ <h4>Type:</h4>
77
+ <li>
78
+ <a href="../classes/PaperScope.html"><tt>PaperScope</tt></a>
79
+ </li>
80
+ </ul>
81
+
82
+
83
+
84
+ </div>
85
+
86
+ </div>
87
+ </div>
88
+
89
+
62
90
  <div id="mindistance" class="member">
63
91
  <div class="member-link">
64
92
  <a name="mindistance" href="#mindistance"><tt><b>minDistance</b></tt></a>
@@ -111,6 +139,41 @@ tool.onMouseDrag = function(event) {
111
139
  </div>
112
140
 
113
141
 
142
+ <div id="eventinterval" class="member">
143
+ <div class="member-link">
144
+ <a name="eventinterval" href="#eventinterval"><tt><b>eventInterval</b></tt></a>
145
+ </div>
146
+ <div class="member-description hidden">
147
+
148
+ <div class="member-text">
149
+ <p>The interval in milliseconds at which the onMouseDrag event fires again while the mouse button is held, also when the mouse doesn&rsquo;t move. The repeated events are at the last point, with a zero <a href="../classes/ToolEvent.html#delta"><tt>toolEvent.delta</tt></a>. <code>null</code>, the default, or anything up to 0 turns it off.</p>
150
+
151
+
152
+
153
+ <ul class="member-list">
154
+ <h4>Default:</h4>
155
+ <li><tt>null</tt></li>
156
+ </ul>
157
+
158
+ <ul class="member-list">
159
+ <h4>Type:</h4>
160
+ <li>
161
+ <tt>Number</tt>
162
+ </li>
163
+ </ul>
164
+
165
+
166
+ <h4>Example:<span class="description">Fire the onMouseDrag event 10 times a second, while the mouse button is held:</span></h4>
167
+
168
+
169
+ <pre><code>tool.eventInterval = 100;</code></pre>
170
+
171
+ </div>
172
+
173
+ </div>
174
+ </div>
175
+
176
+
114
177
  <div id="fixeddistance" class="member">
115
178
  <div class="member-link">
116
179
  <a name="fixeddistance" href="#fixeddistance"><tt><b>fixedDistance</b></tt></a>
@@ -422,6 +485,68 @@ tool.onKeyDown = function(event) {
422
485
  }
423
486
  }</code></pre>
424
487
 
488
+ </div>
489
+
490
+ </div>
491
+ </div>
492
+
493
+
494
+ <h3>Activation Event Handlers</h3>
495
+
496
+ <div id="onactivate" class="member">
497
+ <div class="member-link">
498
+ <a name="onactivate" href="#onactivate"><tt><b>onActivate</b></tt></a>
499
+ </div>
500
+ <div class="member-description hidden">
501
+
502
+ <div class="member-text">
503
+ <p>The function to be called when the tool is activated through <a href="../classes/Tool.html#activate"><tt>activate</tt></a>(). The function receives the previously active tool, which is the tool itself when it was already active.</p>
504
+
505
+
506
+
507
+ <ul class="member-list">
508
+ <h4>Type:</h4>
509
+ <li>
510
+ <tt>Function</tt>⟋<tt>null</tt>
511
+ </li>
512
+ </ul>
513
+
514
+
515
+ <h4>Example:</h4>
516
+
517
+
518
+ <pre><code>tool.onActivate = function(previous) {
519
+ if (previous == tool) {
520
+ console.log('The tool was activated again!');
521
+ }
522
+ }</code></pre>
523
+
524
+ </div>
525
+
526
+ </div>
527
+ </div>
528
+
529
+
530
+ <div id="ondeactivate" class="member">
531
+ <div class="member-link">
532
+ <a name="ondeactivate" href="#ondeactivate"><tt><b>onDeactivate</b></tt></a>
533
+ </div>
534
+ <div class="member-description hidden">
535
+
536
+ <div class="member-text">
537
+ <p>The function to be called when another tool is activated through <a href="../classes/Tool.html#activate"><tt>activate</tt></a>(), while this one is active.</p>
538
+
539
+
540
+
541
+ <ul class="member-list">
542
+ <h4>Type:</h4>
543
+ <li>
544
+ <tt>Function</tt>⟋<tt>null</tt>
545
+ </li>
546
+ </ul>
547
+
548
+
549
+
425
550
  </div>
426
551
 
427
552
  </div>
@@ -753,7 +878,7 @@ tool.onKeyDown = function(event) {
753
878
 
754
879
  <!-- =========================== copyright notice ========================== -->
755
880
  <p class="footer">
756
- Paper.js v0.13.0<br>
881
+ Paper.js v0.14.0<br>
757
882
  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>
758
883
  <div class="content-end"></div>
759
884
 
@@ -463,7 +463,7 @@ function onMouseUp(event) {
463
463
 
464
464
  <!-- =========================== copyright notice ========================== -->
465
465
  <p class="footer">
466
- Paper.js v0.13.0<br>
466
+ Paper.js v0.14.0<br>
467
467
  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>
468
468
  <div class="content-end"></div>
469
469
 
@@ -365,7 +365,7 @@ setTimeout(function(){
365
365
 
366
366
  <!-- =========================== copyright notice ========================== -->
367
367
  <p class="footer">
368
- Paper.js v0.13.0<br>
368
+ Paper.js v0.14.0<br>
369
369
  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>
370
370
  <div class="content-end"></div>
371
371
 
@@ -17,7 +17,7 @@
17
17
 
18
18
  <p>The View object wraps an HTML element and handles drawing and user interaction through mouse and keyboard for it. It offer means to scroll the view, find the currently visible bounds in project coordinates, or the center, both useful for constructing artwork that should appear centered on screen.</p>
19
19
  <p>If the canvas element has a <code>resize</code> or <code>data-paper-resize</code> attribute, the view adjusts its size to the size of the element whenever the window is resized. The element itself needs to be sized through CSS, e.g. with <code>html, body { height: 100%; }</code> and <code>canvas[resize] { width: 100%; height:
20
- 100%; }</code> for a canvas that fills the window. Without such CSS, the view does not follow the window, and on HiDPI screens it grows with each resize.</p>
20
+ 100%; }</code> for a canvas that fills the window. Without such CSS, the view does not follow the window, and on HiDPI screens it grows with each resize. Without the attribute, the view sets the element&rsquo;s CSS width and height to its own size, see <a href="../classes/View.html#viewsize"><tt>viewSize</tt></a>.</p>
21
21
 
22
22
  </div>
23
23
 
@@ -106,6 +106,34 @@
106
106
 
107
107
 
108
108
 
109
+ </div>
110
+
111
+ </div>
112
+ </div>
113
+
114
+
115
+ <div id="scope" class="member">
116
+ <div class="member-link">
117
+ <a name="scope" href="#scope"><tt><b>scope</b></tt></a>
118
+ </div>
119
+ <div class="member-description hidden">
120
+
121
+ <div class="member-text">
122
+ <p>The scope that this view belongs to.</p>
123
+
124
+ <p>Read only.</p>
125
+
126
+
127
+
128
+ <ul class="member-list">
129
+ <h4>Type:</h4>
130
+ <li>
131
+ <a href="../classes/PaperScope.html"><tt>PaperScope</tt></a>
132
+ </li>
133
+ </ul>
134
+
135
+
136
+
109
137
  </div>
110
138
 
111
139
  </div>
@@ -1943,6 +1971,120 @@ function onMouseDown(event) {
1943
1971
 
1944
1972
 
1945
1973
 
1974
+ </div>
1975
+ </div>
1976
+ </div>
1977
+
1978
+
1979
+ <div id="dispatchmouseevent-type-point" class="member">
1980
+ <div class="member-link">
1981
+ <a name="dispatchmouseevent-type-point" href="#dispatchmouseevent-type-point"><tt><b>dispatchMouseEvent</b>(type, point[, options])</tt></a>
1982
+ </div>
1983
+ <div class="member-description hidden">
1984
+ <div class="member-text">
1985
+ <p>Handles a mouse event that the host provides, for hosts without a DOM, such as workers, or with their own event source. It runs the same handling as the DOM&rsquo;s mouse events: the active tool&rsquo;s handlers, with <a href="../classes/Tool.html#mindistance"><tt>tool.minDistance</tt></a> and the like, then those of the items under the point and of the view, including the events that Paper.js derives itself: <code>&#39;mousedrag&#39;</code>, <code>&#39;click&#39;</code>, <code>&#39;doubleclick&#39;</code>, <code>&#39;mouseenter&#39;</code> and <code>&#39;mouseleave&#39;</code>.</p>
1986
+ <ul class="member-list">
1987
+ <h4>Options:</h4>
1988
+ <li>[options.modifiers] {Object} the state of the modifier keys,
1989
+ see {@link Key#modifiers}</li>
1990
+ <li><tt>options.button: <tt>Number</tt></tt> &mdash; the mouse button &mdash;&nbsp;default: <tt>0</tt></li>
1991
+ <li><tt>options.timeStamp: <tt>Number</tt></tt> &mdash; the time stamp &mdash;&nbsp;default: <tt>Date.now()</tt></li>
1992
+ </ul>
1993
+
1994
+ <ul class="member-list">
1995
+ <h4>Parameters:</h4>
1996
+
1997
+ <li>
1998
+ <tt>type:</tt>
1999
+ <tt>String</tt>
2000
+ &mdash;&nbsp;the type of the event: <tt>&lsquo;mousedown&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>
2001
+
2002
+ </li>
2003
+
2004
+ <li>
2005
+ <tt>point:</tt>
2006
+ <a href="../classes/Point.html"><tt>Point</tt></a>
2007
+ &mdash;&nbsp;the location of the mouse in project coordinates
2008
+
2009
+ </li>
2010
+
2011
+ <li>
2012
+ <tt>options:</tt>
2013
+ <tt>Object</tt>
2014
+ &mdash;&nbsp;the details of the event
2015
+ &mdash;&nbsp;optional
2016
+ </li>
2017
+
2018
+ </ul>
2019
+
2020
+
2021
+ <ul class="member-list">
2022
+ <h4>Returns:</h4>
2023
+
2024
+ <li>
2025
+ <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if a handler prevented the event&rsquo;s default, <tt>false</tt> otherwise
2026
+ </li>
2027
+
2028
+
2029
+ </ul>
2030
+
2031
+
2032
+
2033
+
2034
+
2035
+ </div>
2036
+ </div>
2037
+ </div>
2038
+
2039
+
2040
+ <div id="dispatchkeyevent-type-key" class="member">
2041
+ <div class="member-link">
2042
+ <a name="dispatchkeyevent-type-key" href="#dispatchkeyevent-type-key"><tt><b>dispatchKeyEvent</b>(type, key[, options])</tt></a>
2043
+ </div>
2044
+ <div class="member-description hidden">
2045
+ <div class="member-text">
2046
+ <p>Handles a key event that the host provides, for hosts without a DOM, such as workers, or with their own event source. It updates <tt>Key#modifiers</tt> and <tt>Key#isDown(key)</tt>, and calls the view&rsquo;s and the active tool&rsquo;s handlers, as the DOM&rsquo;s key events do.</p>
2047
+ <ul class="member-list">
2048
+ <h4>Options:</h4>
2049
+ <li>[options.character] {String} the character that the key
2050
+ produces. By default, keydown takes the key itself if it is a
2051
+ single character, and keyup the character of its keydown</li>
2052
+ <li>[options.modifiers] {Object} the state of the modifier keys,
2053
+ see {@link Key#modifiers}</li>
2054
+ <li><tt>options.timeStamp: <tt>Number</tt></tt> &mdash; the time stamp &mdash;&nbsp;default: <tt>Date.now()</tt></li>
2055
+ </ul>
2056
+
2057
+ <ul class="member-list">
2058
+ <h4>Parameters:</h4>
2059
+
2060
+ <li>
2061
+ <tt>type:</tt>
2062
+ <tt>String</tt>
2063
+ &mdash;&nbsp;the type of the event: <tt>&lsquo;keydown&rsquo;</tt>, <tt>&lsquo;keyup&rsquo;</tt>
2064
+
2065
+ </li>
2066
+
2067
+ <li>
2068
+ <tt>key:</tt>
2069
+ <tt>String</tt>
2070
+ &mdash;&nbsp;the key, as in <a href="../classes/KeyEvent.html#key"><tt>keyEvent.key</tt></a>
2071
+
2072
+ </li>
2073
+
2074
+ <li>
2075
+ <tt>options:</tt>
2076
+ <tt>Object</tt>
2077
+ &mdash;&nbsp;the details of the event
2078
+ &mdash;&nbsp;optional
2079
+ </li>
2080
+
2081
+ </ul>
2082
+
2083
+
2084
+
2085
+
2086
+
2087
+
1946
2088
  </div>
1947
2089
  </div>
1948
2090
  </div>
@@ -1956,7 +2098,7 @@ function onMouseDown(event) {
1956
2098
 
1957
2099
  <!-- =========================== copyright notice ========================== -->
1958
2100
  <p class="footer">
1959
- Paper.js v0.13.0<br>
2101
+ Paper.js v0.14.0<br>
1960
2102
  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>
1961
2103
  <div class="content-end"></div>
1962
2104
 
@@ -416,7 +416,7 @@
416
416
 
417
417
  <!-- =========================== copyright notice ========================== -->
418
418
  <p class="footer">
419
- Paper.js v0.13.0<br>
419
+ Paper.js v0.14.0<br>
420
420
  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>
421
421
  <div class="content-end"></div>
422
422
 
@@ -2,13 +2,13 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
- <title>Paper.js v0.13.0</title>
5
+ <title>Paper.js v0.14.0</title>
6
6
  <base target="class-frame">
7
7
  <link href="../assets/css/docs.css" rel="stylesheet" type="text/css">
8
8
  </head>
9
9
  <body class="reference">
10
10
  <div class="reference-index">
11
- <h1>Paper.js<span class="version">0.13.0</span></h1>
11
+ <h1>Paper.js<span class="version">0.14.0</span></h1>
12
12
  <ul class="reference-classes"><li><a href="../classes/global.html">Global Scope</a></li>
13
13
  <li>
14
14
  <h2>Basic Types</h2>
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
- <title>Paper.js v0.13.0</title>
5
+ <title>Paper.js v0.14.0</title>
6
6
  </head>
7
7
  <frameset cols="230,*">
8
8
  <frame src="classes/index.html" name="packageListFrame" title="All Packages">