@turbowarp/paper 0.12.202407161743

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 (139) hide show
  1. package/AUTHORS.md +18 -0
  2. package/CHANGELOG.md +701 -0
  3. package/LICENSE.txt +23 -0
  4. package/README.md +381 -0
  5. package/dist/node/canvas.js +66 -0
  6. package/dist/node/extend.js +156 -0
  7. package/dist/node/self.js +58 -0
  8. package/dist/node/xml.js +40 -0
  9. package/dist/paper-core.js +15805 -0
  10. package/dist/paper-full.js +17574 -0
  11. package/examples/Animated/AnimatedStar.html +53 -0
  12. package/examples/Animated/BooleanOperations.html +115 -0
  13. package/examples/Animated/CandyCrash.html +151 -0
  14. package/examples/Animated/Extruded.html +50 -0
  15. package/examples/Animated/Lines.html +53 -0
  16. package/examples/Animated/Smoothing.html +70 -0
  17. package/examples/Animated/Space.html +86 -0
  18. package/examples/Animated/SpaceUsingShapes.html +79 -0
  19. package/examples/Games/Paperoids.html +569 -0
  20. package/examples/JSON/Circle Testing.html +34 -0
  21. package/examples/JSON/Compound Path.html +25 -0
  22. package/examples/JSON/Empty Path Testing.html +31 -0
  23. package/examples/JSON/Gradients.html +34 -0
  24. package/examples/JSON/Group Transform.html +28 -0
  25. package/examples/JSON/Line Testing.html +44 -0
  26. package/examples/JSON/Random Path Testing.html +42 -0
  27. package/examples/JSON/Raster.html +29 -0
  28. package/examples/JSON/Rect and Attribute Testing.html +56 -0
  29. package/examples/JSON/Rotated Primitives.html +55 -0
  30. package/examples/JSON/Selection.html +43 -0
  31. package/examples/JSON/Shapes.html +54 -0
  32. package/examples/JSON/Symbols.html +30 -0
  33. package/examples/JSON/Text Testing.html +38 -0
  34. package/examples/JSON/Tiger.html +19 -0
  35. package/examples/JSON/Transform Test 1.html +32 -0
  36. package/examples/JSON/Transform Test 2.html +30 -0
  37. package/examples/Node.js/AnimatedStar.js +52 -0
  38. package/examples/Node.js/BooleanOperations.js +36 -0
  39. package/examples/Node.js/JSONtoPDF.js +20 -0
  40. package/examples/Node.js/Raster.js +32 -0
  41. package/examples/Node.js/RasterRemote.js +33 -0
  42. package/examples/Node.js/SvgExport.js +52 -0
  43. package/examples/Node.js/SvgImport.js +23 -0
  44. package/examples/Node.js/Tadpoles.js +16 -0
  45. package/examples/Node.js/Tadpoles.pjs +278 -0
  46. package/examples/Node.js/in.json +1 -0
  47. package/examples/Node.js/in.svg +16 -0
  48. package/examples/Paperjs.org/BooleanOperattions.html +115 -0
  49. package/examples/Paperjs.org/BouncingBalls.html +103 -0
  50. package/examples/Paperjs.org/Chain.html +54 -0
  51. package/examples/Paperjs.org/DivisionRaster.html +72 -0
  52. package/examples/Paperjs.org/FutureSplash.html +122 -0
  53. package/examples/Paperjs.org/HitTesting.html +103 -0
  54. package/examples/Paperjs.org/InteractiveTiger.html +777 -0
  55. package/examples/Paperjs.org/MetaBalls.html +132 -0
  56. package/examples/Paperjs.org/NyanRainbow.html +202 -0
  57. package/examples/Paperjs.org/PathIntersections.html +76 -0
  58. package/examples/Paperjs.org/Qbertify.html +146 -0
  59. package/examples/Paperjs.org/RadialRainbows.html +80 -0
  60. package/examples/Paperjs.org/RoundedRectangles.html +41 -0
  61. package/examples/Paperjs.org/SatieLikedToDraw.html +140 -0
  62. package/examples/Paperjs.org/Simplify.html +63 -0
  63. package/examples/Paperjs.org/SpiralRaster.html +120 -0
  64. package/examples/Paperjs.org/Tadpoles.html +283 -0
  65. package/examples/Paperjs.org/Voronoi.html +134 -0
  66. package/examples/Rasters/PhyllotaxisRaster.html +96 -0
  67. package/examples/Rasters/Raster.html +34 -0
  68. package/examples/Rasters/RotationRaster.html +44 -0
  69. package/examples/Rasters/Smoothing.html +48 -0
  70. package/examples/SVG Export/Circle Testing.html +32 -0
  71. package/examples/SVG Export/Clipping.html +17 -0
  72. package/examples/SVG Export/Compound Path.html +22 -0
  73. package/examples/SVG Export/Empty Path Testing.html +28 -0
  74. package/examples/SVG Export/Gradients.html +52 -0
  75. package/examples/SVG Export/Group Transform.html +25 -0
  76. package/examples/SVG Export/Line Testing.html +41 -0
  77. package/examples/SVG Export/Random Path Testing.html +39 -0
  78. package/examples/SVG Export/Raster.html +21 -0
  79. package/examples/SVG Export/Rect and Attribute Testing.html +53 -0
  80. package/examples/SVG Export/Rotated Primitives.html +80 -0
  81. package/examples/SVG Export/Shapes.html +58 -0
  82. package/examples/SVG Export/Symbols.html +27 -0
  83. package/examples/SVG Export/Text Testing.html +45 -0
  84. package/examples/SVG Export/Tiger.html +23 -0
  85. package/examples/SVG Export/Transform Test 1.html +29 -0
  86. package/examples/SVG Export/Transform Test 2.html +27 -0
  87. package/examples/SVG Import/Arcs.html +78 -0
  88. package/examples/SVG Import/Butterfly.html +223 -0
  89. package/examples/SVG Import/Circle and Ellipse Testing.html +26 -0
  90. package/examples/SVG Import/Clipping.html +100 -0
  91. package/examples/SVG Import/From File.html +30 -0
  92. package/examples/SVG Import/Gradient.html +138 -0
  93. package/examples/SVG Import/Gradients.html +30 -0
  94. package/examples/SVG Import/Inkscape Pivot.html +52 -0
  95. package/examples/SVG Import/Inkscape.html +88 -0
  96. package/examples/SVG Import/Line Testing.html +24 -0
  97. package/examples/SVG Import/MoreGradients.html +107 -0
  98. package/examples/SVG Import/Multiple Paths Test 1.html +42 -0
  99. package/examples/SVG Import/Multiple Paths Test 2.html +33 -0
  100. package/examples/SVG Import/Nested Groups Test.html +78 -0
  101. package/examples/SVG Import/Polybezier.html +43 -0
  102. package/examples/SVG Import/Rect Testing.html +25 -0
  103. package/examples/SVG Import/Symbols.html +24 -0
  104. package/examples/SVG Import/Testing.html +40 -0
  105. package/examples/SVG Import/Text Testing.html +19 -0
  106. package/examples/SVG Import/Tiger.html +742 -0
  107. package/examples/SVG Import/Transform Testing.html +22 -0
  108. package/examples/SVG Import/Viewbox.html +38 -0
  109. package/examples/Scripts/Arcs.html +39 -0
  110. package/examples/Scripts/BlendModes.html +77 -0
  111. package/examples/Scripts/BooleanOperations.html +937 -0
  112. package/examples/Scripts/CompoundPath.html +19 -0
  113. package/examples/Scripts/CurveTimeParameterization.html +61 -0
  114. package/examples/Scripts/HslColor.html +53 -0
  115. package/examples/Scripts/PathStructure.html +82 -0
  116. package/examples/Scripts/PathTangents.html +73 -0
  117. package/examples/Scripts/Resize.html +42 -0
  118. package/examples/Scripts/RoundRectangle.html +28 -0
  119. package/examples/Scripts/Shapes.html +54 -0
  120. package/examples/Scripts/StrokeBounds.html +101 -0
  121. package/examples/Scripts/StrokeScaling.html +65 -0
  122. package/examples/Tools/BezierTool.html +90 -0
  123. package/examples/Tools/Circles.html +28 -0
  124. package/examples/Tools/Clouds.html +35 -0
  125. package/examples/Tools/DrippingBrush.html +73 -0
  126. package/examples/Tools/FancyBrush.html +82 -0
  127. package/examples/Tools/Grid.html +44 -0
  128. package/examples/Tools/MultiLines.html +44 -0
  129. package/examples/Tools/MultipleTools.html +44 -0
  130. package/examples/Tools/PathEditing.html +95 -0
  131. package/examples/Tools/SquareRounded.html +76 -0
  132. package/examples/Tools/Stars.html +38 -0
  133. package/examples/Tools/Vektor.html +200 -0
  134. package/examples/Tools/Wave.html +50 -0
  135. package/examples/Tools/WormFarm.html +88 -0
  136. package/examples/Worker/Main.html +53 -0
  137. package/examples/Worker/Worker.js +14 -0
  138. package/examples/css/style.css +12 -0
  139. package/package.json +109 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,701 @@
