paper 0.12.20 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +318 -0
- package/README.md +45 -26
- package/dist/docs/assets/js/paper.js +1210 -481
- package/dist/docs/classes/ChangeFlag.html +384 -0
- package/dist/docs/classes/Color.html +63 -47
- package/dist/docs/classes/CompoundPath.html +219 -62
- package/dist/docs/classes/Curve.html +9 -7
- package/dist/docs/classes/CurveLocation.html +1 -1
- package/dist/docs/classes/Event.html +1 -1
- package/dist/docs/classes/Gradient.html +1 -1
- package/dist/docs/classes/GradientStop.html +1 -1
- package/dist/docs/classes/Group.html +151 -27
- package/dist/docs/classes/HitResult.html +3 -2
- package/dist/docs/classes/HostItem.html +6721 -0
- package/dist/docs/classes/Item.html +120 -27
- package/dist/docs/classes/Key.html +1 -1
- package/dist/docs/classes/KeyEvent.html +1 -1
- package/dist/docs/classes/Layer.html +151 -27
- package/dist/docs/classes/Matrix.html +1 -1
- package/dist/docs/classes/MouseEvent.html +1 -1
- package/dist/docs/classes/PaperScope.html +88 -1
- package/dist/docs/classes/PaperScript.html +2 -1
- package/dist/docs/classes/Path.html +232 -72
- package/dist/docs/classes/PathItem.html +337 -180
- package/dist/docs/classes/Point.html +143 -21
- package/dist/docs/classes/PointText.html +151 -27
- package/dist/docs/classes/Project.html +201 -8
- package/dist/docs/classes/Raster.html +150 -38
- package/dist/docs/classes/Rectangle.html +12 -11
- package/dist/docs/classes/Segment.html +1 -1
- package/dist/docs/classes/Shape.html +120 -27
- package/dist/docs/classes/Size.html +81 -21
- package/dist/docs/classes/Style.html +35 -3
- package/dist/docs/classes/SymbolDefinition.html +1 -1
- package/dist/docs/classes/SymbolItem.html +121 -28
- package/dist/docs/classes/TextItem.html +151 -27
- package/dist/docs/classes/Tool.html +127 -1
- package/dist/docs/classes/ToolEvent.html +27 -1
- package/dist/docs/classes/Tween.html +1 -1
- package/dist/docs/classes/View.html +345 -10
- package/dist/docs/classes/global.html +1 -1
- package/dist/docs/classes/index.html +2 -2
- package/dist/docs/index.html +1 -1
- package/dist/node/canvas.js +1 -1
- package/dist/node/self.js +4 -3
- package/dist/paper-core.js +1182 -465
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +1210 -481
- package/dist/paper-full.min.js +3 -3
- package/dist/paper-sourced.js +18631 -0
- package/dist/paper.d.ts +606 -78
- package/examples/Rasters/Smoothing.html +1 -1
- package/package.json +6 -17
- package/dist/node/xml.js +0 -40
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,323 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## `0.14.0`
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Add `options.handlers` to `PaperScript.execute()`, to export further global
|
|
8
|
+
handlers next to `onFrame`, `onResize` and the tool's, for hosts that call
|
|
9
|
+
them themselves, such as Scriptographer's `onStop`.
|
|
10
|
+
- Add `Tool#eventInterval`, as Scriptographer had it, to fire `onMouseDrag` again
|
|
11
|
+
at an interval while the mouse button is held, also when the mouse doesn't
|
|
12
|
+
move.
|
|
13
|
+
- Add `Project#scope`, `View#scope`, `Item#scope` and `Tool#scope`, to get from
|
|
14
|
+
each of them to its `PaperScope` (#1634).
|
|
15
|
+
- Add `Group#isolated`, to draw a group or layer through a temporary canvas, so
|
|
16
|
+
that the blend modes of its children, such as `'destination-out'`, only apply
|
|
17
|
+
within it, like CSS's `isolation: isolate` (#474).
|
|
18
|
+
- Add `View#dispatchMouseEvent()` and `View#dispatchKeyEvent()`, to feed mouse
|
|
19
|
+
and key events from hosts without a DOM, such as workers, through the same
|
|
20
|
+
handling as the DOM's events, for tools, items and views.
|
|
21
|
+
- Add `settings.scaleStrokes`, to scale the stroke widths of paths and
|
|
22
|
+
compound paths along with their content when matrices are applied (#2098,
|
|
23
|
+
#1514).
|
|
24
|
+
- Add the `paper-sourced.js` build, in which a project's items can be backed
|
|
25
|
+
by a host document through `Project#source`: items are created as light
|
|
26
|
+
shells from the host's records, and load their content and children from
|
|
27
|
+
the host on first access, so a script costs what it touches. Includes
|
|
28
|
+
`HostItem`, for the host's own kinds of nodes (#2203).
|
|
29
|
+
- Add `Project#trackChanges` and `Project#takeChanges()`, to let hosts that
|
|
30
|
+
keep their own document update only the items that changed, and export
|
|
31
|
+
`ChangeFlag` (#2202).
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- `Path.RegularPolygon()` follows Illustrator: it stands on a flat bottom edge
|
|
36
|
+
for any number of sides, and its segments run counterclockwise from its top
|
|
37
|
+
vertex, or with an even number of sides, from the right end of its top edge.
|
|
38
|
+
This changes the segment order of all regular polygons, and turns those with
|
|
39
|
+
a multiple of 6 sides onto an edge (#1787).
|
|
40
|
+
- Hit-test transparent fills, as in SVG: only items without a fill color are
|
|
41
|
+
not hit through their fill (#1157).
|
|
42
|
+
- `paper.install()` keeps what the target scope has already, such as the
|
|
43
|
+
native `Event`, `MouseEvent` and `Symbol`, and PaperScript doesn't shadow
|
|
44
|
+
existing globals with Paper.js's classes of the same name either (#1832,
|
|
45
|
+
#1652).
|
|
46
|
+
- `Item#importJSON()` into an existing item resets the fields that the JSON
|
|
47
|
+
leaves out, so the item ends up the same as a newly imported one, with its
|
|
48
|
+
place in the scene graph and its event handlers kept (#1425, #1324).
|
|
49
|
+
- Canvases without `resize` get their CSS size from the view on every screen,
|
|
50
|
+
not only at pixel ratios other than 1, where the page's CSS won (#2088).
|
|
51
|
+
- `#hitTestAll()` reports every segment and handle of a path within the
|
|
52
|
+
tolerance, closest first, followed by its stroke or fill hit, instead of only
|
|
53
|
+
the first hit per path (#1294).
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
|
|
57
|
+
- Create the tool in PaperScript for all of its global handlers, also for
|
|
58
|
+
scripts that only define `onActivate()` or `onDeactivate()`, and document
|
|
59
|
+
`Tool#onActivate` and `Tool#onDeactivate`.
|
|
60
|
+
- Keep `Key.modifiers` in sync with the flags of mouse events, so modifier keys
|
|
61
|
+
pressed or released while the page didn't have the focus don't stay wrong
|
|
62
|
+
(#1140).
|
|
63
|
+
- Keep Paper.js's own blend modes, which CSS doesn't have, such as
|
|
64
|
+
`'destination-out'`, through SVG export and import, in a
|
|
65
|
+
`data-paper-blend-mode` attribute (#1296).
|
|
66
|
+
- Throw a clear error when creating an item without a project, instead of a
|
|
67
|
+
null access deep inside the constructor (#1889).
|
|
68
|
+
- Free the pixels of temporary canvases when they're released, which their pool
|
|
69
|
+
kept allocated at their largest size for the life of the page.
|
|
70
|
+
- Keep the size of rasters in JSON, so imported rasters have their size and
|
|
71
|
+
bounds before their image has loaded, or if it fails to load (#1598).
|
|
72
|
+
- Fix the frame timer of workers and Node.js running forever after any script,
|
|
73
|
+
which kept hosts from seeing scripts end.
|
|
74
|
+
- Fix touch scrolling over empty parts of a canvas whose items have mouse
|
|
75
|
+
handlers (#1930).
|
|
76
|
+
- Fix mouse events reaching items and views through elements that cover the
|
|
77
|
+
canvas, such as menus. Drags still reach beyond them (#992).
|
|
78
|
+
- Fix the points of `#hitTestAll()` results of items inside transformed
|
|
79
|
+
groups, which were in the items' own coordinates.
|
|
80
|
+
- Support `strokeScaling: false` on text, exactly for uniform scaling (#1703).
|
|
81
|
+
- Fix the view size of canvases inside elements with CSS transforms, which
|
|
82
|
+
only scale the canvas on screen.
|
|
83
|
+
- Fix italic and oblique font weights in SVG export and import, which SVG
|
|
84
|
+
keeps in `font-style` (#937).
|
|
85
|
+
- Fix `onFrame` in web workers, where views have no element (#2200).
|
|
86
|
+
- Fix `PaperScope#execute()` in web workers (#2201).
|
|
87
|
+
|
|
88
|
+
## `0.13.0`
|
|
89
|
+
|
|
90
|
+
### Added
|
|
91
|
+
|
|
92
|
+
- Add a `force` parameter to `View#update()`, to redraw the view even when
|
|
93
|
+
nothing changed, e.g. after a web font has loaded (#1913).
|
|
94
|
+
- Add `View#fitBounds(rectangle[, fit])`, to fit a rectangle into the view.
|
|
95
|
+
`fit` takes the values of CSS's `object-fit`: `'contain'` and `'cover'`
|
|
96
|
+
(#1688).
|
|
97
|
+
- Add the `reuseImages` option to `#exportSVG()`, to export images shown by
|
|
98
|
+
several rasters only once, and place them with `<use>` elements (#1993).
|
|
99
|
+
- Add `tracking` to the text styles: the space added after each character, in
|
|
100
|
+
thousandths of an em, as in Adobe Illustrator and InDesign. `#exportSVG()` and
|
|
101
|
+
`#importSVG()` write and read it as `letter-spacing` (#2066).
|
|
102
|
+
- Add `easeInSine`, `easeOutSine`, `easeInOutSine`, `easeInExpo`, `easeOutExpo`,
|
|
103
|
+
`easeInOutExpo`, `easeInCirc`, `easeOutCirc` and `easeInOutCirc` to `Tween`
|
|
104
|
+
(#1855).
|
|
105
|
+
- Add the `idPrefix` option to `#exportSVG()`, prepended to the generated ids of
|
|
106
|
+
definitions, so that separately exported SVGs can be placed in one document
|
|
107
|
+
(#1709).
|
|
108
|
+
- Add the `crossOrigin` option to `#importSVG()`, passed on to the rasters of
|
|
109
|
+
`<image>` elements, so that canvases drawing them aren't tainted (#1094).
|
|
110
|
+
- Add `View#project` (#1634).
|
|
111
|
+
- Add `Point#clamp(min, max)`, e.g. to keep a point inside a rectangle with
|
|
112
|
+
`point.clamp(rect.topLeft, rect.bottomRight)`.
|
|
113
|
+
- Use `OffscreenCanvas` in web-workers, so `Item#rasterize()`,
|
|
114
|
+
`new Raster(size)`, items with opacity or blend modes, and CSS color names,
|
|
115
|
+
which resolved to black, work there. `Raster#toDataURL()` remains unsupported
|
|
116
|
+
in web-workers (#1643).
|
|
117
|
+
|
|
118
|
+
### Changed
|
|
119
|
+
|
|
120
|
+
- Time double-clicks from mousedown to mousedown and only within 3 pixels, as
|
|
121
|
+
native `dblclick` events do, and don't take a third click for another
|
|
122
|
+
double-click (#1451).
|
|
123
|
+
- Make `Rectangle#left`, `#right`, `#top` and `#bottom` move only their own
|
|
124
|
+
side, as documented, and the corner points only their two sides, keeping the
|
|
125
|
+
opposite ones where they are. They used to move the whole rectangle, unless
|
|
126
|
+
another side was set before. This also applies to `Item#bounds`: setting a
|
|
127
|
+
side or corner of an item's bounds now stretches the item. To move items,
|
|
128
|
+
set `bounds.point`, `bounds.center`, `bounds.x` or `bounds.y` (#2024, #1147).
|
|
129
|
+
- Hit-test groups wherever one of their children is hit, as in Illustrator, so
|
|
130
|
+
`hitTestAll()` always returns the groups above the hit items, and
|
|
131
|
+
`hitTest(point, { class: Group })` finds the group under a point. Groups were
|
|
132
|
+
only hit when all their children shared a fill (#2069).
|
|
133
|
+
- Let inline `style` declarations override presentation attributes in
|
|
134
|
+
`#importSVG()`, as in CSS and browsers: `<rect fill="blue" style="fill: red">`
|
|
135
|
+
now imports red (#1962).
|
|
136
|
+
- Keep the pixels of images in `#importSVG()` and scale them to their size in
|
|
137
|
+
the SVG, instead of resampling them to that size, which made them blurry.
|
|
138
|
+
`Raster#size` is now the image's own size, and images without a size are
|
|
139
|
+
shown at it, as in browsers (#1963).
|
|
140
|
+
- Let `Item#clone()`, the boolean operations, `Item#rasterize()`,
|
|
141
|
+
`Path#toShape()` and `Shape#toPath()` follow `settings.insertItems` when no
|
|
142
|
+
`insert` option is passed, instead of always inserting their results. An
|
|
143
|
+
options object without `insert` also inserts the clone by default now, as
|
|
144
|
+
documented, e.g. `clone({ deep: false })` (#1721).
|
|
145
|
+
- Use jsdom's own `XMLSerializer` for `#exportSVG()` on Node.js, instead of a
|
|
146
|
+
shim that returned HTML, so the output is valid XML with escaped attribute
|
|
147
|
+
values, as in browsers. Empty elements are now self-closing (#1922).
|
|
148
|
+
- `Item#fitBounds(rectangle[, fit])` takes the values of CSS's `object-fit` as
|
|
149
|
+
`fit`: `'contain'`, `'cover'` and `'fill'`, which stretches the item to the
|
|
150
|
+
rectangle.
|
|
151
|
+
- Scale and align images in `#importSVG()` as their `preserveAspectRatio`
|
|
152
|
+
describes, fitting them into their box uniformly and centered by default, as
|
|
153
|
+
browsers do, instead of stretching them. `slice` is treated as `meet` (#1129).
|
|
154
|
+
- Let `Path#removeSegments(from, to)` wrap around on closed paths when `from` is
|
|
155
|
+
larger than `to`, instead of removing nothing (#1881).
|
|
156
|
+
- Read the `href` of `<image>` elements in `#importSVG()` always as a URL, no
|
|
157
|
+
longer as the id of a DOM element first.
|
|
158
|
+
|
|
159
|
+
### Deprecated
|
|
160
|
+
|
|
161
|
+
- The boolean `fill` parameter of `Item#fitBounds()`: use `'cover'` instead of
|
|
162
|
+
`true`.
|
|
163
|
+
|
|
164
|
+
### Removed
|
|
165
|
+
|
|
166
|
+
- Remove the workaround for wrong `mouseout` coordinates in old versions of
|
|
167
|
+
Chrome on Windows (#1811).
|
|
168
|
+
- Remove the CLA from the contribution guidelines, as it no longer exists
|
|
169
|
+
(#2071).
|
|
170
|
+
|
|
171
|
+
### Fixed
|
|
172
|
+
|
|
173
|
+
- Fix `require('paper')` in the Node.js REPL (#2019, #1792).
|
|
174
|
+
- Fix loading PaperScript in bundles that leave the top-level `this` undefined,
|
|
175
|
+
as in ES modules (#1480).
|
|
176
|
+
- Prevent source-map-loader from warning about the source map string in
|
|
177
|
+
PaperScript (#1991).
|
|
178
|
+
- Fix replacing style colors that were set as strings, which threw in strict
|
|
179
|
+
mode (#2049).
|
|
180
|
+
- Fix SVG path data with arc flags that aren't separated from the numbers
|
|
181
|
+
after them, as SVGO writes them (#1808, #1885).
|
|
182
|
+
- Fix `#importSVG()` of gradients, fills, clip paths and `<use>` elements that
|
|
183
|
+
reference definitions appearing later in the document (#1146, #1884, #1978).
|
|
184
|
+
- Fix `#importSVG()` of elements with numeric ids (#1754).
|
|
185
|
+
- Fix `#importSVG()` of rounded rectangles with only `rx` or `ry` (#1863).
|
|
186
|
+
- Fix `#exportSVG()` writing `fill-rule="none"`, `font-family="none"` etc. on
|
|
187
|
+
groups with differently styled children (#1732).
|
|
188
|
+
- Fix `Curve#handleBounds`, which threw, to only include the curve's own
|
|
189
|
+
points (#1992).
|
|
190
|
+
- Fix `Curve#getTimesWithTangent()` for curves without a cubic component,
|
|
191
|
+
such as quadratic curves (#1870).
|
|
192
|
+
- Fix `Shape` JSON import with `type` after `radius` (#1820).
|
|
193
|
+
- Fix boolean operations with `trace: false` or `stroke: true` ignoring
|
|
194
|
+
`options.insert` (#2028).
|
|
195
|
+
- Fix gradients drawn with `strokeScaling: false` (#1821, #1822).
|
|
196
|
+
- Fix the selection of items in symbol definitions being drawn (#1577).
|
|
197
|
+
- Fix `View#zoom` of mirrored views, which was 0 (#1411).
|
|
198
|
+
- Fix item mouse handlers that stopped working after removing items whose
|
|
199
|
+
parent was already removed, or after moving items to another project
|
|
200
|
+
(#2079, #1791).
|
|
201
|
+
- Fix key events with Control, Alt and Meta in Firefox and other browsers that
|
|
202
|
+
fire no `keypress` for them (#1997, #1871).
|
|
203
|
+
- Fix the space key staying down after Option + Space on macOS.
|
|
204
|
+
- Fix key events not reaching a view that became visible after the focused one
|
|
205
|
+
was hidden (#1953).
|
|
206
|
+
- Load in DOMs whose canvas has no 2D context, as jsdom without canvas in jest,
|
|
207
|
+
and run there as in workers (#1805).
|
|
208
|
+
- Keep the original error as `cause` when jsdom or canvas fail to load on
|
|
209
|
+
Node.js (#1759).
|
|
210
|
+
- Fix `#getItems()` and `#getItem()` with a match function or without options
|
|
211
|
+
to search recursively, as documented, instead of matching only the top-level
|
|
212
|
+
items.
|
|
213
|
+
- Fix `#importSVG()` of transforms and styles on `<use>` elements that
|
|
214
|
+
reference groups (#978).
|
|
215
|
+
- Fix the `project` and `parent` options of the `Path.*` constructors. With
|
|
216
|
+
`insert: false`, they no longer insert into the parent, as `new Path()`
|
|
217
|
+
doesn't either (#2012).
|
|
218
|
+
- Fix the bounds of transformed circle and ellipse shapes (#1826).
|
|
219
|
+
- Fix `PointText#strokeBounds` to include the stroke, which got cut off when
|
|
220
|
+
drawn with opacity (#1322).
|
|
221
|
+
- Fix the `Item#bounds` setter on items with zero width or height, which made
|
|
222
|
+
their matrix non-invertible (#1794).
|
|
223
|
+
- Fix `#getItems()` with `overlapping`, which never matched shapes, rasters and
|
|
224
|
+
texts, as their matrix was applied twice (#1300).
|
|
225
|
+
- Fix the bounds of items whose matrix cancels out the matrix of their parent
|
|
226
|
+
(#1457).
|
|
227
|
+
- Fix the source URL and source map of PaperScript loaded from script tags,
|
|
228
|
+
which were lost (#1753).
|
|
229
|
+
- Fix stroke hit-tests at the ends of paths with butt caps, which missed even
|
|
230
|
+
the end points (#1460).
|
|
231
|
+
- Fix `Path#splitAt()` with locations that aren't on the path, which split
|
|
232
|
+
the path at its start instead of returning `null`.
|
|
233
|
+
- Fix clipping with groups that are clipped themselves, as imported SVG with a
|
|
234
|
+
`viewBox` is, which clipped with their own clip mask too (#1618).
|
|
235
|
+
- Fix `Item#hitTest()` and `#hitTestAll()` on items inside transformed
|
|
236
|
+
groups, which took the point in their parent's coordinates instead of the
|
|
237
|
+
documented global ones (#1803).
|
|
238
|
+
- Ignore `View#zoom` values that aren't positive numbers, which left the
|
|
239
|
+
view's matrix without an inverse, so that `View#bounds` threw (#1433).
|
|
240
|
+
- Fix the hit-test tolerance of items inside transformed groups and of symbol
|
|
241
|
+
items, which their transformations scaled. It is now in project
|
|
242
|
+
coordinates, as documented (#1278).
|
|
243
|
+
- Limit the temporary canvases of items with opacity or blend modes to the
|
|
244
|
+
visible area, so large groups no longer disappear or make zooming slow
|
|
245
|
+
(#1644, #1920, #1925, #2001, #2029).
|
|
246
|
+
- Support SVG 2's plain `href` attribute in `#importSVG()`, besides
|
|
247
|
+
`xlink:href`, for `<use>`, `<image>` and gradient links.
|
|
248
|
+
- Fix `#exportSVG()` of groups used as clip masks, which were exported as
|
|
249
|
+
groups inside `<clipPath>`, where only shapes are allowed, so browsers
|
|
250
|
+
clipped everything away (#1445, #1590).
|
|
251
|
+
- Keep the lines of multi-line text in `#exportSVG()` and `#importSVG()`, as
|
|
252
|
+
`<tspan>` elements at their own baselines (#988).
|
|
253
|
+
- Fix shadows being cut off on items with a fill, a stroke and an opacity,
|
|
254
|
+
which are drawn through a temporary canvas (#1628).
|
|
255
|
+
- Fix `#importSVG()` of `<use>` elements that place images, which weren't
|
|
256
|
+
positioned and sized, as their rasters were cloned before the image loaded.
|
|
257
|
+
- Fix `Item#fitBounds()` and `View#fitBounds()` with empty rectangles or
|
|
258
|
+
items: empty sides no longer collapse items, produce `NaN` coordinates with
|
|
259
|
+
`'cover'`, or make the view throw; they are left out of the scaling.
|
|
260
|
+
- Fix `#importSVG()` of lengths in `in`, `cm`, `mm`, `pt` and `pc`, which were
|
|
261
|
+
read as pixels (#1919).
|
|
262
|
+
- Fix `#importSVG()` of percentages inside nested `<svg>` elements, which
|
|
263
|
+
referred to the size of the root instead of the nearest `<svg>` (#1404).
|
|
264
|
+
- Fix `#importSVG()` on Node.js of shapes without a fill, which were imported
|
|
265
|
+
without one instead of black, as in browsers (#1229).
|
|
266
|
+
- Fix the quadratic time of `#exportSVG()` for groups with many children
|
|
267
|
+
(#1353).
|
|
268
|
+
- Implement the documented `'pin-light'` blend mode, which drew nothing (#1527).
|
|
269
|
+
- Fix clip masks of items with a matrix and an opacity or blend mode, which
|
|
270
|
+
clipped in the wrong place (#1594).
|
|
271
|
+
- Fix rasters and point texts used as clip masks, which clipped with the path
|
|
272
|
+
drawn before them. They now clip with their rectangle and bounds (#1845).
|
|
273
|
+
- Fix the stroke bounds of sheared, mirrored and non-uniformly scaled paths with
|
|
274
|
+
`applyMatrix: false`. The miter limit is now checked in the path's own
|
|
275
|
+
coordinates, as canvas does (#2065).
|
|
276
|
+
- Fix symbol items overwriting the `globalMatrix` of their definition's item,
|
|
277
|
+
which affected its stroke bounds and selection (#1684).
|
|
278
|
+
- Fix the view size of canvases with padding or border, which grew with each
|
|
279
|
+
setup of a project for them (#1160, #2033).
|
|
280
|
+
- Fix setting `View#rotation` on mirrored views, which rotated the other way,
|
|
281
|
+
and on non-uniformly scaled views, which got skewed (#1893).
|
|
282
|
+
- Fix touches outside of the view taking over its drag (#1875).
|
|
283
|
+
- Fix hit-tests of point texts ignoring the tolerance (#632).
|
|
284
|
+
- Fix removed selected items being kept by their project, which leaked memory
|
|
285
|
+
(#1856).
|
|
286
|
+
- Fix the line width of selections, which used whatever line width the view's
|
|
287
|
+
context was left with.
|
|
288
|
+
- Fix hit-tests of symbol items with `class`, `type` and `match` filters, which
|
|
289
|
+
were applied to the definition's items instead (#1774).
|
|
290
|
+
- Leave `workspaces` and `resolutions` out of the published `package.json`,
|
|
291
|
+
which made Yarn warn when installing paper (#1921).
|
|
292
|
+
- Fix stale `Item#globalMatrix` and `#localToGlobal()` results of items whose
|
|
293
|
+
sibling was asked first after their parent was transformed, and of items
|
|
294
|
+
moved to another parent or removed (#1750).
|
|
295
|
+
- Fix the points of mouse and touch events on canvases with padding or border,
|
|
296
|
+
with a CSS size that differs from the view size, or under CSS transforms that
|
|
297
|
+
scale them, which were offset or scaled (#549, #1729).
|
|
298
|
+
- Fix the sign of `Line#getSignedDistance()` for lines whose direction has
|
|
299
|
+
two negative coordinates (#1880).
|
|
300
|
+
- Fix outdated bounds of nested groups after changes to items two or more
|
|
301
|
+
levels down, and of groups containing placed symbols after changes to the
|
|
302
|
+
symbol definition (#940).
|
|
303
|
+
- Docs: Mark the `path` argument of `PathItem#getIntersections()` as optional.
|
|
304
|
+
- Docs: Add `View#onKeyDown`, `View#onKeyUp`, `Point#negate()`,
|
|
305
|
+
`Size#negate()`, `PaperScope#createCanvas()`, `#clear()` and `#remove()`.
|
|
306
|
+
- Docs: Correct the defaults of the hit-test options, the results of the math
|
|
307
|
+
operator examples, `Raster#source` and `Item#guide`, and document
|
|
308
|
+
`Path#reduce()`'s `simplify` option, nullable location getters, optional
|
|
309
|
+
arguments, `ToolEvent#tool`, which items have children, how group styles,
|
|
310
|
+
`getItems()` ordering, `Rectangle#selected` and `Tool#onMouseMove` work, and
|
|
311
|
+
the `resize` canvas attribute (#2078, #2092, #2030, #1928, #1947, #1907,
|
|
312
|
+
#1900, #2115, #1645, #1697, #1747, #1507, #604, #1330, #662).
|
|
313
|
+
- Docs: Add examples to the boolean path operations (#1007).
|
|
314
|
+
- Docs: Document that `new Path(pathData)` holds a single sub-path (#2057).
|
|
315
|
+
- Docs: Document that styles set on symbol items, or inherited by imported
|
|
316
|
+
`<use>` elements, don't reach the symbol definition's items (#1329).
|
|
317
|
+
- Docs: Document using Paper.js with a bundler in the README (#1695).
|
|
318
|
+
- Docs: Move the documentation of `<symbol>` and `<use>` from
|
|
319
|
+
`Project#importJSON()` to `Project#importSVG()`.
|
|
320
|
+
|
|
3
321
|
## `0.12.20`
|
|
4
322
|
|
|
5
323
|
### Fixed
|
package/README.md
CHANGED
|
@@ -33,6 +33,35 @@ Upon execution, you will find a `paper` folder inside the project's
|
|
|
33
33
|
For more information on how to install Node.js and NPM, read the chapter
|
|
34
34
|
[Installing Node.js and NPM](#installing-nodejs-and-npm).
|
|
35
35
|
|
|
36
|
+
### Using Paper.js with a Bundler
|
|
37
|
+
|
|
38
|
+
With a bundler such as webpack, Rollup, esbuild or Vite, import Paper.js and
|
|
39
|
+
set it up with a canvas element:
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
import paper from 'paper'
|
|
43
|
+
// Or, with CommonJS: const paper = require('paper')
|
|
44
|
+
|
|
45
|
+
paper.setup(document.getElementById('canvas'))
|
|
46
|
+
|
|
47
|
+
const { Path } = paper
|
|
48
|
+
const circle = new Path.Circle({
|
|
49
|
+
center: paper.view.center,
|
|
50
|
+
radius: 30,
|
|
51
|
+
fillColor: 'red'
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
paper.view.onFrame = event => {
|
|
55
|
+
circle.rotate(1)
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The module exports the global `paper` scope as its default export, with all
|
|
60
|
+
classes as its properties. Use `paper.view` and `paper.project` after calling
|
|
61
|
+
`paper.setup()`, rather than importing them, as they only exist from then on.
|
|
62
|
+
To use the core version without PaperScript, import `'paper/dist/paper-core'`
|
|
63
|
+
instead. With TypeScript, the default import requires `esModuleInterop`.
|
|
64
|
+
|
|
36
65
|
### Which Version to Use
|
|
37
66
|
|
|
38
67
|
The various distributions come with two different pre-build versions of
|
|
@@ -172,16 +201,14 @@ Paper.js uses [Gulp.js](https://gulpjs.com/) for building, and has a couple of
|
|
|
172
201
|
dependencies as NPM modules. Read the chapter [Installing Node.js and
|
|
173
202
|
NPM](#installing-nodejs-and-npm) if you still need to install these.
|
|
174
203
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
needs to be installed now. See
|
|
178
|
-
[Installing Yarn](https://classic.yarnpkg.com/en/docs/install/) for details.
|
|
204
|
+
Development uses [pnpm](https://pnpm.io/), which needs to be installed too. See
|
|
205
|
+
[Installing pnpm](https://pnpm.io/installation) for details.
|
|
179
206
|
|
|
180
207
|
In order to be able to build Paper.js, after checking out the repository, paper
|
|
181
208
|
has dependencies that need to be installed. Install them by issuing the
|
|
182
209
|
following commands from the Paper.js directory:
|
|
183
210
|
|
|
184
|
-
|
|
211
|
+
pnpm install
|
|
185
212
|
|
|
186
213
|
### Building the Library
|
|
187
214
|
|
|
@@ -189,7 +216,7 @@ The Paper.js sources are distributed across many separate files, organised in
|
|
|
189
216
|
subfolders inside the `src` folder. To compile them all into distributable
|
|
190
217
|
files, you can run the `build` task:
|
|
191
218
|
|
|
192
|
-
|
|
219
|
+
pnpm build
|
|
193
220
|
|
|
194
221
|
You will then find the built library files inside the `dist` folder, named
|
|
195
222
|
`paper-full.js` and `paper-core.js`, along with their minified versions. Read
|
|
@@ -207,11 +234,11 @@ library.
|
|
|
207
234
|
This means you can switch between loading from sources and loading a built
|
|
208
235
|
library simply by running.
|
|
209
236
|
|
|
210
|
-
|
|
237
|
+
pnpm load
|
|
211
238
|
|
|
212
239
|
And to go back to a built library
|
|
213
240
|
|
|
214
|
-
|
|
241
|
+
pnpm build
|
|
215
242
|
|
|
216
243
|
Note that your PaperScripts examples do not need to change, they can keep
|
|
217
244
|
loading `dist/paper-full.js`, which will always do the right thing. Note also
|
|
@@ -221,7 +248,7 @@ that `src/load.js` handles both browsers and Node.js, as supported by Prepro.js.
|
|
|
221
248
|
|
|
222
249
|
Create a final zipped distribution file inside the `dist` folder:
|
|
223
250
|
|
|
224
|
-
|
|
251
|
+
pnpm dist
|
|
225
252
|
|
|
226
253
|
### Branch structure
|
|
227
254
|
|
|
@@ -232,7 +259,7 @@ only merged into [`main`](https://github.com/paperjs/paper.js/tree/main)
|
|
|
232
259
|
when a new release occurs.
|
|
233
260
|
|
|
234
261
|
As of version `0.9.26`, the `dist` folder is excluded on all branches, and the
|
|
235
|
-
building is now part of the `
|
|
262
|
+
building is now part of the `pnpm publish` process by way of the `prepublish`
|
|
236
263
|
script.
|
|
237
264
|
|
|
238
265
|
We also offer prebuilt versions of the latest state of the `develop` branch on
|
|
@@ -244,7 +271,7 @@ and [`prebuilt/dist`](https://github.com/paperjs/paper.js/tree/prebuilt/dist).
|
|
|
244
271
|
Similarly to building the library, you can run the `docs` task to build the
|
|
245
272
|
documentation:
|
|
246
273
|
|
|
247
|
-
|
|
274
|
+
pnpm docs
|
|
248
275
|
|
|
249
276
|
Your docs will then be located at `dist/docs`.
|
|
250
277
|
|
|
@@ -262,11 +289,16 @@ CORS restrictions. In order to run the browser based tests on Chrome, you need
|
|
|
262
289
|
to run a local web-server through Gulp.js. The following command will handle it
|
|
263
290
|
for you, and will also open the browser at the right address straight away:
|
|
264
291
|
|
|
265
|
-
|
|
292
|
+
pnpm test:browser
|
|
293
|
+
|
|
294
|
+
To run them in headless Chrome instead, as CI does, and report the result in the
|
|
295
|
+
terminal:
|
|
296
|
+
|
|
297
|
+
pnpm test:chrome
|
|
266
298
|
|
|
267
299
|
To test the Node.js version of Paper.js, use this command:
|
|
268
300
|
|
|
269
|
-
|
|
301
|
+
pnpm test
|
|
270
302
|
|
|
271
303
|
### Contributing [](https://www.codetriage.com/paperjs/paper.js)
|
|
272
304
|
|
|
@@ -277,7 +309,6 @@ of the repository in which you perform development. See
|
|
|
277
309
|
We prefer that you send a
|
|
278
310
|
[pull request on GitHub](https://help.github.com/articles/about-pull-requests/)
|
|
279
311
|
which will then be merged into the official main line repository.
|
|
280
|
-
You need to sign the Paper.js CLA to be able to contribute (see below).
|
|
281
312
|
|
|
282
313
|
Also, in your first contribution, add yourself to the end of `AUTHORS.md` (which
|
|
283
314
|
of course is optional).
|
|
@@ -340,18 +371,6 @@ starting point and reference. If you are fixing an issue, a convenient way to
|
|
|
340
371
|
name the branch is to use the issue number as a prefix, like this: `git checkout
|
|
341
372
|
-tb issue-937-feature-add-text-styling`.
|
|
342
373
|
|
|
343
|
-
#### Contributor License Agreement
|
|
344
|
-
|
|
345
|
-
Before we can accept any contributions to Paper.js, you need to sign this
|
|
346
|
-
[CLA](https://en.wikipedia.org/wiki/Contributor_License_Agreement):
|
|
347
|
-
|
|
348
|
-
[Contributor License Agreement](https://spreadsheets.google.com/a/paperjs.org/spreadsheet/embeddedform?formkey=dENxd0JBVDY2REo3THVuRmh4YjdWRlE6MQ)
|
|
349
|
-
|
|
350
|
-
> The purpose of this agreement is to clearly define the terms under which
|
|
351
|
-
> intellectual property has been contributed to Paper.js and thereby allow us to
|
|
352
|
-
> defend the project should there be a legal dispute regarding the software at
|
|
353
|
-
> some future time.
|
|
354
|
-
|
|
355
374
|
For a list of authors and contributors, please see
|
|
356
375
|
[AUTHORS](https://github.com/paperjs/paper.js/blob/main/AUTHORS.md).
|
|
357
376
|
|