paper 0.13.0 → 0.15.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 (57) hide show
  1. package/CHANGELOG.md +337 -0
  2. package/README.md +19 -14
  3. package/dist/docs/assets/js/paper.js +7351 -1706
  4. package/dist/docs/classes/AreaText.html +8658 -0
  5. package/dist/docs/classes/ChangeFlag.html +385 -0
  6. package/dist/docs/classes/Color.html +2 -1
  7. package/dist/docs/classes/CompoundPath.html +208 -69
  8. package/dist/docs/classes/Curve.html +2 -1
  9. package/dist/docs/classes/CurveLocation.html +2 -1
  10. package/dist/docs/classes/Event.html +5 -4
  11. package/dist/docs/classes/Gradient.html +2 -1
  12. package/dist/docs/classes/GradientStop.html +2 -1
  13. package/dist/docs/classes/Group.html +204 -17
  14. package/dist/docs/classes/HitResult.html +4 -2
  15. package/dist/docs/classes/HostItem.html +6786 -0
  16. package/dist/docs/classes/Item.html +193 -17
  17. package/dist/docs/classes/Key.html +2 -1
  18. package/dist/docs/classes/KeyEvent.html +5 -4
  19. package/dist/docs/classes/Layer.html +201 -17
  20. package/dist/docs/classes/Matrix.html +2 -1
  21. package/dist/docs/classes/MouseEvent.html +5 -4
  22. package/dist/docs/classes/PaperScope.html +5 -2
  23. package/dist/docs/classes/PaperScript.html +6 -2
  24. package/dist/docs/classes/Path.html +183 -70
  25. package/dist/docs/classes/PathItem.html +326 -187
  26. package/dist/docs/classes/PathText.html +8528 -0
  27. package/dist/docs/classes/Point.html +13 -2
  28. package/dist/docs/classes/PointText.html +1404 -63
  29. package/dist/docs/classes/Project.html +221 -1
  30. package/dist/docs/classes/Raster.html +136 -17
  31. package/dist/docs/classes/Rectangle.html +3 -2
  32. package/dist/docs/classes/Segment.html +2 -1
  33. package/dist/docs/classes/Shape.html +136 -17
  34. package/dist/docs/classes/Size.html +4 -2
  35. package/dist/docs/classes/Style.html +768 -15
  36. package/dist/docs/classes/SymbolDefinition.html +2 -1
  37. package/dist/docs/classes/SymbolItem.html +136 -17
  38. package/dist/docs/classes/TextItem.html +1566 -222
  39. package/dist/docs/classes/TextRange.html +186 -0
  40. package/dist/docs/classes/TextStory.html +355 -0
  41. package/dist/docs/classes/Tool.html +127 -1
  42. package/dist/docs/classes/ToolEvent.html +57 -4
  43. package/dist/docs/classes/Tween.html +17 -1
  44. package/dist/docs/classes/View.html +148 -5
  45. package/dist/docs/classes/global.html +2 -1
  46. package/dist/docs/classes/index.html +2 -2
  47. package/dist/docs/index.html +1 -1
  48. package/dist/paper-core.js +7160 -1663
  49. package/dist/paper-core.min.js +3 -3
  50. package/dist/paper-full.js +7351 -1706
  51. package/dist/paper-full.min.js +3 -3
  52. package/dist/paper-hosted.js +24058 -0
  53. package/dist/paper.d.ts +1996 -155
  54. package/examples/Scripts/AreaText.html +65 -0
  55. package/examples/Scripts/PathText.html +48 -0
  56. package/examples/Scripts/TextRanges.html +51 -0
  57. package/package.json +8 -11
@@ -19,6 +19,7 @@
19
19
 
20
20
  <p>ToolEvent The ToolEvent object is received by the <a href="../classes/Tool.html"><tt>Tool</tt></a>&rsquo;s mouse event handlers <a href="../classes/Tool.html#onmousedown"><tt>tool.onMouseDown</tt></a>, <a href="../classes/Tool.html#onmousedrag"><tt>tool.onMouseDrag</tt></a>, <a href="../classes/Tool.html#onmousemove"><tt>tool.onMouseMove</tt></a> and <a href="../classes/Tool.html#onmouseup"><tt>tool.onMouseUp</tt></a>. The ToolEvent object is the only parameter passed to these functions and contains information about the mouse event.</p>
21
21
 
22
+
22
23
  </div>
23
24
 
24
25
 