1
+ # Change Log
2
+
3
+ ## `0.12.7`
4
+
5
+ ### Fixed
6
+
7
+ - PaperScript: Actually make `options.paperFeatures.moduleExports` work
8
+ independently from `options.paperFeatures.operatorOverloading`.
9
+
10
+ ## `0.12.6`
11
+
12
+ ### Added
13
+
14
+ - PaperScript: Add option `options.paperFeatures.moduleExports` to control
15
+ module exports conversion.
16
+
17
+ ## `0.12.5`
18
+
19
+ ### Added
20
+
21
+ - PaperScript: Add option `options.paperFeatures.operatorOverloading` to control
22
+ operator overloading.
23
+
24
+ ### Fixed
25
+
26
+ - Fix `new Raster(HTMLCanvasElement)` constructor (#1745).
27
+ - Handle `CurveLocation` on paths with only one segment.
28
+ - Fix recently introduced error in `CompoundPath.compare()` (#1769).
29
+ - Clamp opacity values to [0, 1] (#1814).
30
+ - Support closed `Path` items with blend mode and no segments (#1763).
31
+ - Fix error in `getCrossingSegments()` (#1773).
32
+ - SVG Import: Support SVG strings with leading line-breaks (#1813).
33
+ - Docs: Improve documentation for `Raster#drawImage(CanvasImageSource)` (#1784).
34
+
35
+ ### Changed
36
+
37
+ - Use `'paper-'` prefix in generated view ids.
38
+
39
+ ## `0.12.4`
40
+
41
+ ### Added
42
+
43
+ - Allow paper core import in TypeScript (#1713).
44
+ - Boolean: Improve performance from `O(n^2)` to nearly `O(n)` by the use of the
45
+ sweep and prune algorithm (#1737).
46
+ - Docs: Add support for nullable values.
47
+
48
+ ### Fixed
49
+
50
+ - Fix `PathItem#getCrossing()` to not return overlaps (#1409).
51
+ - Fix regression in `Curve.getIntersections()` (#1638).
52
+ - Fix edge cases in `CurveLocation.isCrossing()` (#1419, #1263).
53
+ - Fix `SymbolItem#hitTestAll()` to return only one match per symbol item
54
+ (#1680).
55
+ - Fix handling of negative `Shape` sizes (#1733).
56
+ - Fix parsing of RGB `Color` strings with percentages (#1736).
57
+ - Fix `Shape` bounds when passing position in constructor (#1686).
58
+ - Prevent nested group matrix from reset when transforming parent (#1711).
59
+ - Boolean: Fix edge cases in overlap detection (#1262).
60
+ - Boolean: Add check for paths with only one segment (#1351).
61
+ - Boolean: Correctly handle open filled paths (#1647).
62
+ - Boolean: Avoid winding number edge cases (#1619).
63
+ - Docs: Fix some documentation return types (#1679).
64
+
65
+ ## `0.12.3`
66
+
67
+ ### Added
68
+
69
+ - Add documentation for `Item#internalBounds`.
70
+
71
+ ### Fixed
72
+
73
+ - Fix regression in `Color` change propagation (#1672, #1674).
74
+ - SVG Export: Fix viewport size of exported `Symbol` (#1668).
75
+ - Handle non-invertible matrices in `Item#contains()` (#1651).
76
+ - Improve documentation for `Item#clipMask` (#1673).
77
+ - Improve TypeScript definitions (#1659, #1663, #1664, #1667).
78
+
79
+ ## `0.12.2`
80
+
81
+ ### Fixed
82
+
83
+ - Fix drawing with compound-paths as clip-items (#1361).
84
+ - Fix drawing of path selection with small handle size (#1327).
85
+ - Do not ignore `Group#clipItem.matrix` in `Group#internalBounds` (#1427).
86
+ - Correctly calculate bounds with nested empty items (#1467).
87
+ - Fix color change propagation on groups (#1152).
88
+ - Fix `Path#arcTo()` where `from` and `to` points are equal (#1613).
89
+ - Improve `new Raster(size[, position])` constructor (#1621).
90
+ - SVG Export: Fix error when `Item#matrix` is not invertible (#1580).
91
+ - SVG Export: Include missing viewBox attribute (#1576).
92
+ - SVG Import: Use correct default values for gradients (#1632, #1660).
93
+ - SVG Import: Add basic `<switch/>` support (#1597).
94
+ - JSON Import: Prevent `Item#insert()` method from being overridden (#1392).
95
+ - PaperScript: Fix issues with increment/decrement operators (#1450, #1611).
96
+
97
+ ## `0.12.1`
98
+
99
+ ### Added
100
+
101
+ - Add TypeScript definition, automatically generated from JSDoc comments
102
+ (#1612).
103
+ - Support `new Raster(size[, position])` constructor.
104
+ - Expose `Raster#context` accessor.
105
+ - Implement `Raster#clear()` method to clear associated canvas context.
106
+ - Node.js: Add support for Node.js v11 and v12.
107
+
108
+ ### Fixed
109
+
110
+ - Fix parsing of CSS colors with spaces in parentheses (#1629).
111
+ - Improve `Color.random()` documentation.
112
+ - Fix `Tween#then()` documentation.
113
+
114
+ ### Removed
115
+
116
+ - Node.js: Remove support for Node.js v6.
117
+
118
+ ## `0.12.0`
119
+
120
+ ### News
121
+
122
+ Another release, another new member on the team: Please welcome
123
+ [@arnoson](https://github.com/arnoson), who has worked hard on the all new
124
+ animation support, exposed through the `Tween` class and its various methods on
125
+ the `Item` class, see below for details:
126
+
127
+ ### Added
128
+
129
+ - Add new `Tween` class and related methods on `Item`, to animate and
130
+ interpolate their various properties, including colors, sub-properties, etc.:
131
+ `Item#tween(from, to, options)`, `Item#tween(to, options)`,
132
+ `Item#tween(options)`, `Item#tweenFrom(from, options)`,
133
+ `Item#tweenTo(to, options)`
134
+
135
+ ### Fixed
136
+
137
+ - Only draw Raster if image is not empty (#1320).
138
+ - Emit mousedrag events on correct items when covered by other items (#1465).
139
+ - Fix drawing issues of bounds and position with `Group#selectedColor` (#1571).
140
+ - Fix `Item.once()` to actually only emit event once.
141
+ - Various documentation fixes and improvements (#1399).
142
+
143
+ ## `0.11.8`
144
+
145
+ ### News
146
+
147
+ This is the first release in quite a while, and it was made possible thanks to
148
+ two new people on the team:
149
+
150
+ A warm welcome to [@sasensi](https://github.com/sasensi) and
151
+ [@sapics](https://github.com/sapics), the two new and very active maintainers /
152
+ contributors! :tada:
153
+
154
+ Their efforts mean that many issues are finally getting proper attention and
155
+ solid fixes, as we are paving the way for the upcoming release of `1.0.0`. Here
156
+ the fixes and additions from the past two weeks:
157
+
158
+ ### Fixed
159
+
160
+ - Prevent `paper` object from polluting the global scope (#1544).
161
+ - Make sure `Path#arcTo()` always passes through the provide through point
162
+ (#1477).
163
+ - Draw shadows on `Raster` images (#1437).
164
+ - Fix boolean operation edge case (#1506, #1513, #1515).
165
+ - Handle closed paths with only one segment in `Path#flatten()` (#1338).
166
+ - Remove memory leak on gradient colors (#1499).
167
+ - Support alpha channel in CSS colors (#1468, #1539, #1565).
168
+ - Improve color CSS string parsing and documentation.
169
+ - Improve caching of item positions (#1503).
170
+ - Always draw selected position in global coordinates system (#1545).
171
+ - Prevent empty `Symbol` items from causing issues with transformations (#1561).
172
+ - Better detect when a cached global matrix is not valid anymore (#1448).
173
+ - Correctly draw selected position when item is in a group with matrix not
174
+ applied (#1535).
175
+ - Improve handling of huge amounts of segments in paths (#1493).
176
+ - Do not trigger error messages about passive event listeners on Chrome (#1501).
177
+ - Fix errors with event listeners on mobile (#1533).
178
+ - Prevent first mouse drag event from being emitted twice (#1553).
179
+ - Support optional arguments in translate and rotate statements in SVG Import
180
+ (#1487).
181
+ - Make sure SVG import always applies imported attributes (#1416).
182
+ - Correctly handle `Raster` images positions in SVG import (#1328).
183
+ - Improve documentation for `Shape#toPath()` (#1374).
184
+ - Improve documentation of hit test coordinate system (#1430).
185
+ - Add documentation for `Item#locked` (#1436).
186
+ - Support Webpack bundling in Node.js server (#1482).
187
+ - Travis CI: Get unit tests to run correctly again.
188
+ - Travis CI: Remove Node 4 and add Node 9.
189
+
190
+ ### Added
191
+
192
+ - `Curve#getTimesWithTangent()` and `Path#getOffsetsWithTangent()` as a way to
193
+ get the curve-times / offsets where the path is tangential to a given vector.
194
+ - `Raster#smoothing` to control if pixels should be blurred or repeated when a
195
+ raster is scaled up (#1521).
196
+ - Allow `PaperScript`to export from executed code, supporting `export default`,
197
+ named exports, as well as `module.exports`.
198
+
199
+ ## `0.11.5`
200
+
201
+ ### Fixed
202
+
203
+ - Fix `Curve#isSelected()` to correctly reflect the state of `#handle1` (#1378).
204
+ - Key Events: Fix auto-filling issue on Chrome (#1358, #1365).
205
+ - Boolean: Check that overlaps are on the right path (#1321).
206
+ - Boolean: Add better filtering for invalid segments (#1385).
207
+
208
+ ### Added
209
+
210
+ - Node.js: Add JPEG support to exportFrames() (#1166).
211
+
212
+ ## `0.11.4`
213
+
214
+ ### Changed
215
+
216
+ - Node.js: Add support for v8, and keep testing v4, v6, v7 in Travis CI.
217
+
218
+ ## `0.11.3`
219
+
220
+ ### Fixed
221
+
222
+ - Mouse Events: Fix item-based `doubleclick` events (#1316).
223
+ - Overhaul the caching of bounds and matrix decomposition, improving reliability
224
+ of `Item#rotation` and `#scaling` and fixing situations caused by wrongly
225
+ caching `Item#position` and `#bounds` values.
226
+ - Prevent consumed properties in object literal constructors from being set on
227
+ the instance.
228
+
229
+ ### Changed
230
+
231
+ - Make all functions and accessors enumerable on all Paper.js classes.
232
+
233
+ ## `0.11.2`
234
+
235
+ ### Fixed
236
+
237
+ - PaperScript: Fix a parsing error in math operations without white-space
238
+ (#1314).
239
+
240
+ ## `0.11.1`
241
+
242
+ ### Fixed
243
+
244
+ - Bring back deactivation of Node.js modules on browsers. This has most probably
245
+ broken Webpack bundling in `0.11.0`.
246
+
247
+ ## `0.11.0`
248
+
249
+ ### Changed
250
+
251
+ - Separate `paper` module on NPM into: `paper`, `paper-jsdom` and
252
+ `paper-jsdom-canvas` (#1252):
253
+ - `paper` is the main library, and can be used directly in a browser
254
+ context, e.g. a web browser or worker.
255
+ - `paper-jsdom` is a shim module for Node.js, offering headless use with SVG
256
+ importing and exporting through [jsdom](https://github.com/tmpvar/jsdom).
257
+ - `paper-jsdom-canvas` is a shim module for Node.js, offering canvas
258
+ rendering through [Node-Canvas](https://github.com/Automattic/node-canvas)
259
+ as well as SVG importing and exporting through
260
+ [jsdom](https://github.com/tmpvar/jsdom).
261
+
262
+ ### Added
263
+
264
+ - PaperScript: Support newer, external versions of Acorn.js for PaperScript
265
+ parsing, opening the doors to ES 2015 (#1183, #1275).
266
+ - Hit Tests: Implement `options.position` to hit `Item#position` (#1249).
267
+ - Split `Item#copyTo()` into `#addTo()` and `#copyTo()`.
268
+
269
+ ### Fixed
270
+
271
+ - Intersections: Bring back special handling of curve end-points (#1284).
272
+ - Intersections: Correctly handle `Item#applyMatrix = false` (#1289).
273
+ - Boolean: Bring back on-path winding handling (#1281).
274
+ - Boolean: Pass on options in `PathItem#subtract(path, options)` (#1221).
275
+ - Boolean: Implement `options.trace` as a way to perform boolean operations on
276
+ the strokes / traces instead of the fills / areas of the involved paths
277
+ (#1221).
278
+ - Boolean: Always return `CompoundPath items (#1221).
279
+ - Style: Fix handling of gradient matrices when `Item#applyMatrix = false`
280
+ (#1238).
281
+ - Style: Prevent cleaning pre-existing styles when setting `Item#style` to an
282
+ object (#1277).
283
+ - Mouse Events: Only handle dragItem if the hitItem responds to `mousedrag`
284
+ events (#1247, #1286).
285
+ - Bounds: Clear parent's bounds cache when item's visibility changes (#1248).
286
+ - Bounds: Fix calculation of internal bounds with children and
287
+ `Item#applyMatrix = false` (#1250).
288
+ - Hit-Tests: Fix issue with non-invertible matrices ( #1271).
289
+ - SVG Import: Improve handling of sizes in percent (#1242).
290
+ - Rectangle: Improve handling of dimension properties, dealing better with
291
+ `left` / `top` / `right` / `bottom` / `center` values (#1147).
292
+ - Scene Graph: Do not allow inserting same item as child multiple times.
293
+ - Path: Fix handling of `insert = false` in `new Path.Constructor()`
294
+ initialization (#1305).
295
+ - PaperScript: Fix positive unary operator.
296
+ - Docs: Fix parameter sequence in Matrix constructor (#1273).
297
+ - Docs: Add documentation for options.bound and options.matrix in `#exportSVG()`
298
+ (#1254).
299
+ - Docs: Fix wrong `@link` references to bean properties.
300
+
301
+ ## `0.10.3`
302
+
303
+ ### Changed
304
+
305
+ - Node.js: Support v7, and keep testing v4 up to v7 in Travis CI.
306
+ - Node.js: Loosely couple Node.js / Electron code to `Canvas` module, and treat
307
+ its absence like a headless web worker context in the browser (#1103).
308
+ - Clean up handling of `Item#_set()`, `#set()` and `#initialize()`:
309
+ - Use `#_set()` for actually setting internal properties, e.g. on `Point`,
310
+ `Size`, so that derived classes can reuse other parts without having to
311
+ override each individual function (e.g. in `SegmentPoint`)
312
+ - Define `#set()` as a shortcut to `#initialize()` on all basic types, to
313
+ offer the same amount of flexibility when setting values, accepting object
314
+ literals as well as lists of value arguments.
315
+ - SVG Export: Add support for shorter `h` / `v` commands for horizontal /
316
+ vertical lines in SVG output.
317
+ - JSON Import / Export: Implement new and shorter segments array notation:
318
+ - Close paths by including `true` as the last entry
319
+ - Allow nested segment arrays to be passed to `PathItem.create()` as well as
320
+ the `CompoundPath` constructor to create all sub-paths.
321
+ - Reflect `View#zoom` and `View#center` through matrix decomposition, and
322
+ implement additional decomposed properties such as `#scaling` and `#rotation`.
323
+ - Reduce various internal epsilon values for general improved precision while
324
+ maintaining reliability.
325
+ - Split `PathItem#resolveCrossings()` into `#resolveCrossings()` and
326
+ `#reorient()` (#973).
327
+
328
+ ### Added
329
+
330
+ - Implement `Path#divideAt(location)`, in analogy to `Curve#divideAt(location)`.
331
+ - Add `PathItem#compare()` as a way to compare the geometry of two paths to see
332
+ if they describe the same shape, handling cases where paths start in different
333
+ segments or use different amounts of curves to describe the same shape.
334
+ - Implement `Curve#hasLength()` as an optimized check for curve-length (#1109).
335
+ - Implement `Curve#classify()` to determine the type of cubic Bézier curve via
336
+ discriminant classification, based on an approach described by Loop and Blinn,
337
+ and use it to simplify curve self-intersection handling (#773, #1074, #1235).
338
+ - Add `Curve.getPeaks()` as a fast way to retrieve points that are often similar
339
+ to the more costly curvature extrema for use in curve offsetting.
340
+ - Expose `Curve. getCurveLineIntersections()` for use in curve offsetting.
341
+ - Add `Line.getDistance()` and use it in `Curve.getOverlaps()` (#1253).
342
+ - Implement `Segment#isSmooth()` and use it in handling of stroke-joins.
343
+ - Bring back caching of `Item#rotation` and `#scaling`, but only allow matrix
344
+ decomposition-based properties on items with `#applyMatrix = false`
345
+ (#1004, #1177).
346
+
347
+ ### Fixed
348
+
349
+ - Many improvements to boolean operations:
350
+ - Improve performance of boolean operations when there no actual crossings
351
+ between the paths, but paths may be contained within each other.
352
+ - Improve path tracing approach by implementing a branching structure and
353
+ sorting segments according to their reliability as starting points for
354
+ traces (#1073).
355
+ - Improve calculation and reliability of winding contributions.
356
+ - Improve code that resolves crossings and reorients compound-paths based
357
+ on how the sub-paths are nested.
358
+ - Fix issue where unite operation wrongly fills inner path (#1075).
359
+ - Better handle cases where one `Path` is open and the other closed (#1089).
360
+ - Solve `null` exceptions during complex boolean operations (#1091).
361
+ - Improve bidirectional curve-time rescaling in `divideLocations()` (#1191).
362
+ - Improve handling of intersections between touching curves (#1165).
363
+ - Improve reliability of `Curve#getIntersections()` (#1174).
364
+ - Fix `getOverlaps()` to always return overlaps in correct sequence (#1223).
365
+ - Improve handling of multiple crossings on the same curve.
366
+ - Improve tangent direction handling in `CurveLocation#isCrossing()`, by finding
367
+ unambiguous vectors, taking the curve's loop, cusp, inflection, and "peak"
368
+ points into account (#1073, #1074).
369
+ - Prevent `Path#getStrokeBounds(matrix)` from accidentally modifying segments
370
+ (#1102).
371
+ - Improve compatibility with JSPM (#1104).
372
+ - SVG Import: Correctly handle multiple sequential move commands (#1134).
373
+ - SVG Export: Properly handle generated IDs (#1138).
374
+ - SVG Export: Support multiple gradient offsets at 0 (#1241).
375
+ - Fix imprecision in `Numerical.findRoot()` (#1149).
376
+ - PaperScript: Prevent invalid JavaScript in assignment operators (#1151).
377
+ - Hit Tests: Improve handling of SymbolItem in#hitTestAll() (#1199).
378
+ - Hit Tests: Fix stroke hit-testing for rounded shape items (#1207).
379
+ - Fix matrix cloning for groups with `#applyMatrix = false` ( #1225).
380
+ - Correctly handle offset in `Curve#divideAt(offset)` (#1230).
381
+ - Fix issue with `Curve#isStraight()` where handles were checked incorrectly
382
+ for collinearity (#1269).
383
+ - Fix `Line#getSide()` imprecisions when points are on the line.
384
+ - Docs: Fix documentation of `Project#hitTestAll()` (#536).
385
+ - Docs: Improve description of `option.class` value in `Project#hitTest()`
386
+ (#632).
387
+
388
+ ### Removed
389
+
390
+ - Remove `Numerical.TOLERANCE = 1e-6` as there is no internal use for it
391
+ anymore.
392
+
393
+ ## `0.10.2`
394
+
395
+ ### Fixed
396
+
397
+ - Get published version to work correctly in Bower again.
398
+
399
+ ## `0.10.1`
400
+
401
+ ### Fixed
402
+
403
+ - Correct a few issues with documentation and NPM publishing that slipped
404
+ through in the `0.10.0` release.
405
+
406
+ ## `0.10.0`
407
+
408
+ ### Preamble
409
+
410
+ This is a huge release for Paper.js as we aim for a version `1.0.0` release
411
+ later this year. As of this version, all notable changes are documented in the
412
+ change-log following common [CHANGELOG](http://keepachangelog.com/) conventions.
413
+ Paper.js now also adheres to [Semantic Versioning](http://semver.org/).
414
+
415
+ There are many items in the changelog (and many more items not in the changelog)
416
+ so here a high-level overview to frame the long list of changes:
417
+
418
+ - Boolean operations have been improved and overhauled for reliability and
419
+ efficiency. These include the path functions to unite, intersect, subtract,
420
+ exclude, and divide with another path.
421
+
422
+ - There was a large amount of work implementing test coverage under QUnit.
423
+
424
+ - Mouse and key handling has been re-engineered and extended to work with view.
425
+ Many outstanding bugs have been fixed with mouse and key handling.
426
+
427
+ - Many SVG-handling enhancements and bug-fixes, including handling browser-
428
+ specific interpretations of the SVG standard, have been added.
429
+
430
+ - There are API name changes for more consistency as well as some required by
431
+ changes in the EcmaScript 6 standard (e.g., `Symbol` → `SymbolDefinition`).
432
+
433
+ - Even though it is not new, since version `0.9.22` Paper.js no longer resizes
434
+ the canvas to match the view. The canvas must be resized independently.
435
+
436
+ Thank you all for using Paper.js, submitting bugs and ideas, and all those that
437
+ contribute to the code.
438
+
439
+ ### Changed
440
+
441
+ - Significant overhaul and improvements of boolean path operations
442
+ `PathItem#unite()`, `#subtract()`, `#intersect()`, `#exclude()`, `#divide()`:
443
+ - Improve handling of self-intersecting paths and non-zero fill-rules.
444
+ - Handle operations on identical paths.
445
+ - Improve handling of near-collinear lines.
446
+ - Handle self-intersecting paths that merely "touch" themselves.
447
+ - Handle situations where all encountered intersections are part of overlaps.
448
+ - Methods that accepted a `time` parameter or boolean second parameter causing
449
+ the argument to be interpreted as curve-time instead of offset are now
450
+ separate functions with distinct names (#563):
451
+ - `Curve#getNormalAt(time, true)` → `#getNormalAtTime(true)`
452
+ - `Curve#divide()` → `#divideAt(offset)` / ` #divideAtTime(time)`
453
+ - `Curve#split()` → `#splitAt(offset)` / `#splitAtTime(time)`
454
+ - `Curve#getParameterAt(offset)` → `#getTimeAt(offset)`
455
+ - `Curve#getParameterOf(point)` → `getTimeOf(point)`
456
+ - `Curve#getPointAt(time, true)` → `#getPointAtTime(time)`
457
+ - `Curve#getTangentAt(time, true)` → `#getTangentAtTime(time)`
458
+ - `Curve#getNormalAt(time, true)` → `#getNormalAtTime(time)`
459
+ - `Curve#getCurvatureAt(time, true)` → `#getCurvatureAtTime(time)`
460
+ - `CurveLocation#parameter` → `#time`
461
+ - `Path#split(offset/location)` → `#splitAt(offset/location)`
462
+ - Significant improvement of reliability of bezier fat-line clipping code in
463
+ `PathItem#getIntersections()` and `#getCrossings()`.
464
+ - `PathItem#smooth()` now accepts an `options.type` string specifying which
465
+ smoothing algorithm to use: `'asymmetric'` (default), `'continuous'`,
466
+ `'catmull-rom'`, and `'geometric'` (#338).
467
+ - `PathItem#flatten()`: argument has been changed from `tolerance` (maximum
468
+ allowed distance between points) to `flatness` (maximum allowed error) (#618).
469
+ - Update internal Acorn JavaScript parser to `0.5.0`, the last small version.
470
+ - Transition to Gulp based build process.
471
+ - Update QUnit to `1.20.0`.
472
+ - Update to JSDOM `8.3.0`, to benefit from integrated image and canvas support.
473
+ - Complete refactoring of keyboard event handling to increase reliably when
474
+ handling special keys.
475
+ - Complete refactoring of mouse-event handling on item and view, to better
476
+ handle event propagation, default behavior and `Item#removeOn()` calls.
477
+ - Simplify and streamline the mouse-handling code on `Tool` (#595).
478
+ - Mouse handlers can to return `false` to call `event.stop()`, stopping event
479
+ propagation and prevent the default browser behavior.
480
+ - `event.preventDefault()` is called by default after any handled mouse mouse
481
+ events, except `'mousemove'`, and only on a `'mousedown'` event if the view
482
+ or tool respond to `'mouseup'`.
483
+ - Switch to the new HTML5 Page Visibility API when detecting invisible documents
484
+ and canvases.
485
+ - Rename `#windingRule` to `#fillRule` on `Item` and `Style`.
486
+ - Do not replace existing named child reference on `Item#children` with new one
487
+ when the name is identical.
488
+ - Limit the effects of `#strokeScaling` to `PathItem` and `Shape` (#721).
489
+ - Throw an exception if arguments to `#smooth()` are segments or curves from
490
+ incorrect paths.
491
+ - Rename `Matrix#concatenate()` to `#append()` and `preConcatenate()` to
492
+ `#prepend()`.
493
+ - Make `Matrix#shiftless()` and `#orNullIfIdentity()` internal functions.
494
+ - De-bounce internal `View#update()` calls to minimize the number of times a
495
+ canvas is redrawn (#830, #925).
496
+ - `Symbol` now clashes with ES6 definition of Symbol and has been changed
497
+ (#770):
498
+ - `Symbol` → `SymbolDefinition`
499
+ - `PlacedSymbol` → `SymbolItem`
500
+ - `Symbol#definition` → `SymbolDefinition#item`
501
+ - `PlacedSymbol#symbol` → `SymbolItem#definition`
502
+ - Don't serialize deprecated `Style#font` property.
503
+ - Don't serialize text-styles in non-text items (#934).
504
+ - Changed argument `parameter` to `time` for Postscript-style drawing commands.
505
+ - `Item#clone()`: optional argument is now an options object with defaults
506
+ `{insert: true, deep: true}`. `insert` controls whether the clone is inserted
507
+ into the project and `deep` controls whether the item's children are cloned.
508
+ The previous boolean optional argument is still interpreted as the `insert`
509
+ option (#941).
510
+ - `Matrix` properties `#b` and `#c` have been reversed to match common standard.
511
+ - `#importSVG()`: improve handling of style inheritance for nested `<defs>`.
512
+ - Move `PaperScript#execute()` URL argument into `options.url` (#902).
513
+ - PaperScript: Only translate `==` to `equals() calls for `Point`, `Size` and
514
+ `Color` (#1043).
515
+
516
+ ### Added
517
+
518
+ - Use unified code-base for browsers, Node.js, Electron, and anything
519
+ in-between, and enable npm install for browser use (#739).
520
+ - Start using automatic code testing and deployment of prebuilt versions through
521
+ Travis CI.
522
+ - Reach JSHint compliance and include regular linting in Travis CI tests.
523
+ - Use QUnit tests for leaked globals.
524
+ - Define code format standards in .editorconfig file
525
+ - Add support for running without a canvas for Web Workers, Node.js
526
+ (#561, #582, #634).
527
+ - Add support for all common mouse events to `View`.
528
+ - Add support for `'keydown'` and `'keyup'` events to `View` (#896).
529
+ - Add `View#requestUpdate()` function to minimize number of actual canvas
530
+ redraw.
531
+ - Add `View#matrix` to allow matrix transformation to be accessed and modified
532
+ directly on the view (#832).
533
+ - Multiple additions to SVG export (`#exportSVG()`):
534
+ - Support `{ precision: value }` option.
535
+ - Support `#fillRule` through the SVG `fill-rule` attribute.
536
+ - Support `#blendMode` through the CSS `mix-blend-mode` attribute.
537
+ - Various additions to `#getItems()` on `Project` and `Item`:
538
+ - Add support for `{ recursive: false }` as a way to prevent iterating over
539
+ all children of children.
540
+ - Add support for `{ match: function() {} }`, so the match function can be
541
+ passed in combination with other options.
542
+ - Add `Item#copyAttributes()` and `Item#copyContent()`, and use them in
543
+ `Item#clone()`.
544
+ - Add optional `insert` boolean argument to `Path#toShape()`, `Shape#toPath()`,
545
+ `Item#rasterize()`. Default is to insert, set to `false` to prevent the
546
+ created item from being inserted into the scene graph.
547
+ - Add visual item comparison to QUnit, through rasterization and Resemble.js
548
+ diffing.
549
+ - Add many unit tests for known edge cases in boolean operations and curve
550
+ intersections.
551
+ - Add `Project#addLayer()` and `Project#insertLayer()` (#903).
552
+ - Layers may now be given names and be accessed through `project.layers[name]`
553
+ (#491).
554
+ - Add `Matrix#prepended()` and `#appended()` to return copies of the modified
555
+ matrix.
556
+ - `Shape#hitTest()`: Add boolean option `options.stroke` (#911).
557
+ - Insert version number into docs.
558
+ - Support `Raster#onLoad()` events on `Raster#setImage()` now (#924).
559
+ - Add `Raster#onError()` event support (#849).
560
+ - Allow the control of automatic updating of the canvas through
561
+ `View#autoUpdate` (default: `true`)(#921).
562
+ - Set `1px` default `strokeWidth` for SVG imports to fix IE/Edge default (#467).
563
+ - `ImportSVG()` passes imported SVG data to `onLoad` callback as second
564
+ parameter.
565
+ - Add `#interpolate` for `Segment`, `Path`, and `CompoundPath` (#624).
566
+ - Implement `CompoundPath#flatten()`, `#simplify()`, `#smooth()` (#727).
567
+ - Implement `#hitTestAll()` to return all items that were hit (#536).
568
+ - `#importSVG()` implements `option.onError` callback (#969).
569
+ - `settings.insertItems` controls whether newly created items are inserted or
570
+ not (default: `true`).
571
+ - Add `#importSVG()` `option.insert` (default: `true`) to control insertion
572
+ (#763).
573
+ - Add new options to `#exportSVG()` to control output bounds and transformation
574
+ matrix (#972).
575
+ - Allow `Item#position` to be selected via `Item#position.selected` (#980).
576
+ - Add `tolerance` argument to `Path#join(path, tolerance)`.
577
+ - Add `Curve#getOffsetAtTime(time)`, as the reverse of
578
+ `Curve#getTimeAt(offset)`.
579
+ - Add `Raster#loaded` to reflect the loading state of its image.
580
+
581
+ ### Fixed
582
+
583
+ - Fix calculations of `Item#strokeBounds` for all possible combinations of
584
+ `Item#strokeScaling` and `Item#applyMatrix` for `Path`, `Shape` and
585
+ `SymbolItem`, along with correct handling of such strokes in Item#hitTest()
586
+ (#697, #856, #1014).
587
+ - Make new code-base unified for Node.js/browser work with module bundlers like
588
+ Webpack (#986).
589
+ - Improve hit-testing and `#contains()` checks on path with horizontal lines
590
+ (#819).
591
+ - Improve reliability of `Path#getInteriorPoint()` in rare edge-cases.
592
+ - Handle non-reversible matrices in `Item#hitTest()` (#617).
593
+ - Fix various issues with adding and removing of segments in paths (#815).
594
+ - Support bubbling up of `doubleclick` events on `Group` (#834).
595
+ - Fix wrong `#key` values in key-events that do not match character (#881).
596
+ - Fix keyboard event handling of control and meta keyboard sequences and special
597
+ character handling (#860).
598
+ - Handle incorrect mouse event on `ctrl-alt-del` key sequence on Chrome/Windows
599
+ (#800).
600
+ - Do not rasterize items if the resulting raster will be empty (#828).
601
+ - Fix SVG serialization in JSDOM `7.0.0` and newer (#821).
602
+ - Correctly handle gradients in SVG import on Firefox (#666).
603
+ - Consistently interpret curves as straight or not-straight (#838).
604
+ - Switch blendMode to 'lighter' in Candy Crash example for better performance
605
+ (#453).
606
+ - Don't block touch actions when using paper in JavaScript mode (#686).
607
+ - Convert touch event coordinates to project coordinates (#633).
608
+ - Fix exceptions when a top-level layer is selected.
609
+ - Don't allow layers to turn up in hit-tests (#608).
610
+ - Maintain `Raster#source` correctly on Node.js (#914).
611
+ - Boolean operations correctly handle open `Path` items within `CompoundPath`
612
+ (#912).
613
+ - Don't modify an array of child items passed to `CompoundPath#insertChildren()`
614
+ when it is a child items array of a `CompoundPath`.
615
+ - Correctly handle `#strokeScaling` in `Shape` hit-tests (#697).
616
+ - Support clip-masks in hit-testing (#671).
617
+ - Fix incorrect `#hitTest()` and `#contains()` cases (#819, #884).
618
+ - Update documentation to note appropriate use for `#simplify()` (#920).
619
+ - `#importSVG()` now supports percentage dimensions and
620
+ `gradientUnits="objectBoundingBox"`. (#954, #650).
621
+ - `Group` items with clip-masks now calculate correct bounding boxes (#956).
622
+ - Calling `event.stopPropagation()` in `'mousedown'` handler no longer prevents
623
+ `'mousedrag'` events (#952).
624
+ - Draw `Item` shadows when `#shadowBlur` is zero (#955).
625
+ - Fixes for web site examples (#967).
626
+ - Prevent `Item` bounds from permanently collapsing to 0 when applying non-
627
+ invertible transformations (#558).
628
+ - Scaling shadows now works correctly with browser- and view-zoom (#831).
629
+ - `Path#arcTo()` correctly handles zero sizes.
630
+ - `#importSVG()` handles `onLoad` and `onError` callbacks for string inputs that
631
+ load external resources (#827).
632
+ - `#importJSON()` and `#exportJSON()` now handle non-`Item` objects correctly
633
+ (#392).
634
+ - `#exportSVG()` now exports empty paths if used as a clip-mask.
635
+ - `#importJSON()` no longer generates callstack exceeded exceptions (#764).
636
+ - Fix problems with group selection structures after `Group#importJSON()`
637
+ (#785).
638
+ - Fix an issue in `Item#importJSON()` where `#parent` is `null` when calling it
639
+ on existing, already inserted items (#1041).
640
+ - Correct issue when using paper-core in Node.js (#975).
641
+ - Fix `event.delta` on mousedrag events (#981).
642
+ - Improve handling of XML attribute namespaces for IE's XMLSerializer() (#984).
643
+ - Make sure `Item#removeChildren()` fully removes children (#991).
644
+ - Improve handling of event propagation on `View` and `Item` (#995).
645
+ - `#importSVG()`: Improve handling of viewBox.
646
+ - Make sure all named item lookup structures are kept in sync (#1009).
647
+ - Convert absolute local gradient URLs to relative ones (#1001).
648
+ - Fix TypeError in `Path#unite()` (#1000).
649
+ - Allow the selection of a `Path` item's bounds without selecting the segments
650
+ (#769).
651
+ - Fix wrong indices in `Item#insertChildren()`, when inserting children that
652
+ were previously inserted in the same parent (#1015).
653
+ - Add capability to `PathItem#closePath()` to handle imprecise SVG data due to
654
+ rounding (#1045).
655
+ - Improve reliability of fat-line clipping for curves that are very similar
656
+ (#904).
657
+ - Improve precision of `Numerical.solveQuadratic()` and
658
+ `Numerical.solveCubic()` for edge-cases (#1085).
659
+
660
+ ### Removed
661
+
662
+ - Canvas attributes "resize" and "data-paper-resize" no longer cause paper to
663
+ resize the canvas when the viewport size changes; Additional CSS styles are
664
+ required since `0.9.22`, e.g.:
665
+
666
+ ```css
667
+ /* Scale canvas with resize attribute to full size */
668
+ canvas[resize] {
669
+ width: 100%;
670
+ height: 100%;
671
+ }
672
+ ```
673
+ - Legacy `Color` constructors (removed in `0.9.25`): `GrayColor`, `RgbColor`,
674
+ `HsbColor`, `HslColor`, and `GradientColor`. These have been replaced
675
+ with corresponding forms of the `Color` constructor.
676
+ - Undocumented function `Project#addChild()` that added a layer to a project.
677
+ It is replaced by `Project#addLayer()` and `Project#insertLayer()`.
678
+
679
+ ### Deprecated
680
+
681
+ - `#windingRule` on `Item` and `Style` → `#fillRule`
682
+ - `Curve#getNormalAt(time, true)` → `#getNormalAtTime(true)`
683
+ - `Curve#divide()` → `#divideAt(offset)` / `#divideAtTime(time)`
684
+ - `Curve#split()` → `#splitAt(offset)` / `#splitAtTime(time)`
685
+ - `Curve#getParameterAt(offset)` → `#getTimeAt(offset)`
686
+ - `Curve#getParameterOf(point)` → `getTimeOf(point)`
687
+ - `Curve#getPointAt(time, true)` → `#getPointAtTime(time)`
688
+ - `Curve#getTangentAt(time, true)` → `#getTangentAtTime(time)`
689
+ - `Curve#getNormalAt(time, true)` → `#getNormalAtTime(time)`
690
+ - `Curve#getCurvatureAt(time, true)` → `#getCurvatureAtTime(time)`
691
+ - `CurveLocation#parameter` → `#time`
692
+ - `Path#split(offset/location)` → `#splitAt(offset/location)`
693
+ - `Symbol` → `SymbolDefinition`
694
+ - `PlacedSymbol` → `SymbolItem`
695
+ - `Symbol#definition` → `SymbolDefinition#item`
696
+ - `PlacedSymbol#symbol` → `SymbolItem#definition`
697
+ - `Project#symbols` → `#symbolDefinitions`
698
+ - `Matrix#concatenate` → `#append`
699
+ - `Matrix#preConcatenate` → `#prepend`
700
+ - `Matrix#chain` → `#appended`
701
+ - `GradientStop#rampPoint` → `#offset`