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.
- package/CHANGELOG.md +337 -0
- package/README.md +19 -14
- package/dist/docs/assets/js/paper.js +7351 -1706
- package/dist/docs/classes/AreaText.html +8658 -0
- package/dist/docs/classes/ChangeFlag.html +385 -0
- package/dist/docs/classes/Color.html +2 -1
- package/dist/docs/classes/CompoundPath.html +208 -69
- package/dist/docs/classes/Curve.html +2 -1
- package/dist/docs/classes/CurveLocation.html +2 -1
- package/dist/docs/classes/Event.html +5 -4
- package/dist/docs/classes/Gradient.html +2 -1
- package/dist/docs/classes/GradientStop.html +2 -1
- package/dist/docs/classes/Group.html +204 -17
- package/dist/docs/classes/HitResult.html +4 -2
- package/dist/docs/classes/HostItem.html +6786 -0
- package/dist/docs/classes/Item.html +193 -17
- package/dist/docs/classes/Key.html +2 -1
- package/dist/docs/classes/KeyEvent.html +5 -4
- package/dist/docs/classes/Layer.html +201 -17
- package/dist/docs/classes/Matrix.html +2 -1
- package/dist/docs/classes/MouseEvent.html +5 -4
- package/dist/docs/classes/PaperScope.html +5 -2
- package/dist/docs/classes/PaperScript.html +6 -2
- package/dist/docs/classes/Path.html +183 -70
- package/dist/docs/classes/PathItem.html +326 -187
- package/dist/docs/classes/PathText.html +8528 -0
- package/dist/docs/classes/Point.html +13 -2
- package/dist/docs/classes/PointText.html +1404 -63
- package/dist/docs/classes/Project.html +221 -1
- package/dist/docs/classes/Raster.html +136 -17
- package/dist/docs/classes/Rectangle.html +3 -2
- package/dist/docs/classes/Segment.html +2 -1
- package/dist/docs/classes/Shape.html +136 -17
- package/dist/docs/classes/Size.html +4 -2
- package/dist/docs/classes/Style.html +768 -15
- package/dist/docs/classes/SymbolDefinition.html +2 -1
- package/dist/docs/classes/SymbolItem.html +136 -17
- package/dist/docs/classes/TextItem.html +1566 -222
- package/dist/docs/classes/TextRange.html +186 -0
- package/dist/docs/classes/TextStory.html +355 -0
- package/dist/docs/classes/Tool.html +127 -1
- package/dist/docs/classes/ToolEvent.html +57 -4
- package/dist/docs/classes/Tween.html +17 -1
- package/dist/docs/classes/View.html +148 -5
- package/dist/docs/classes/global.html +2 -1
- package/dist/docs/classes/index.html +2 -2
- package/dist/docs/index.html +1 -1
- package/dist/paper-core.js +7160 -1663
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +7351 -1706
- package/dist/paper-full.min.js +3 -3
- package/dist/paper-hosted.js +24058 -0
- package/dist/paper.d.ts +1996 -155
- package/examples/Scripts/AreaText.html +65 -0
- package/examples/Scripts/PathText.html +48 -0
- package/examples/Scripts/TextRanges.html +51 -0
- package/package.json +8 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,342 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## `0.15.0`
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Load text items from the host of a hosted project, see `Project#host`, with
|
|
8
|
+
their stories, and the paths and settings of path and area text, and let
|
|
9
|
+
hosts lay them out as their documents do, through `host.layOut()`, given
|
|
10
|
+
their JSON as the script holds them, also before the host has its changes,
|
|
11
|
+
or `null` for text the script didn't change, which the host has as it is.
|
|
12
|
+
- Add text ranges: `TextRange`, a part of a text whose style properties read
|
|
13
|
+
what its letters and paragraphs share and set them, from
|
|
14
|
+
`TextItem#range(start, end)`, `#runs`, `#paragraphs`, `#words`, `#letters`
|
|
15
|
+
and `#lines`, which ranges have too, and `#replace(content, start, end)`, and
|
|
16
|
+
`TextStory`, a text's content, runs and paragraphs, as `TextItem#story`.
|
|
17
|
+
- Add text linking: `TextItem#link()`, `#unlink()`, `#isLinked()`,
|
|
18
|
+
`#nextTextItem`, `#previousTextItem` and `#visibleRange`, by which a story
|
|
19
|
+
flows through several text items, which `TextStory#textItems` lists.
|
|
20
|
+
- Add `PathText`, text along a path between `startOffset` and `endOffset`, each
|
|
21
|
+
letter turned to the path, which it takes as `TextItem#textPath`.
|
|
22
|
+
- Add `AreaText`, text inside any path as its `textPath`, holes too, in
|
|
23
|
+
columns and rows, with lines breaking between words and at soft hyphens,
|
|
24
|
+
`verticalAlign`, `fitHeight()`, and `lineWrap`, a paragraph property that
|
|
25
|
+
balances the lines.
|
|
26
|
+
- Add `Item#textWrap`, by which items push aside the text of the area texts
|
|
27
|
+
below them in their layer, or let it flow inside them.
|
|
28
|
+
- Export area text, text on paths and text with mixed styles to SVG: point text
|
|
29
|
+
keeps a `<tspan>` per line, with one per run where styles are mixed, and area
|
|
30
|
+
text and text on paths are placed piece by piece, as they are laid out.
|
|
31
|
+
- Add character style properties: `fontStyle`, `lineHeight`, `letterKerning`,
|
|
32
|
+
`letterScaling`, `letterRotation`, `baselineShift`, `baselinePosition`,
|
|
33
|
+
`capitals`, `underline` and `strikethrough`, and `fontVariations` and
|
|
34
|
+
`features` for hosts.
|
|
35
|
+
- Add paragraph style properties: `justifyLast`, `startIndent`, `endIndent`,
|
|
36
|
+
`firstLineIndent`, `spaceBefore`, `spaceAfter` and `direction`, the
|
|
37
|
+
justifications `'start'`, `'end'` and `'justify'`, and `justifySpacing`,
|
|
38
|
+
`hyphenation`, `composer` and `tabs` for hosts.
|
|
39
|
+
- Let `Item#strokeBounds` be selected and set, as `Item#bounds` can:
|
|
40
|
+
`item.strokeBounds.selected` draws the stroke bounds and their handles,
|
|
41
|
+
independently of `item.bounds.selected`, and setting them scales the item so
|
|
42
|
+
its stroke bounds match, also where its stroke's extent changes with its
|
|
43
|
+
proportions, as with miters (#1030).
|
|
44
|
+
- Import the `data-*` attributes of SVG elements into `item.data`, with their
|
|
45
|
+
names camelized as in `dataset`, next to `data-paper-data` (#1227).
|
|
46
|
+
- Export shadows to SVG as SVG 1.1 filters, which both browsers and editors
|
|
47
|
+
such as Illustrator render, except for items without width or height, and
|
|
48
|
+
import them back, along with CSS `drop-shadow()` (#1003).
|
|
49
|
+
- Import SVG masks as clip masks, which is exact for masks of solid white
|
|
50
|
+
shapes, or of opaque shapes with `mask-type="alpha"`, and warns that other
|
|
51
|
+
masks are approximated (#1916).
|
|
52
|
+
- Add `Group#ungroup()`, which replaces a group with its children, applying its
|
|
53
|
+
matrix to them, and let `Item#replaceWith()` take several items (#1026).
|
|
54
|
+
- Add `settings.segmentSize`, the size of the segments when drawing selections,
|
|
55
|
+
next to `settings.handleSize` for their handles, which it defaults to
|
|
56
|
+
(#1899).
|
|
57
|
+
- Add `angleInRadians` to the object literals that create points, next to
|
|
58
|
+
`angle`, e.g. `new Point({ length: 10, angleInRadians: Math.PI / 2 })` (#562).
|
|
59
|
+
- Add `Project#hasChanges()`, which tells whether changes were logged since the
|
|
60
|
+
last `Project#takeChanges()`, without taking them.
|
|
61
|
+
- Add dynamic `import(specifier)` to PaperScript, which resolves to the module's
|
|
62
|
+
namespace through the loader in `options.load`, which may return a Promise.
|
|
63
|
+
- Add static `import` to PaperScript, through a loader that hosts pass as
|
|
64
|
+
`options.load` to `PaperScript.execute()`, together with `export … from`. It
|
|
65
|
+
needs a current Acorn as `self.acorn`.
|
|
66
|
+
- Add `Item.getBounds(items[, options])`, the bounds of a list of items in
|
|
67
|
+
project coordinates as if they were grouped, e.g. of the selection (#2252).
|
|
68
|
+
- Add `ToolEvent#velocity` and `#elapsed`, the velocity of the mouse since the
|
|
69
|
+
last tool event in points per second, and the time since then in seconds,
|
|
70
|
+
which stay even when the system misses a mouse report.
|
|
71
|
+
- Add `Event#time`, the time of the event in seconds, as frame events have it,
|
|
72
|
+
and `options.time` to `View#dispatchMouseEvent()` and `#dispatchKeyEvent()`.
|
|
73
|
+
- Add a setter to `View#bounds`, which fits the view to the given rectangle, as
|
|
74
|
+
`View#fitBounds()` does.
|
|
75
|
+
- Let `PathItem#unite()`, `#intersect()`, `#subtract()` and `#exclude()` take
|
|
76
|
+
an array of paths, which they combine in one call: unite, intersect and
|
|
77
|
+
subtract in a balanced tree, exclude in one even-odd pass. Uniting 500 paths
|
|
78
|
+
takes 0.22 s instead of 2.9 s chained, excluding them 0.45 s instead of
|
|
79
|
+
minutes (#2094, #2303, #2304).
|
|
80
|
+
- Load hosted text that the host links into one story, which `host.getStory()`
|
|
81
|
+
gives once for all of its items, whichever of them loads first.
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
|
|
85
|
+
- Lay out text by the ascent and descent of its fonts: the bounds of
|
|
86
|
+
`PointText` are its lines' line heights, with the leading split around their
|
|
87
|
+
ascent and descent, instead of 3/4 of the first above its baseline and 1/4 of
|
|
88
|
+
the last below.
|
|
89
|
+
- Replace `leading` by `lineHeight`, `'auto'` (1.2) or another factor of the
|
|
90
|
+
font size, or a fixed length; `leading` still sets and reads a fixed line
|
|
91
|
+
height in pixels. Rename `tracking` to `letterTracking`, which `tracking`
|
|
92
|
+
still sets and reads.
|
|
93
|
+
- Make `Style#getFontStyle()` return the CSS font style, `'normal'`,
|
|
94
|
+
`'italic'` or `'oblique'`, instead of the font as canvas takes it, and remove
|
|
95
|
+
`Style#getTrackingStyle()`.
|
|
96
|
+
- Only go into the children that items show in `Item#getItems()`, and log the
|
|
97
|
+
changes of children that their parent doesn't show, such as a text's path, as
|
|
98
|
+
the parent's.
|
|
99
|
+
- Make `Item#intersects()` check whether the items overlap, also when one
|
|
100
|
+
contains the other, as `Rectangle#intersects()` does, instead of only whether
|
|
101
|
+
their outlines cross, and use it in `getItems({ overlapping })` for items
|
|
102
|
+
whose bounds contain the rectangle (#1751).
|
|
103
|
+
- Use `settings.hitTolerance` for the mouse events of items, such as
|
|
104
|
+
`mouseenter` and `click`, which always hit-tested with a tolerance of 0
|
|
105
|
+
(#1971).
|
|
106
|
+
- Keep the named exports of PaperScript modules with a default export:
|
|
107
|
+
`export default x` now sets `module.exports.default` instead of replacing the
|
|
108
|
+
exports, and such modules are marked with `__esModule`. `import x` receives
|
|
109
|
+
the default export, or the whole exports of CommonJS-style modules, and
|
|
110
|
+
`import * as m` all exports, with CommonJS-style ones also as `m.default`.
|
|
111
|
+
So `PaperScript.execute()` returns `{ default: x }` for `export default x`.
|
|
112
|
+
- Deprecate `Event#timeStamp` in milliseconds, and the `options.timeStamp` of
|
|
113
|
+
`View#dispatchMouseEvent()` and `#dispatchKeyEvent()`, for the new `time`
|
|
114
|
+
in seconds.
|
|
115
|
+
- Rename the `paper-sourced.js` build to `paper-hosted.js`, and `Project#source`
|
|
116
|
+
to `Project#host`, to match `HostItem` and the host document that backs the
|
|
117
|
+
items.
|
|
118
|
+
- Draw dashes with `setLineDash()`, which every canvas supports, and remove
|
|
119
|
+
the dash emulation for canvases without it, along with the undocumented
|
|
120
|
+
`paper.support.nativeDash` (#2350).
|
|
121
|
+
- Trace the results of boolean operations through a planar graph of the
|
|
122
|
+
operands' curves, which each operation builds within one geometric
|
|
123
|
+
tolerance: intersections within it merge into one vertex, curves that pass
|
|
124
|
+
within it of a vertex are cut there, and coincident curves become one edge.
|
|
125
|
+
Results are correct to within about five times that tolerance, under a
|
|
126
|
+
thousandth of a unit on a drawing of 1,000 units, and stable under tiny
|
|
127
|
+
moves of the operands. They can differ from before in where their contours
|
|
128
|
+
start and how they are divided, but not in their areas. Holes come out
|
|
129
|
+
oriented opposite to their outlines, and islands like outlines (#2292).
|
|
130
|
+
- `PathItem#resolveCrossings()` returns the filled outline of a path, without
|
|
131
|
+
the inner loops that its fill rule covers (#2292).
|
|
132
|
+
- Make boolean operations faster than in 0.14.0 on all inputs measured, from
|
|
133
|
+
about 15% on small operations up to 5.7× on large polygons (#2293, #2296,
|
|
134
|
+
#2297, #2299, #2300, #2301, #2302, #2305).
|
|
135
|
+
- Draw the CSS blend modes as `'normal'` in old browsers whose canvas doesn't
|
|
136
|
+
support them, such as Internet Explorer and the old Edge, instead of
|
|
137
|
+
emulating them pixel by pixel. Paper.js's own modes, such as `'add'`, are
|
|
138
|
+
still emulated (#2350).
|
|
139
|
+
- Remove the undocumented statics `Curve.getBounds(values)`, a leftover of
|
|
140
|
+
old intersection code, and `Curve.getCurveLineIntersections()`, which
|
|
141
|
+
nothing in the library calls.
|
|
142
|
+
- Drop the code for browsers without current DOM APIs, which only old IE, Edge
|
|
143
|
+
and WebKit needed: MS pointer events, `srcElement`, `toElement`,
|
|
144
|
+
`keyIdentifier`, `backingStorePixelRatio`, and the exception of
|
|
145
|
+
`getBoundingClientRect()` for nodes outside the DOM (#2350).
|
|
146
|
+
|
|
147
|
+
### Fixed
|
|
148
|
+
|
|
149
|
+
- Hit-test strokes with `'miter'` and `'bevel'` joins next to smooth segments,
|
|
150
|
+
which are joined round, as the stroke bounds already treat them (#2342).
|
|
151
|
+
- Update `Item#strokeBounds` after changing the stroke of items without a
|
|
152
|
+
parent, such as shapes, texts, symbol items and groups, which kept the old
|
|
153
|
+
stroke bounds (#2343).
|
|
154
|
+
- Fix `Path#handleBounds` of empty paths, which were infinite: they are an
|
|
155
|
+
empty rectangle, as their `bounds` (#2345).
|
|
156
|
+
- Import the paragraphs of text items after their content, also from JSON that
|
|
157
|
+
lists them first, as JSON written by other tools may.
|
|
158
|
+
- Keep gradients in the runs of text items through `#exportJSON()` and
|
|
159
|
+
`#importJSON()`, and round their style values and those of their paragraphs
|
|
160
|
+
to the `precision` of the export (#2348).
|
|
161
|
+
- Keep what scripts write to hosted items before they load, such as their
|
|
162
|
+
`pivot` or an area text's `columns`, which loading replaced.
|
|
163
|
+
- Fix the stroke bounds of non-scaling strokes under non-uniform matrices,
|
|
164
|
+
whose miters, bevels and square caps followed the untransformed angles.
|
|
165
|
+
- Fix `Item#strokeBounds` after scaling items that apply their matrix, such
|
|
166
|
+
as paths and groups, when they were read before: the cached stroke bounds
|
|
167
|
+
were scaled along, including the width of the stroke, which doesn't scale.
|
|
168
|
+
- Fix SVG export of `opacity` and `blendMode`, which aren't inherited, so
|
|
169
|
+
children with the same values as their group lost them, and the defaults
|
|
170
|
+
were written where the group differed.
|
|
171
|
+
- Fix the shadows of items that are both filled and stroked, which only cast
|
|
172
|
+
the shadow of their fill, partly covered by the stroke (#892).
|
|
173
|
+
- Fix the shadows of text items, which only text with both a fill and a
|
|
174
|
+
stroke drew (#2347).
|
|
175
|
+
- Fix the points at offsets of `PathFlattener` on straight curves, such as
|
|
176
|
+
lines without handles, whose curve-time doesn't follow their length, which
|
|
177
|
+
placed them off everywhere but at the ends.
|
|
178
|
+
- Fix SVG import of `<use>` elements, which now pass their styles and those of
|
|
179
|
+
their parents on to the referenced element, as in SVG, instead of the styles
|
|
180
|
+
of the place where it is defined, and skip circular references (#2090).
|
|
181
|
+
- Divide the operands of boolean operations at all their intersections, also
|
|
182
|
+
where they only touch, which makes the results of near-coincident geometry
|
|
183
|
+
more stable, and ends the endless loop of #1849.
|
|
184
|
+
- Fix `Curve#getTimeOf()` for points near the ends of straight curves, which it
|
|
185
|
+
solved to times far from the ends, as it only tested the ends exactly.
|
|
186
|
+
- Fix boolean operations that backtracked while tracing their result, which could
|
|
187
|
+
give a curve of it the handle of a dead end and make it bulge.
|
|
188
|
+
- Measure text in views without a canvas of their own, such as in workers, with a
|
|
189
|
+
canvas from `CanvasProvider`, e.g. an `OffscreenCanvas`, so `PointText` has
|
|
190
|
+
bounds there too.
|
|
191
|
+
- Fix PaperScript's exported variable declarations without semicolons, such as
|
|
192
|
+
`export const a = 1`, which compiled to invalid code.
|
|
193
|
+
- Fix `Curve#classify()` reporting points of inflection, cusps and loops at the
|
|
194
|
+
very ends of curves, which made boolean operations miss crossings at those
|
|
195
|
+
vertices (#1879, #1387).
|
|
196
|
+
- Fix PaperScript's compound assignments of properties, such as
|
|
197
|
+
`array[index()] += 1`, which evaluated their object and key twice.
|
|
198
|
+
- Fix PaperScript with a current Acorn provided as `self.acorn`, which parses
|
|
199
|
+
all current syntax now, and its exports: of functions and classes, of renamed
|
|
200
|
+
names (`export { a as b }`), of several declarations in a row, and of
|
|
201
|
+
variables, which stay usable in the script itself.
|
|
202
|
+
- Fix intersections of curves and lines at the curves' ends, which were lost
|
|
203
|
+
when the curve touched the line there, e.g. at a zero-length handle (#1848).
|
|
204
|
+
- Fix the orientation of the results of `PathItem#exclude()` and
|
|
205
|
+
`#subtract()`, whose parts of the second path kept its reversed orientation,
|
|
206
|
+
giving them negative areas (#2064).
|
|
207
|
+
- Fix `PathItem#interiorPoint` returning points on the path itself, such as a
|
|
208
|
+
vertex shared with another path, which made boolean operations of paths that
|
|
209
|
+
only touch keep or drop the wrong parts (#1837, #1979).
|
|
210
|
+
- Fix intersections and boolean operations of curves and paths that only touch,
|
|
211
|
+
at coordinates beyond 16384, where the tolerance of their bounds checks got
|
|
212
|
+
lost in floating point (#1940, #1882).
|
|
213
|
+
- Fix boolean operations on open paths that end where they start, which lost
|
|
214
|
+
the curve between their ends (#1929, #1973, #1989, #2018).
|
|
215
|
+
- Fix boolean operations with `{ trace: false }` on closed paths, which could
|
|
216
|
+
keep or drop the wrong parts depending on where the path started, and on
|
|
217
|
+
compound paths, which threw an error (#1540, #1541, #1746, #1998, #2046).
|
|
218
|
+
- Document `Item#fullySelected`, which all items have, not only paths (#1687).
|
|
219
|
+
- Type options objects from their documented options, such as those of
|
|
220
|
+
`Item#hitTest()`, `#exportSVG()` and `#rasterize()`, so misspelled options are
|
|
221
|
+
errors in TypeScript (#1666).
|
|
222
|
+
- Type the setters of point, size, rectangle and color properties with the
|
|
223
|
+
values they accept, such as `item.position = [10, 20]` and
|
|
224
|
+
`item.fillColor = 'red'`. The typings now need TypeScript 4.3 (#1665).
|
|
225
|
+
- Handle the mouse events of `View#dispatchMouseEvent()` also outside the
|
|
226
|
+
view's bounds, since the host decides which events belong to its drawing
|
|
227
|
+
surface.
|
|
228
|
+
- Fix boolean operations on paths that touch or overlap along their edges,
|
|
229
|
+
run close to each other, or cross near their vertices, which lost or added
|
|
230
|
+
parts of their results (#1285, #1362, #1867, #1917, #1943, #1961, #2002,
|
|
231
|
+
#2036, #2096, #2099).
|
|
232
|
+
- Fix `PathItem#resolveCrossings()` on paths with both overlaps and crossings,
|
|
233
|
+
which lost parts of their outlines (#2290).
|
|
234
|
+
- Fix `Curve.getTimeOf()` at coordinates beyond about 2e8, where it didn't
|
|
235
|
+
recognize points on the curve (#2291).
|
|
236
|
+
- Hit-test non-scaling strokes under non-uniform matrices where they're drawn,
|
|
237
|
+
also next to corners, joins and caps, and with skewed or rotated matrices
|
|
238
|
+
(#2334).
|
|
239
|
+
- Fix `Curve#strokeBounds` of curves without a path, which threw: without a
|
|
240
|
+
path, there is no stroke, so they are the curve's bounds (#2344).
|
|
241
|
+
- Give `View#dispatchKeyEvent()` the characters of space, enter and tab, as the
|
|
242
|
+
DOM's key events have them, instead of empty ones (#2346).
|
|
243
|
+
- Fix `paper.support.nativeBlendModes`, which listed the blend modes canvas
|
|
244
|
+
accepted as `170` instead of `true`, and only knew the CSS blend modes where
|
|
245
|
+
a canvas was available when Paper.js loaded. It lists the canvas composite
|
|
246
|
+
modes and the CSS blend modes as native, and Paper.js's own modes as not,
|
|
247
|
+
without testing canvas (#2349).
|
|
248
|
+
- Hit-test strokes at segments where the curves meet in the same direction,
|
|
249
|
+
such as where a line runs into a curve, whatever the join, also across
|
|
250
|
+
curves without length, as in rectangles rounded to half their height.
|
|
251
|
+
- Calculate `Curve#getTimesWithTangent()`, `#length` and `Curve.getPeaks()`
|
|
252
|
+
precisely also far from the origin, from the curve's polynomial
|
|
253
|
+
coefficients, which take the differences of the points first.
|
|
254
|
+
|
|
255
|
+
## `0.14.0`
|
|
256
|
+
|
|
257
|
+
### Added
|
|
258
|
+
|
|
259
|
+
- Add `options.handlers` to `PaperScript.execute()`, to export further global
|
|
260
|
+
handlers next to `onFrame`, `onResize` and the tool's, for hosts that call
|
|
261
|
+
them themselves, such as Scriptographer's `onStop`.
|
|
262
|
+
- Add `Tool#eventInterval`, as Scriptographer had it, to fire `onMouseDrag` again
|
|
263
|
+
at an interval while the mouse button is held, also when the mouse doesn't
|
|
264
|
+
move.
|
|
265
|
+
- Add `Project#scope`, `View#scope`, `Item#scope` and `Tool#scope`, to get from
|
|
266
|
+
each of them to its `PaperScope` (#1634).
|
|
267
|
+
- Add `Group#isolated`, to draw a group or layer through a temporary canvas, so
|
|
268
|
+
that the blend modes of its children, such as `'destination-out'`, only apply
|
|
269
|
+
within it, like CSS's `isolation: isolate` (#474).
|
|
270
|
+
- Add `View#dispatchMouseEvent()` and `View#dispatchKeyEvent()`, to feed mouse
|
|
271
|
+
and key events from hosts without a DOM, such as workers, through the same
|
|
272
|
+
handling as the DOM's events, for tools, items and views.
|
|
273
|
+
- Add `settings.scaleStrokes`, to scale the stroke widths of paths and
|
|
274
|
+
compound paths along with their content when matrices are applied (#2098,
|
|
275
|
+
#1514).
|
|
276
|
+
- Add the `paper-sourced.js` build, in which a project's items can be backed
|
|
277
|
+
by a host document through `Project#source`: items are created as light
|
|
278
|
+
shells from the host's records, and load their content and children from
|
|
279
|
+
the host on first access, so a script costs what it touches. Includes
|
|
280
|
+
`HostItem`, for the host's own kinds of nodes (#2203).
|
|
281
|
+
- Add `Project#trackChanges` and `Project#takeChanges()`, to let hosts that
|
|
282
|
+
keep their own document update only the items that changed, and export
|
|
283
|
+
`ChangeFlag` (#2202).
|
|
284
|
+
|
|
285
|
+
### Changed
|
|
286
|
+
|
|
287
|
+
- `Path.RegularPolygon()` follows Illustrator: it stands on a flat bottom edge
|
|
288
|
+
for any number of sides, and its segments run counterclockwise from its top
|
|
289
|
+
vertex, or with an even number of sides, from the right end of its top edge.
|
|
290
|
+
This changes the segment order of all regular polygons, and turns those with
|
|
291
|
+
a multiple of 6 sides onto an edge (#1787).
|
|
292
|
+
- Hit-test transparent fills, as in SVG: only items without a fill color are
|
|
293
|
+
not hit through their fill (#1157).
|
|
294
|
+
- `paper.install()` keeps what the target scope has already, such as the
|
|
295
|
+
native `Event`, `MouseEvent` and `Symbol`, and PaperScript doesn't shadow
|
|
296
|
+
existing globals with Paper.js's classes of the same name either (#1832,
|
|
297
|
+
#1652).
|
|
298
|
+
- `Item#importJSON()` into an existing item resets the fields that the JSON
|
|
299
|
+
leaves out, so the item ends up the same as a newly imported one, with its
|
|
300
|
+
place in the scene graph and its event handlers kept (#1425, #1324).
|
|
301
|
+
- Canvases without `resize` get their CSS size from the view on every screen,
|
|
302
|
+
not only at pixel ratios other than 1, where the page's CSS won (#2088).
|
|
303
|
+
- `#hitTestAll()` reports every segment and handle of a path within the
|
|
304
|
+
tolerance, closest first, followed by its stroke or fill hit, instead of only
|
|
305
|
+
the first hit per path (#1294).
|
|
306
|
+
|
|
307
|
+
### Fixed
|
|
308
|
+
|
|
309
|
+
- Create the tool in PaperScript for all of its global handlers, also for
|
|
310
|
+
scripts that only define `onActivate()` or `onDeactivate()`, and document
|
|
311
|
+
`Tool#onActivate` and `Tool#onDeactivate`.
|
|
312
|
+
- Keep `Key.modifiers` in sync with the flags of mouse events, so modifier keys
|
|
313
|
+
pressed or released while the page didn't have the focus don't stay wrong
|
|
314
|
+
(#1140).
|
|
315
|
+
- Keep Paper.js's own blend modes, which CSS doesn't have, such as
|
|
316
|
+
`'destination-out'`, through SVG export and import, in a
|
|
317
|
+
`data-paper-blend-mode` attribute (#1296).
|
|
318
|
+
- Throw a clear error when creating an item without a project, instead of a
|
|
319
|
+
null access deep inside the constructor (#1889).
|
|
320
|
+
- Free the pixels of temporary canvases when they're released, which their pool
|
|
321
|
+
kept allocated at their largest size for the life of the page.
|
|
322
|
+
- Keep the size of rasters in JSON, so imported rasters have their size and
|
|
323
|
+
bounds before their image has loaded, or if it fails to load (#1598).
|
|
324
|
+
- Fix the frame timer of workers and Node.js running forever after any script,
|
|
325
|
+
which kept hosts from seeing scripts end.
|
|
326
|
+
- Fix touch scrolling over empty parts of a canvas whose items have mouse
|
|
327
|
+
handlers (#1930).
|
|
328
|
+
- Fix mouse events reaching items and views through elements that cover the
|
|
329
|
+
canvas, such as menus. Drags still reach beyond them (#992).
|
|
330
|
+
- Fix the points of `#hitTestAll()` results of items inside transformed
|
|
331
|
+
groups, which were in the items' own coordinates.
|
|
332
|
+
- Support `strokeScaling: false` on text, exactly for uniform scaling (#1703).
|
|
333
|
+
- Fix the view size of canvases inside elements with CSS transforms, which
|
|
334
|
+
only scale the canvas on screen.
|
|
335
|
+
- Fix italic and oblique font weights in SVG export and import, which SVG
|
|
336
|
+
keeps in `font-style` (#937).
|
|
337
|
+
- Fix `onFrame` in web workers, where views have no element (#2200).
|
|
338
|
+
- Fix `PaperScope#execute()` in web workers (#2201).
|
|
339
|
+
|
|
3
340
|
## `0.13.0`
|
|
4
341
|
|
|
5
342
|
### Added
|
package/README.md
CHANGED
|
@@ -201,16 +201,14 @@ Paper.js uses [Gulp.js](https://gulpjs.com/) for building, and has a couple of
|
|
|
201
201
|
dependencies as NPM modules. Read the chapter [Installing Node.js and
|
|
202
202
|
NPM](#installing-nodejs-and-npm) if you still need to install these.
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
needs to be installed now. See
|
|
207
|
-
[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.
|
|
208
206
|
|
|
209
207
|
In order to be able to build Paper.js, after checking out the repository, paper
|
|
210
208
|
has dependencies that need to be installed. Install them by issuing the
|
|
211
209
|
following commands from the Paper.js directory:
|
|
212
210
|
|
|
213
|
-
|
|
211
|
+
pnpm install
|
|
214
212
|
|
|
215
213
|
### Building the Library
|
|
216
214
|
|
|
@@ -218,7 +216,7 @@ The Paper.js sources are distributed across many separate files, organised in
|
|
|
218
216
|
subfolders inside the `src` folder. To compile them all into distributable
|
|
219
217
|
files, you can run the `build` task:
|
|
220
218
|
|
|
221
|
-
|
|
219
|
+
pnpm build
|
|
222
220
|
|
|
223
221
|
You will then find the built library files inside the `dist` folder, named
|
|
224
222
|
`paper-full.js` and `paper-core.js`, along with their minified versions. Read
|
|
@@ -236,11 +234,11 @@ library.
|
|
|
236
234
|
This means you can switch between loading from sources and loading a built
|
|
237
235
|
library simply by running.
|
|
238
236
|
|
|
239
|
-
|
|
237
|
+
pnpm load
|
|
240
238
|
|
|
241
239
|
And to go back to a built library
|
|
242
240
|
|
|
243
|
-
|
|
241
|
+
pnpm build
|
|
244
242
|
|
|
245
243
|
Note that your PaperScripts examples do not need to change, they can keep
|
|
246
244
|
loading `dist/paper-full.js`, which will always do the right thing. Note also
|
|
@@ -250,7 +248,7 @@ that `src/load.js` handles both browsers and Node.js, as supported by Prepro.js.
|
|
|
250
248
|
|
|
251
249
|
Create a final zipped distribution file inside the `dist` folder:
|
|
252
250
|
|
|
253
|
-
|
|
251
|
+
pnpm dist
|
|
254
252
|
|
|
255
253
|
### Branch structure
|
|
256
254
|
|
|
@@ -261,7 +259,7 @@ only merged into [`main`](https://github.com/paperjs/paper.js/tree/main)
|
|
|
261
259
|
when a new release occurs.
|
|
262
260
|
|
|
263
261
|
As of version `0.9.26`, the `dist` folder is excluded on all branches, and the
|
|
264
|
-
building is now part of the `
|
|
262
|
+
building is now part of the `pnpm publish` process by way of the `prepublish`
|
|
265
263
|
script.
|
|
266
264
|
|
|
267
265
|
We also offer prebuilt versions of the latest state of the `develop` branch on
|
|
@@ -273,7 +271,7 @@ and [`prebuilt/dist`](https://github.com/paperjs/paper.js/tree/prebuilt/dist).
|
|
|
273
271
|
Similarly to building the library, you can run the `docs` task to build the
|
|
274
272
|
documentation:
|
|
275
273
|
|
|
276
|
-
|
|
274
|
+
pnpm docs
|
|
277
275
|
|
|
278
276
|
Your docs will then be located at `dist/docs`.
|
|
279
277
|
|
|
@@ -291,11 +289,16 @@ CORS restrictions. In order to run the browser based tests on Chrome, you need
|
|
|
291
289
|
to run a local web-server through Gulp.js. The following command will handle it
|
|
292
290
|
for you, and will also open the browser at the right address straight away:
|
|
293
291
|
|
|
294
|
-
|
|
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
|
|
295
298
|
|
|
296
299
|
To test the Node.js version of Paper.js, use this command:
|
|
297
300
|
|
|
298
|
-
|
|
301
|
+
pnpm test
|
|
299
302
|
|
|
300
303
|
### Contributing [](https://www.codetriage.com/paperjs/paper.js)
|
|
301
304
|
|
|
@@ -347,7 +350,9 @@ As mentioned above, we prefer that you send a
|
|
|
347
350
|
worry about the perfect name though -- you can change this name at any time
|
|
348
351
|
later on.
|
|
349
352
|
|
|
350
|
-
4. Hack! Make your changes, additions, etc.,
|
|
353
|
+
4. Hack! Make your changes, additions, etc., and describe them for the
|
|
354
|
+
changelog in a file of their own in `changelog/unreleased`, see its
|
|
355
|
+
[README](changelog/unreleased/README.md). Commit them then push them to your
|
|
351
356
|
GitHub fork: `git push origin name-of-my-patch`
|
|
352
357
|
|
|
353
358
|
5. Send a pull request to the upstream repository's owner by visiting your
|