@@ -223,6 +224,58 @@ function onMouseUp(event) {
223
224
 
224
225
 
225
226
 
227
+ </div>
228
+
229
+ </div>
230
+ </div>
231
+
232
+
233
+ <div id="velocity" class="member">
234
+ <div class="member-link">
235
+ <a name="velocity" href="#velocity"><tt><b>velocity</b></tt></a>
236
+ </div>
237
+ <div class="member-description hidden">
238
+
239
+ <div class="member-text">
240
+ <p>The velocity of the mouse, in points per second: the distance it moved since the last tool event, divided by the time between them, so it points in the direction of the move, and its length is the speed. It stays even when the system misses a mouse report. The events that <a href="../classes/Tool.html#maxdistance"><tt>tool.maxDistance</tt></a> adds along one move share its velocity, and the repeats of <a href="../classes/Tool.html#eventinterval"><tt>tool.eventInterval</tt></a> have none. On mousedown, and when no time passed, it&rsquo;s zero.</p>
241
+
242
+
243
+
244
+ <ul class="member-list">
245
+ <h4>Type:</h4>
246
+ <li>
247
+ <a href="../classes/Point.html"><tt>Point</tt></a>
248
+ </li>
249
+ </ul>
250
+
251
+
252
+
253
+ </div>
254
+
255
+ </div>
256
+ </div>
257
+
258
+
259
+ <div id="elapsed" class="member">
260
+ <div class="member-link">
261
+ <a name="elapsed" href="#elapsed"><tt><b>elapsed</b></tt></a>
262
+ </div>
263
+ <div class="member-description hidden">
264
+
265
+ <div class="member-text">
266
+ <p>The time since the last tool event, in seconds, measured between the reports of the mouse as <a href="../classes/ToolEvent.html#velocity"><tt>velocity</tt></a> is: the events that <a href="../classes/Tool.html#maxdistance"><tt>tool.maxDistance</tt></a> adds along one move share it, and the repeats of <a href="../classes/Tool.html#eventinterval"><tt>tool.eventInterval</tt></a> have the interval. It&rsquo;s zero on the first event.</p>
267
+
268
+
269
+
270
+ <ul class="member-list">
271
+ <h4>Type:</h4>
272
+ <li>
273
+ <tt>Number</tt>
274
+ </li>
275
+ </ul>
276
+
277
+
278
+
226
279
  </div>
227
280
 
228
281
  </div>
@@ -331,14 +384,14 @@ function onMouseUp(event) {
331
384
  <div class="reference-members"><h2>Properties inherited from <a href="../classes/Event.html"><tt>Event</tt></a></h2>
332
385
 
333
386
 
334
- <div id="timestamp" class="member">
387
+ <div id="time" class="member">
335
388
  <div class="member-link">
336
- <a name="timestamp" href="#timestamp"><tt><b>timeStamp</b></tt></a>
389
+ <a name="time" href="#time"><tt><b>time</b></tt></a>
337
390
  </div>
338
391
  <div class="member-description hidden">
339
392
 
340
393
  <div class="member-text">
341
- <p>The time at which the event was created, in milliseconds since the epoch.</p>
394
+ <p>The time at which the event was created, in seconds, as the times of frame events are. Browsers count from the page&rsquo;s time origin, as <code>performance.now()</code> does, while <a href="../classes/View.html#dispatchmouseevent-type-point"><tt>view.dispatchMouseEvent(type, point[, options])</tt></a> and <a href="../classes/View.html#dispatchkeyevent-type-key"><tt>view.dispatchKeyEvent(type, key[, options])</tt></a> use <code>Date.now()</code> unless the host passes a time, so only compare the times of events from the same source.</p>
342
395
 
343
396
  <p>Read only.</p>
344
397
 
@@ -463,7 +516,7 @@ function onMouseUp(event) {
463
516
 
464
517
  <!-- =========================== copyright notice ========================== -->
465
518
  <p class="footer">
466
- Paper.js v0.13.0<br>
519
+ Paper.js v0.15.0<br>
467
520
  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
521
  <div class="content-end"></div>
469
522
 
@@ -17,6 +17,22 @@
17
17
 
18
18
  <p>Allows tweening <code>Object</code> properties between two states for a given duration. To tween properties on Paper.js <a href="../classes/Item.html"><tt>Item</tt></a> instances, <a href="../classes/Item.html#tween-from-to-options"><tt>item.tween(from, to, options)</tt></a> can be used, which returns created tween instance.</p>
19
19
 
20
+
21
+ <ul class="member-list">
22
+ <h4>See also:</h4>
23
+
24
+ <li><tt><a href="../classes/Item.html#tween-from-to-options"><tt>item.tween(from, to, options)</tt></a></tt></li>
25
+
26
+ <li><tt><a href="../classes/Item.html#tween-to-options"><tt>item.tween(to, options)</tt></a></tt></li>
27
+
28
+ <li><tt><a href="../classes/Item.html#tween-options"><tt>item.tween(options)</tt></a></tt></li>
29
+
30
+ <li><tt><a href="../classes/Item.html#tweento-to-options"><tt>item.tweenTo(to, options)</tt></a></tt></li>
31
+
32
+ <li><tt><a href="../classes/Item.html#tweenfrom-from-options"><tt>item.tweenFrom(from, options)</tt></a></tt></li>
33
+
34
+ </ul>
35
+
20
36
  </div>
21
37
 
22
38
  <!-- =============================== constructors ========================== -->
@@ -365,7 +381,7 @@ setTimeout(function(){
365
381
 
366
382
  <!-- =========================== copyright notice ========================== -->
367
383
  <p class="footer">
368
- Paper.js v0.13.0<br>
384
+ Paper.js v0.15.0<br>
369
385
  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
386
  <div class="content-end"></div>
371
387
 
@@ -17,7 +17,8 @@
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
23
  </div>
23
24
 
@@ -106,6 +107,34 @@
106
107
 
107
108
 
108
109
 
110
+ </div>
111
+
112
+ </div>
113
+ </div>
114
+
115
+
116
+ <div id="scope" class="member">
117
+ <div class="member-link">
118
+ <a name="scope" href="#scope"><tt><b>scope</b></tt></a>
119
+ </div>
120
+ <div class="member-description hidden">
121
+
122
+ <div class="member-text">
123
+ <p>The scope that this view belongs to.</p>
124
+
125
+ <p>Read only.</p>
126
+
127
+
128
+
129
+ <ul class="member-list">
130
+ <h4>Type:</h4>
131
+ <li>
132
+ <a href="../classes/PaperScope.html"><tt>PaperScope</tt></a>
133
+ </li>
134
+ </ul>
135
+
136
+
137
+
109
138
  </div>
110
139
 
111
140
  </div>
@@ -201,9 +230,7 @@
201
230
  <div class="member-description hidden">
202
231
 
203
232
  <div class="member-text">
204
- <p>The bounds of the currently visible area in project coordinates.</p>
205
-
206
- <p>Read only.</p>
233
+ <p>The bounds of the currently visible area in project coordinates. Setting them fits the view to the given rectangle, as <a href="../classes/View.html#fitbounds-rectangle"><tt>fitBounds(rectangle)</tt></a> does. Since the view keeps its aspect ratio, the bounds read back can be larger than the rectangle in one direction.</p>
207
234
 
208
235
 
209
236
 
@@ -1943,6 +1970,122 @@ function onMouseDown(event) {
1943
1970
 
1944
1971
 
1945
1972
 
1973
+ </div>
1974
+ </div>
1975
+ </div>
1976
+
1977
+
1978
+ <div id="dispatchmouseevent-type-point" class="member">
1979
+ <div class="member-link">
1980
+ <a name="dispatchmouseevent-type-point" href="#dispatchmouseevent-type-point"><tt><b>dispatchMouseEvent</b>(type, point[, options])</tt></a>
1981
+ </div>
1982
+ <div class="member-description hidden">
1983
+ <div class="member-text">
1984
+ <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>. Points outside the view&rsquo;s bounds are handled too, since the host decides which events belong to its drawing surface.</p>
1985
+ <ul class="member-list">
1986
+ <h4>Options:</h4>
1987
+ <li>[options.modifiers] {Object} the state of the modifier keys,
1988
+ see {@link Key#modifiers}</li>
1989
+ <li><tt>options.button: <tt>Number</tt></tt> &mdash; the mouse button &mdash;&nbsp;default: <tt>0</tt></li>
1990
+ <li><tt>options.time: <tt>Number</tt></tt> &mdash; the time of the event in seconds, see <a href="../classes/Event.html#time"><tt>event.time</tt></a> &mdash;&nbsp;default: <tt>Date.now() / 1000</tt></li>
1991
+ </ul>
1992
+
1993
+ <ul class="member-list">
1994
+ <h4>Parameters:</h4>
1995
+
1996
+ <li>
1997
+ <tt>type:</tt>
1998
+ <tt>String</tt>
1999
+ &mdash;&nbsp;the type of the event: <tt>&lsquo;mousedown&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>
2000
+
2001
+ </li>
2002
+
2003
+ <li>
2004
+ <tt>point:</tt>
2005
+ <a href="../classes/Point.html"><tt>Point</tt></a>
2006
+ &mdash;&nbsp;the location of the mouse in project coordinates
2007
+
2008
+ </li>
2009
+
2010
+ <li>
2011
+ <tt>options:</tt>
2012
+ <tt>Object</tt>
2013
+ &mdash;&nbsp;the details of the event
2014
+ &mdash;&nbsp;optional
2015
+ </li>
2016
+
2017
+ </ul>
2018
+
2019
+
2020
+ <ul class="member-list">
2021
+ <h4>Returns:</h4>
2022
+
2023
+ <li>
2024
+ <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if a handler prevented the event&rsquo;s default, <tt>false</tt> otherwise
2025
+ </li>
2026
+
2027
+
2028
+ </ul>
2029
+
2030
+
2031
+
2032
+
2033
+
2034
+ </div>
2035
+ </div>
2036
+ </div>
2037
+
2038
+
2039
+ <div id="dispatchkeyevent-type-key" class="member">
2040
+ <div class="member-link">
2041
+ <a name="dispatchkeyevent-type-key" href="#dispatchkeyevent-type-key"><tt><b>dispatchKeyEvent</b>(type, key[, options])</tt></a>
2042
+ </div>
2043
+ <div class="member-description hidden">
2044
+ <div class="member-text">
2045
+ <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>
2046
+ <ul class="member-list">
2047
+ <h4>Options:</h4>
2048
+ <li>[options.character] {String} the character that the key
2049
+ produces. By default, keydown takes the key itself if it is a
2050
+ single character, the space, carriage return and tab characters
2051
+ for 'space', 'enter' and 'tab', and keyup the character of its
2052
+ keydown</li>
2053
+ <li>[options.modifiers] {Object} the state of the modifier keys,
2054
+ see {@link Key#modifiers}</li>
2055
+ <li><tt>options.time: <tt>Number</tt></tt> &mdash; the time of the event in seconds, see <a href="../classes/Event.html#time"><tt>event.time</tt></a> &mdash;&nbsp;default: <tt>Date.now() / 1000</tt></li>
2056
+ </ul>
2057
+
2058
+ <ul class="member-list">
2059
+ <h4>Parameters:</h4>
2060
+
2061
+ <li>
2062
+ <tt>type:</tt>
2063
+ <tt>String</tt>
2064
+ &mdash;&nbsp;the type of the event: <tt>&lsquo;keydown&rsquo;</tt>, <tt>&lsquo;keyup&rsquo;</tt>
2065
+
2066
+ </li>
2067
+
2068
+ <li>
2069
+ <tt>key:</tt>
2070
+ <tt>String</tt>
2071
+ &mdash;&nbsp;the key, as in <a href="../classes/KeyEvent.html#key"><tt>keyEvent.key</tt></a>
2072
+
2073
+ </li>
2074
+
2075
+ <li>
2076
+ <tt>options:</tt>
2077
+ <tt>Object</tt>
2078
+ &mdash;&nbsp;the details of the event
2079
+ &mdash;&nbsp;optional
2080
+ </li>
2081
+
2082
+ </ul>
2083
+
2084
+
2085
+
2086
+
2087
+
2088
+
1946
2089
  </div>
1947
2090
  </div>
1948
2091
  </div>
@@ -1956,7 +2099,7 @@ function onMouseDown(event) {
1956
2099
 
1957
2100
  <!-- =========================== copyright notice ========================== -->
1958
2101
  <p class="footer">
1959
- Paper.js v0.13.0<br>
2102
+ Paper.js v0.15.0<br>
1960
2103
  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
2104
  <div class="content-end"></div>
1962
2105
 
@@ -18,6 +18,7 @@
18
18
  <p>When code is executed as PaperScript, the script&rsquo;s scope is populated with all fields of the currently active <a href="../classes/PaperScope.html"><tt>PaperScope</tt></a> object, which within the script appear to be global.</p>
19
19
  <p>In a JavaScript context, only the <a href="../classes/global.html#paper"><tt>paper</tt></a> variable is added to the global scope, referencing the currently active <a href="../classes/PaperScope.html"><tt>PaperScope</tt></a> object, through which all properties and Paper.js classes can be accessed.</p>
20
20
 
21
+
21
22
  </div>
22
23
 
23
24
 
@@ -416,7 +417,7 @@
416
417
 
417
418
  <!-- =========================== copyright notice ========================== -->
418
419
  <p class="footer">
419
- Paper.js v0.13.0<br>
420
+ Paper.js v0.15.0<br>
420
421
  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
422
  <div class="content-end"></div>
422
423
 
@@ -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.15.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.15.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.15.0</title>
6
6
  </head>
7
7
  <frameset cols="230,*">
8
8
  <frame src="classes/index.html" name="packageListFrame" title="All Packages">