paperjs/paper.js
 Watch   
 Star   
 Fork   
21 days ago
paper.js

v0.17.0

Added

  • Add PathItem#offset(distance, options), which grows, shrinks or offsets paths and compound paths with miter, round or bevel corners (#371).
  • Add PathItem#outline(options), which turns the stroke of a path item into a filled path item, with its joins, caps and dashes (#371).
  • Add PathItem#dash(options), which cuts a stroke into its dashes as the canvas draws them, as a group of open paths.
  • Add stroke profiles, Path#strokeProfile: stops along a path that change the width, aspect and angle of the pen that draws its stroke, see StrokeProfileStop. Not yet supported: compound paths, strokeScaling off, and offset(), boolean operations, interpolate() and SVG (#2505, #2506, #2507).
  • Add live effects, Item#effects, which change what an item draws without changing the item, starting with offset and outline. Effect defines new ones, and Item#previewBounds measures what they draw.
  • Add pattern colors from a PatternDefinition, which tiles a raster or any other item, for fills and strokes, also in SVG and JSON (#829).
  • Add Color#aspect for elliptical radial gradients, and transform gradients exactly with their items, also when these scale unevenly or shear (#1744).
  • Add Group#buffered, which keeps a group's drawing in a canvas until the group changes, for large groups that rarely do (#377).
  • Add Item#onDraw and Item#onDrawSelection, which draw beneath an item or its selection, or replace them, also as class-level handlers such as Path.onDraw.
  • Add PathItem#arcAround(center, angle) and PathItem#arcTowards(to) (#1052).
  • Support options in PathItem#simplify(), with tolerance and a range of segments through from and to, as in PathItem#smooth() (#2501).
  • Export and import the names and data of segments in SVG, as a data-paper-segments attribute (#2398).
  • Add Project#onActivate and Project#onDeactivate, also as Project.onActivate and Project.onDeactivate for all projects.
  • Pass the import attributes of import … with { … } in PaperScript on to the loader in options.load of PaperScript.execute().
  • Hosted projects, see Project#host:
    • Share symbol and pattern definitions between items, referred to by their keys in JSON, and let scripts create new ones.
    • Load the pixels of rasters from the host on first access.
    • Load items in full when they move into a project with another host.
    • Call Item#onDraw and Item#onDrawSelection, through Project#draw().

Changed

  • Run the library in strict mode, which makes Path#getNearestPoint() about 14% and Item#hitTest() about 6% faster. PaperScript still runs in sloppy mode.
  • Draw items with opacity, blend modes or shadows about twice as fast (#377).
  • Make PaperScope#project an accessor, so that PaperScript's project follows the active project, as view does.
  • Emit deactivate when the active project or tool is removed.
  • Write the definition of symbol items to JSON as definition instead of symbol, which still loads.
  • Let hosted linked text that moves into a project with another host bring a copy of its story along (#2462, #2463).

Fixed

  • Fix boolean operations that could lose areas or whole results, at straight curves, near-coincident crossings, curves running back and forth along a line, shallow crossings and merged vertices.
  • Measure curve lengths precisely near cusps, where Curve#getLength() and Path#getPointAt() were off by up to 6%.
  • Find the nearest point on curves that cover a lot of ground between their samples, in #getNearestPoint() and the methods using it.
  • Fix PathItem#smooth() with a negative to on closed paths, which threw.
  • Fix PathItem#arcTo() with tiny arcs, which missed their end point.
  • Keep the attributes of compound paths in CompoundPath#reduce() when a single child is left.
  • Return false from CompoundPath#simplify() without children.
  • Keep the stripes of linear gradients across them when transforming them unevenly (#1744).
  • Export the gradients of items that keep their matrix to SVG in the coordinates of their elements (#2410).
  • Honor the bounds and matrix options of Item#exportSVG().
  • Keep Group#isolated and Group#buffered in clones.
  • Keep the content of rasters when setting Raster#size.
  • Load new Raster(source) from a string where there is no document, as in workers.
  • Draw the segments of selected paths again by default (#1899).
  • Count the duration of Item#tween() from the first frame.
  • PaperScript: compile ++ and -- correctly wherever they appear, keep keywords apart from replaced expressions in minified code, report the right lines in stack traces on V8, and return an object from compile() for empty code.
  • Hosted projects: leave items that moved away out of Project#takeChanges(), and turn off View#autoUpdate when setting Project#host.
  • Let Angular's esbuild builder bundle Paper.js for browsers (#2035).
2026-10-22 07:39:04
paper.js

v0.16.0

Added

  • Add the processNode option to #exportSVG() and the processItem option to #importSVG(): callbacks that receive { item, node } for each exported item with its SVG node and each imported SVG element with its item, and can return a replacement, e.g. to keep the SVG class attribute in Item#data (#1843).
  • Let Rectangle#scale() take a center point to scale from, as Item#scale() does, and normalize rectangles scaled by negative amounts (#1352).
  • Add Segment#name and Segment#data, stored in JSON but not in SVG. Named segments can be accessed by name through Path#segments, as named items through Item#children (#1459).
  • Add Style#paintOrder and Item#paintOrder: 'stroke' paints the stroke before the fill of paths, shapes and text, as in SVG's paint-order, which is exported and imported (#1731).
  • Lay out right-to-left text in the order it reads: the pieces of the lines of paragraphs whose direction is 'rtl' are placed, hit and exported from the right, path text runs from the path's end towards its start, and canvas measures and draws text in its paragraph's direction (#2389).
  • Export layers to SVG with a data-paper-layer attribute, and import the groups that carry it as Layer items again, inside the imported group (#483).
  • Add SymbolItem#embed(), which replaces a symbol item with a copy of its definition's item, transformed by the symbol item's matrix and combined with its opacity, visibility, blend mode and other attributes (#953).
  • Project#currentTextStyle in hosted projects: the style new text items take in place of Project#currentStyle when the host sets one, for hosts whose new text has defaults of its own, such as a black fill without a stroke.
  • Add Point#values, Size#values and Rectangle#values, which give their numbers as an array, as Matrix#values does.

Changed

  • Apply the data-* attributes of imported SVG elements to Item#data before calling the processItem callback of #importSVG(), so that it can extend the data, instead of after it, which replaced the data that it stored. Items that the callback returns as replacements no longer receive the data.

Deprecated

  • The undocumented onExport(item, node, options) and onImport(node, item, options) options of #exportSVG() and #importSVG(), replaced by processNode and processItem.

Fixed

  • Only call the import callback of #importSVG() for SVG elements, not also for the document of SVG strings, which received the item of its root element a second time.
  • Leave out the item itself and its ancestors when inserting children, which created a cycle in the scene graph and overflowed the stack, e.g. in new Group({ children: [new Layer()] }), and return null from Item#insertChildren() when none of the items can be inserted (#2406).
  • Keep the text path of hosted PathText and AreaText items when the host changes them: Project#invalidate() loads its new geometry into the path that scripts hold, which it replaced before.
  • Hit-test the strokes of shapes as those of their paths, which Shape only approximated for ellipses and rounded corners, and for non-scaling strokes under non-uniform matrices (#2334).
2026-10-21 21:44:43
paper.js

v0.15.0

Added

  • Load text items from the host of a hosted project, see Project#host, with their stories, and the paths and settings of path and area text, and let hosts lay them out as their documents do, through host.layOut(), given their JSON as the script holds them, also before the host has its changes, or null for text the script didn't change, which the host has as it is.
  • Add text ranges: TextRange, a part of a text whose style properties read what its letters and paragraphs share and set them, from TextItem#range(start, end), #runs, #paragraphs, #words, #letters and #lines, which ranges have too, and #replace(content, start, end), and TextStory, a text's content, runs and paragraphs, as TextItem#story.
  • Add text linking: TextItem#link(), #unlink(), #isLinked(), #nextTextItem, #previousTextItem and #visibleRange, by which a story flows through several text items, which TextStory#textItems lists.
  • Add PathText, text along a path between startOffset and endOffset, each letter turned to the path, which it takes as TextItem#textPath.
  • Add AreaText, text inside any path as its textPath, holes too, in columns and rows, with lines breaking between words and at soft hyphens, verticalAlign, fitHeight(), and lineWrap, a paragraph property that balances the lines.
  • Add Item#textWrap, by which items push aside the text of the area texts below them in their layer, or let it flow inside them.
  • Export area text, text on paths and text with mixed styles to SVG: point text keeps a <tspan> per line, with one per run where styles are mixed, and area text and text on paths are placed piece by piece, as they are laid out.
  • Add character style properties: fontStyle, lineHeight, letterKerning, letterScaling, letterRotation, baselineShift, baselinePosition, capitals, underline and strikethrough, and fontVariations and features for hosts.
  • Add paragraph style properties: justifyLast, startIndent, endIndent, firstLineIndent, spaceBefore, spaceAfter and direction, the justifications 'start', 'end' and 'justify', and justifySpacing, hyphenation, composer and tabs for hosts.
  • Let Item#strokeBounds be selected and set, as Item#bounds can: item.strokeBounds.selected draws the stroke bounds and their handles, independently of item.bounds.selected, and setting them scales the item so its stroke bounds match, also where its stroke's extent changes with its proportions, as with miters (#1030).
  • Import the data-* attributes of SVG elements into item.data, with their names camelized as in dataset, next to data-paper-data (#1227).
  • Export shadows to SVG as SVG 1.1 filters, which both browsers and editors such as Illustrator render, except for items without width or height, and import them back, along with CSS drop-shadow() (#1003).
  • Import SVG masks as clip masks, which is exact for masks of solid white shapes, or of opaque shapes with mask-type="alpha", and warns that other masks are approximated (#1916).
  • Add Group#ungroup(), which replaces a group with its children, applying its matrix to them, and let Item#replaceWith() take several items (#1026).
  • Add settings.segmentSize, the size of the segments when drawing selections, next to settings.handleSize for their handles, which it defaults to (#1899).
  • Add angleInRadians to the object literals that create points, next to angle, e.g. new Point({ length: 10, angleInRadians: Math.PI / 2 }) (#562).
  • Add Project#hasChanges(), which tells whether changes were logged since the last Project#takeChanges(), without taking them.
  • Add dynamic import(specifier) to PaperScript, which resolves to the module's namespace through the loader in options.load, which may return a Promise.
  • Add static import to PaperScript, through a loader that hosts pass as options.load to PaperScript.execute(), together with export … from. It needs a current Acorn as self.acorn.
  • Add Item.getBounds(items[, options]), the bounds of a list of items in project coordinates as if they were grouped, e.g. of the selection (#2252).
  • Add ToolEvent#velocity and #elapsed, the velocity of the mouse since the last tool event in points per second, and the time since then in seconds, which stay even when the system misses a mouse report.
  • Add Event#time, the time of the event in seconds, as frame events have it, and options.time to View#dispatchMouseEvent() and #dispatchKeyEvent().
  • Add a setter to View#bounds, which fits the view to the given rectangle, as View#fitBounds() does.
  • Let PathItem#unite(), #intersect(), #subtract() and #exclude() take an array of paths, which they combine in one call: unite, intersect and subtract in a balanced tree, exclude in one even-odd pass. Uniting 500 paths takes 0.22 s instead of 2.9 s chained, excluding them 0.45 s instead of minutes (#2094, #2303, #2304).
  • Load hosted text that the host links into one story, which host.getStory() gives once for all of its items, whichever of them loads first.

Changed

  • Lay out text by the ascent and descent of its fonts: the bounds of PointText are its lines' line heights, with the leading split around their ascent and descent, instead of 3/4 of the first above its baseline and 1/4 of the last below.
  • Replace leading by lineHeight, 'auto' (1.2) or another factor of the font size, or a fixed length; leading still sets and reads a fixed line height in pixels. Rename tracking to letterTracking, which tracking still sets and reads.
  • Make Style#getFontStyle() return the CSS font style, 'normal', 'italic' or 'oblique', instead of the font as canvas takes it, and remove Style#getTrackingStyle().
  • Only go into the children that items show in Item#getItems(), and log the changes of children that their parent doesn't show, such as a text's path, as the parent's.
  • Make Item#intersects() check whether the items overlap, also when one contains the other, as Rectangle#intersects() does, instead of only whether their outlines cross, and use it in getItems({ overlapping }) for items whose bounds contain the rectangle (#1751).
  • Use settings.hitTolerance for the mouse events of items, such as mouseenter and click, which always hit-tested with a tolerance of 0 (#1971).
  • Keep the named exports of PaperScript modules with a default export: export default x now sets module.exports.default instead of replacing the exports, and such modules are marked with __esModule. import x receives the default export, or the whole exports of CommonJS-style modules, and import * as m all exports, with CommonJS-style ones also as m.default. So PaperScript.execute() returns { default: x } for export default x.
  • Deprecate Event#timeStamp in milliseconds, and the options.timeStamp of View#dispatchMouseEvent() and #dispatchKeyEvent(), for the new time in seconds.
  • Rename the paper-sourced.js build to paper-hosted.js, and Project#source to Project#host, to match HostItem and the host document that backs the items.
  • Draw dashes with setLineDash(), which every canvas supports, and remove the dash emulation for canvases without it, along with the undocumented paper.support.nativeDash (#2350).
  • Trace the results of boolean operations through a planar graph of the operands' curves, which each operation builds within one geometric tolerance: intersections within it merge into one vertex, curves that pass within it of a vertex are cut there, and coincident curves become one edge. Results are correct to within about five times that tolerance, under a thousandth of a unit on a drawing of 1,000 units, and stable under tiny moves of the operands. They can differ from before in where their contours start and how they are divided, but not in their areas. Holes come out oriented opposite to their outlines, and islands like outlines (#2292).
  • PathItem#resolveCrossings() returns the filled outline of a path, without the inner loops that its fill rule covers (#2292).
  • Make boolean operations faster than in 0.14.0 on all inputs measured, from about 15% on small operations up to 5.7× on large polygons (#2293, #2296, #2297, #2299, #2300, #2301, #2302, #2305).
  • Draw the CSS blend modes as 'normal' in old browsers whose canvas doesn't support them, such as Internet Explorer and the old Edge, instead of emulating them pixel by pixel. Paper.js's own modes, such as 'add', are still emulated (#2350).
  • Remove the undocumented statics Curve.getBounds(values), a leftover of old intersection code, and Curve.getCurveLineIntersections(), which nothing in the library calls.
  • Drop the code for browsers without current DOM APIs, which only old IE, Edge and WebKit needed: MS pointer events, srcElement, toElement, keyIdentifier, backingStorePixelRatio, and the exception of getBoundingClientRect() for nodes outside the DOM (#2350).

Fixed

  • Hit-test strokes with 'miter' and 'bevel' joins next to smooth segments, which are joined round, as the stroke bounds already treat them (#2342).
  • Update Item#strokeBounds after changing the stroke of items without a parent, such as shapes, texts, symbol items and groups, which kept the old stroke bounds (#2343).
  • Fix Path#handleBounds of empty paths, which were infinite: they are an empty rectangle, as their bounds (#2345).
  • Import the paragraphs of text items after their content, also from JSON that lists them first, as JSON written by other tools may.
  • Keep gradients in the runs of text items through #exportJSON() and #importJSON(), and round their style values and those of their paragraphs to the precision of the export (#2348).
  • Keep what scripts write to hosted items before they load, such as their pivot or an area text's columns, which loading replaced.
  • Fix the stroke bounds of non-scaling strokes under non-uniform matrices, whose miters, bevels and square caps followed the untransformed angles.
  • Fix Item#strokeBounds after scaling items that apply their matrix, such as paths and groups, when they were read before: the cached stroke bounds were scaled along, including the width of the stroke, which doesn't scale.
  • Fix SVG export of opacity and blendMode, which aren't inherited, so children with the same values as their group lost them, and the defaults were written where the group differed.
  • Fix the shadows of items that are both filled and stroked, which only cast the shadow of their fill, partly covered by the stroke (#892).
  • Fix the shadows of text items, which only text with both a fill and a stroke drew (#2347).
  • Fix the points at offsets of PathFlattener on straight curves, such as lines without handles, whose curve-time doesn't follow their length, which placed them off everywhere but at the ends.
  • Fix SVG import of <use> elements, which now pass their styles and those of their parents on to the referenced element, as in SVG, instead of the styles of the place where it is defined, and skip circular references (#2090).
  • Divide the operands of boolean operations at all their intersections, also where they only touch, which makes the results of near-coincident geometry more stable, and ends the endless loop of #1849.
  • Fix Curve#getTimeOf() for points near the ends of straight curves, which it solved to times far from the ends, as it only tested the ends exactly.
  • Fix boolean operations that backtracked while tracing their result, which could give a curve of it the handle of a dead end and make it bulge.
  • Measure text in views without a canvas of their own, such as in workers, with a canvas from CanvasProvider, e.g. an OffscreenCanvas, so PointText has bounds there too.
  • Fix PaperScript's exported variable declarations without semicolons, such as export const a = 1, which compiled to invalid code.
  • Fix Curve#classify() reporting points of inflection, cusps and loops at the very ends of curves, which made boolean operations miss crossings at those vertices (#1879, #1387).
  • Fix PaperScript's compound assignments of properties, such as array[index()] += 1, which evaluated their object and key twice.
  • Fix PaperScript with a current Acorn provided as self.acorn, which parses all current syntax now, and its exports: of functions and classes, of renamed names (export { a as b }), of several declarations in a row, and of variables, which stay usable in the script itself.
  • Fix intersections of curves and lines at the curves' ends, which were lost when the curve touched the line there, e.g. at a zero-length handle (#1848).
  • Fix the orientation of the results of PathItem#exclude() and #subtract(), whose parts of the second path kept its reversed orientation, giving them negative areas (#2064).
  • Fix PathItem#interiorPoint returning points on the path itself, such as a vertex shared with another path, which made boolean operations of paths that only touch keep or drop the wrong parts (#1837, #1979).
  • Fix intersections and boolean operations of curves and paths that only touch, at coordinates beyond 16384, where the tolerance of their bounds checks got lost in floating point (#1940, #1882).
  • Fix boolean operations on open paths that end where they start, which lost the curve between their ends (#1929, #1973, #1989, #2018).
  • Fix boolean operations with { trace: false } on closed paths, which could keep or drop the wrong parts depending on where the path started, and on compound paths, which threw an error (#1540, #1541, #1746, #1998, #2046).
  • Document Item#fullySelected, which all items have, not only paths (#1687).
  • Type options objects from their documented options, such as those of Item#hitTest(), #exportSVG() and #rasterize(), so misspelled options are errors in TypeScript (#1666).
  • Type the setters of point, size, rectangle and color properties with the values they accept, such as item.position = [10, 20] and item.fillColor = 'red'. The typings now need TypeScript 4.3 (#1665).
  • Handle the mouse events of View#dispatchMouseEvent() also outside the view's bounds, since the host decides which events belong to its drawing surface.
  • Fix boolean operations on paths that touch or overlap along their edges, run close to each other, or cross near their vertices, which lost or added parts of their results (#1285, #1362, #1867, #1917, #1943, #1961, #2002, #2036, #2096, #2099).
  • Fix PathItem#resolveCrossings() on paths with both overlaps and crossings, which lost parts of their outlines (#2290).
  • Fix Curve.getTimeOf() at coordinates beyond about 2e8, where it didn't recognize points on the curve (#2291).
  • Hit-test non-scaling strokes under non-uniform matrices where they're drawn, also next to corners, joins and caps, and with skewed or rotated matrices (#2334).
  • Fix Curve#strokeBounds of curves without a path, which threw: without a path, there is no stroke, so they are the curve's bounds (#2344).
  • Give View#dispatchKeyEvent() the characters of space, enter and tab, as the DOM's key events have them, instead of empty ones (#2346).
  • Fix paper.support.nativeBlendModes, which listed the blend modes canvas accepted as 170 instead of true, and only knew the CSS blend modes where a canvas was available when Paper.js loaded. It lists the canvas composite modes and the CSS blend modes as native, and Paper.js's own modes as not, without testing canvas (#2349).
  • Hit-test strokes at segments where the curves meet in the same direction, such as where a line runs into a curve, whatever the join, also across curves without length, as in rectangles rounded to half their height.
  • Calculate Curve#getTimesWithTangent(), #length and Curve.getPeaks() precisely also far from the origin, from the curve's polynomial coefficients, which take the differences of the points first.
2026-10-20 07:20:33
paper.js

v0.14.0

Added

  • Add options.handlers to PaperScript.execute(), to export further global handlers next to onFrame, onResize and the tool's, for hosts that call them themselves, such as Scriptographer's onStop.
  • Add Tool#eventInterval, as Scriptographer had it, to fire onMouseDrag again at an interval while the mouse button is held, also when the mouse doesn't move.
  • Add Project#scope, View#scope, Item#scope and Tool#scope, to get from each of them to its PaperScope (#1634).
  • Add Group#isolated, to draw a group or layer through a temporary canvas, so that the blend modes of its children, such as 'destination-out', only apply within it, like CSS's isolation: isolate (#474).
  • Add View#dispatchMouseEvent() and View#dispatchKeyEvent(), to feed mouse and key events from hosts without a DOM, such as workers, through the same handling as the DOM's events, for tools, items and views.
  • Add settings.scaleStrokes, to scale the stroke widths of paths and compound paths along with their content when matrices are applied (#2098, #1514).
  • Add the paper-sourced.js build, in which a project's items can be backed by a host document through Project#source: items are created as light shells from the host's records, and load their content and children from the host on first access, so a script costs what it touches. Includes HostItem, for the host's own kinds of nodes (#2203).
  • Add Project#trackChanges and Project#takeChanges(), to let hosts that keep their own document update only the items that changed, and export ChangeFlag (#2202).

Changed

  • Path.RegularPolygon() follows Illustrator: it stands on a flat bottom edge for any number of sides, and its segments run counterclockwise from its top vertex, or with an even number of sides, from the right end of its top edge. This changes the segment order of all regular polygons, and turns those with a multiple of 6 sides onto an edge (#1787).
  • Hit-test transparent fills, as in SVG: only items without a fill color are not hit through their fill (#1157).
  • paper.install() keeps what the target scope has already, such as the native Event, MouseEvent and Symbol, and PaperScript doesn't shadow existing globals with Paper.js's classes of the same name either (#1832, #1652).
  • Item#importJSON() into an existing item resets the fields that the JSON leaves out, so the item ends up the same as a newly imported one, with its place in the scene graph and its event handlers kept (#1425, #1324).
  • Canvases without resize get their CSS size from the view on every screen, not only at pixel ratios other than 1, where the page's CSS won (#2088).
  • #hitTestAll() reports every segment and handle of a path within the tolerance, closest first, followed by its stroke or fill hit, instead of only the first hit per path (#1294).

Fixed

  • Create the tool in PaperScript for all of its global handlers, also for scripts that only define onActivate() or onDeactivate(), and document Tool#onActivate and Tool#onDeactivate.
  • Keep Key.modifiers in sync with the flags of mouse events, so modifier keys pressed or released while the page didn't have the focus don't stay wrong (#1140).
  • Keep Paper.js's own blend modes, which CSS doesn't have, such as 'destination-out', through SVG export and import, in a data-paper-blend-mode attribute (#1296).
  • Throw a clear error when creating an item without a project, instead of a null access deep inside the constructor (#1889).
  • Free the pixels of temporary canvases when they're released, which their pool kept allocated at their largest size for the life of the page.
  • Keep the size of rasters in JSON, so imported rasters have their size and bounds before their image has loaded, or if it fails to load (#1598).
  • Fix the frame timer of workers and Node.js running forever after any script, which kept hosts from seeing scripts end.
  • Fix touch scrolling over empty parts of a canvas whose items have mouse handlers (#1930).
  • Fix mouse events reaching items and views through elements that cover the canvas, such as menus. Drags still reach beyond them (#992).
  • Fix the points of #hitTestAll() results of items inside transformed groups, which were in the items' own coordinates.
  • Support strokeScaling: false on text, exactly for uniform scaling (#1703).
  • Fix the view size of canvases inside elements with CSS transforms, which only scale the canvas on screen.
  • Fix italic and oblique font weights in SVG export and import, which SVG keeps in font-style (#937).
  • Fix onFrame in web workers, where views have no element (#2200).
  • Fix PaperScope#execute() in web workers (#2201).
2026-10-19 21:31:57
paper.js

v0.13.0

Added

  • Add a force parameter to View#update(), to redraw the view even when nothing changed, e.g. after a web font has loaded (#1913).
  • Add View#fitBounds(rectangle[, fit]), to fit a rectangle into the view. fit takes the values of CSS's object-fit: 'contain' and 'cover' (#1688).
  • Add the reuseImages option to #exportSVG(), to export images shown by several rasters only once, and place them with <use> elements (#1993).
  • Add tracking to the text styles: the space added after each character, in thousandths of an em, as in Adobe Illustrator and InDesign. #exportSVG() and #importSVG() write and read it as letter-spacing (#2066).
  • Add easeInSine, easeOutSine, easeInOutSine, easeInExpo, easeOutExpo, easeInOutExpo, easeInCirc, easeOutCirc and easeInOutCirc to Tween (#1855).
  • Add the idPrefix option to #exportSVG(), prepended to the generated ids of definitions, so that separately exported SVGs can be placed in one document (#1709).
  • Add the crossOrigin option to #importSVG(), passed on to the rasters of <image> elements, so that canvases drawing them aren't tainted (#1094).
  • Add View#project (#1634).
  • Add Point#clamp(min, max), e.g. to keep a point inside a rectangle with point.clamp(rect.topLeft, rect.bottomRight).
  • Use OffscreenCanvas in web-workers, so Item#rasterize(), new Raster(size), items with opacity or blend modes, and CSS color names, which resolved to black, work there. Raster#toDataURL() remains unsupported in web-workers (#1643).

Changed

  • Time double-clicks from mousedown to mousedown and only within 3 pixels, as native dblclick events do, and don't take a third click for another double-click (#1451).
  • Make Rectangle#left, #right, #top and #bottom move only their own side, as documented, and the corner points only their two sides, keeping the opposite ones where they are. They used to move the whole rectangle, unless another side was set before. This also applies to Item#bounds: setting a side or corner of an item's bounds now stretches the item. To move items, set bounds.point, bounds.center, bounds.x or bounds.y (#2024, #1147).
  • Hit-test groups wherever one of their children is hit, as in Illustrator, so hitTestAll() always returns the groups above the hit items, and hitTest(point, { class: Group }) finds the group under a point. Groups were only hit when all their children shared a fill (#2069).
  • Let inline style declarations override presentation attributes in #importSVG(), as in CSS and browsers: <rect fill="blue" style="fill: red"> now imports red (#1962).
  • Keep the pixels of images in #importSVG() and scale them to their size in the SVG, instead of resampling them to that size, which made them blurry. Raster#size is now the image's own size, and images without a size are shown at it, as in browsers (#1963).
  • Let Item#clone(), the boolean operations, Item#rasterize(), Path#toShape() and Shape#toPath() follow settings.insertItems when no insert option is passed, instead of always inserting their results. An options object without insert also inserts the clone by default now, as documented, e.g. clone({ deep: false }) (#1721).
  • Use jsdom's own XMLSerializer for #exportSVG() on Node.js, instead of a shim that returned HTML, so the output is valid XML with escaped attribute values, as in browsers. Empty elements are now self-closing (#1922).
  • Item#fitBounds(rectangle[, fit]) takes the values of CSS's object-fit as fit: 'contain', 'cover' and 'fill', which stretches the item to the rectangle.
  • Scale and align images in #importSVG() as their preserveAspectRatio describes, fitting them into their box uniformly and centered by default, as browsers do, instead of stretching them. slice is treated as meet (#1129).
  • Let Path#removeSegments(from, to) wrap around on closed paths when from is larger than to, instead of removing nothing (#1881).
  • Read the href of <image> elements in #importSVG() always as a URL, no longer as the id of a DOM element first.

Deprecated

  • The boolean fill parameter of Item#fitBounds(): use 'cover' instead of true.

Removed

  • Remove the workaround for wrong mouseout coordinates in old versions of Chrome on Windows (#1811).
  • Remove the CLA from the contribution guidelines, as it no longer exists (#2071).

Fixed

  • Fix require('paper') in the Node.js REPL (#2019, #1792).
  • Fix loading PaperScript in bundles that leave the top-level this undefined, as in ES modules (#1480).
  • Prevent source-map-loader from warning about the source map string in PaperScript (#1991).
  • Fix replacing style colors that were set as strings, which threw in strict mode (#2049).
  • Fix SVG path data with arc flags that aren't separated from the numbers after them, as SVGO writes them (#1808, #1885).
  • Fix #importSVG() of gradients, fills, clip paths and <use> elements that reference definitions appearing later in the document (#1146, #1884, #1978).
  • Fix #importSVG() of elements with numeric ids (#1754).
  • Fix #importSVG() of rounded rectangles with only rx or ry (#1863).
  • Fix #exportSVG() writing fill-rule="none", font-family="none" etc. on groups with differently styled children (#1732).
  • Fix Curve#handleBounds, which threw, to only include the curve's own points (#1992).
  • Fix Curve#getTimesWithTangent() for curves without a cubic component, such as quadratic curves (#1870).
  • Fix Shape JSON import with type after radius (#1820).
  • Fix boolean operations with trace: false or stroke: true ignoring options.insert (#2028).
  • Fix gradients drawn with strokeScaling: false (#1821, #1822).
  • Fix the selection of items in symbol definitions being drawn (#1577).
  • Fix View#zoom of mirrored views, which was 0 (#1411).
  • Fix item mouse handlers that stopped working after removing items whose parent was already removed, or after moving items to another project (#2079, #1791).
  • Fix key events with Control, Alt and Meta in Firefox and other browsers that fire no keypress for them (#1997, #1871).
  • Fix the space key staying down after Option + Space on macOS.
  • Fix key events not reaching a view that became visible after the focused one was hidden (#1953).
  • Load in DOMs whose canvas has no 2D context, as jsdom without canvas in jest, and run there as in workers (#1805).
  • Keep the original error as cause when jsdom or canvas fail to load on Node.js (#1759).
  • Fix #getItems() and #getItem() with a match function or without options to search recursively, as documented, instead of matching only the top-level items.
  • Fix #importSVG() of transforms and styles on <use> elements that reference groups (#978).
  • Fix the project and parent options of the Path.* constructors. With insert: false, they no longer insert into the parent, as new Path() doesn't either (#2012).
  • Fix the bounds of transformed circle and ellipse shapes (#1826).
  • Fix PointText#strokeBounds to include the stroke, which got cut off when drawn with opacity (#1322).
  • Fix the Item#bounds setter on items with zero width or height, which made their matrix non-invertible (#1794).
  • Fix #getItems() with overlapping, which never matched shapes, rasters and texts, as their matrix was applied twice (#1300).
  • Fix the bounds of items whose matrix cancels out the matrix of their parent (#1457).
  • Fix the source URL and source map of PaperScript loaded from script tags, which were lost (#1753).
  • Fix stroke hit-tests at the ends of paths with butt caps, which missed even the end points (#1460).
  • Fix Path#splitAt() with locations that aren't on the path, which split the path at its start instead of returning null.
  • Fix clipping with groups that are clipped themselves, as imported SVG with a viewBox is, which clipped with their own clip mask too (#1618).
  • Fix Item#hitTest() and #hitTestAll() on items inside transformed groups, which took the point in their parent's coordinates instead of the documented global ones (#1803).
  • Ignore View#zoom values that aren't positive numbers, which left the view's matrix without an inverse, so that View#bounds threw (#1433).
  • Fix the hit-test tolerance of items inside transformed groups and of symbol items, which their transformations scaled. It is now in project coordinates, as documented (#1278).
  • Limit the temporary canvases of items with opacity or blend modes to the visible area, so large groups no longer disappear or make zooming slow (#1644, #1920, #1925, #2001, #2029).
  • Support SVG 2's plain href attribute in #importSVG(), besides xlink:href, for <use>, <image> and gradient links.
  • Fix #exportSVG() of groups used as clip masks, which were exported as groups inside <clipPath>, where only shapes are allowed, so browsers clipped everything away (#1445, #1590).
  • Keep the lines of multi-line text in #exportSVG() and #importSVG(), as <tspan> elements at their own baselines (#988).
  • Fix shadows being cut off on items with a fill, a stroke and an opacity, which are drawn through a temporary canvas (#1628).
  • Fix #importSVG() of <use> elements that place images, which weren't positioned and sized, as their rasters were cloned before the image loaded.
  • Fix Item#fitBounds() and View#fitBounds() with empty rectangles or items: empty sides no longer collapse items, produce NaN coordinates with 'cover', or make the view throw; they are left out of the scaling.
  • Fix #importSVG() of lengths in in, cm, mm, pt and pc, which were read as pixels (#1919).
  • Fix #importSVG() of percentages inside nested <svg> elements, which referred to the size of the root instead of the nearest <svg> (#1404).
  • Fix #importSVG() on Node.js of shapes without a fill, which were imported without one instead of black, as in browsers (#1229).
  • Fix the quadratic time of #exportSVG() for groups with many children (#1353).
  • Implement the documented 'pin-light' blend mode, which drew nothing (#1527).
  • Fix clip masks of items with a matrix and an opacity or blend mode, which clipped in the wrong place (#1594).
  • Fix rasters and point texts used as clip masks, which clipped with the path drawn before them. They now clip with their rectangle and bounds (#1845).
  • Fix the stroke bounds of sheared, mirrored and non-uniformly scaled paths with applyMatrix: false. The miter limit is now checked in the path's own coordinates, as canvas does (#2065).
  • Fix symbol items overwriting the globalMatrix of their definition's item, which affected its stroke bounds and selection (#1684).
  • Fix the view size of canvases with padding or border, which grew with each setup of a project for them (#1160, #2033).
  • Fix setting View#rotation on mirrored views, which rotated the other way, and on non-uniformly scaled views, which got skewed (#1893).
  • Fix touches outside of the view taking over its drag (#1875).
  • Fix hit-tests of point texts ignoring the tolerance (#632).
  • Fix removed selected items being kept by their project, which leaked memory (#1856).
  • Fix the line width of selections, which used whatever line width the view's context was left with.
  • Fix hit-tests of symbol items with class, type and match filters, which were applied to the definition's items instead (#1774).
  • Leave workspaces and resolutions out of the published package.json, which made Yarn warn when installing paper (#1921).
  • Fix stale Item#globalMatrix and #localToGlobal() results of items whose sibling was asked first after their parent was transformed, and of items moved to another parent or removed (#1750).
  • Fix the points of mouse and touch events on canvases with padding or border, with a CSS size that differs from the view size, or under CSS transforms that scale them, which were offset or scaled (#549, #1729).
  • Fix the sign of Line#getSignedDistance() for lines whose direction has two negative coordinates (#1880).
  • Fix outdated bounds of nested groups after changes to items two or more levels down, and of groups containing placed symbols after changes to the symbol definition (#940).
  • Docs: Mark the path argument of PathItem#getIntersections() as optional.
  • Docs: Add View#onKeyDown, View#onKeyUp, Point#negate(), Size#negate(), PaperScope#createCanvas(), #clear() and #remove().
  • Docs: Correct the defaults of the hit-test options, the results of the math operator examples, Raster#source and Item#guide, and document Path#reduce()'s simplify option, nullable location getters, optional arguments, ToolEvent#tool, which items have children, how group styles, getItems() ordering, Rectangle#selected and Tool#onMouseMove work, and the resize canvas attribute (#2078, #2092, #2030, #1928, #1947, #1907, #1900, #2115, #1645, #1697, #1747, #1507, #604, #1330, #662).
  • Docs: Add examples to the boolean path operations (#1007).
  • Docs: Document that new Path(pathData) holds a single sub-path (#2057).
  • Docs: Document that styles set on symbol items, or inherited by imported <use> elements, don't reach the symbol definition's items (#1329).
  • Docs: Document using Paper.js with a bundler in the README (#1695).
  • Docs: Move the documentation of <symbol> and <use> from Project#importJSON() to Project#importSVG().
2026-10-18 23:05:00
paper.js

v0.12.20

Fixed

  • Keep the native Symbol in PaperScope#install(), which replaced it with the deprecated paper.Symbol alias of SymbolDefinition. paper.Symbol itself still works.
  • Support jsdom 20 and newer in Node.js: find jsdom's internals where jsdom 28 moved them, and run in worker mode without the canvas module again, which failed to load before.

Changed

  • Update paper-jsdom to jsdom 28, and paper-jsdom-canvas to jsdom 28 and canvas 3, which install on current Node.js versions. Both now require Node.js 20.19, 22.12 or 24 and newer.
2026-10-18 19:44:14
paper.js

v0.12.19

Security

  • Fix XSS in #importSVG(): imported SVG is now attached to a sandboxed iframe instead of the page while its styles are computed, so it can't run scripts or load resources (#2100).

Changed

  • #importSVG() is no longer affected by the page's style sheets. Style sheets inside the imported SVG still apply.

Fixed

  • Restore settings.applyMatrix and settings.insertItems when #importSVG() fails.
  • Fix new Path.Rectangle(rectangle, radius), new Shape.Rectangle(rectangle, radius) and Item#fitBounds(rectangle, fill) when the rectangle is given as an array or object literal.
  • Fix new Raster(source, position) ignoring the position.
  • Fix new Path.Arc() handling of insert: { insert: false } shadowed Path#insert(), and { insert: true } was ignored.
  • Fix tweening of points, colors and relative values in paper-core, which relied on PaperScript.
  • Fix setting ToolEvent#count, which had no effect.
  • Fix new Shape({ type: 'circle', radius }) without a size, which threw.
  • Fix View#getPixelSize() returning NaN for views without an element, as in web workers, which broke leading for font sizes in units other than pixels.
  • Only publish the intended files to npm, removing an accidental copy of the whole distribution from the package (12.3 MB → 6.2 MB unpacked).
2024-07-17 21:02:17
paper.js

v0.12.18

Fixed

  • Fix transformation in SvgImport (#1926).

Added

  • Implement options.reduceAttributes option for SVG export (#1895).
  • Add setter for item.index (#1908).
2022-11-04 04:20:12
paper.js

v0.12.17

  • Properly warning in Chrome Console by providing { willReadFrequently: true } canvas context option where needed (#2008).
2022-10-20 23:43:31
paper.js

v0.12.16

Fixed

  • Fix Item#rasterize() bounds cache when reusing raster.
  • Fix new warning in Chrome Console by providing { willReadFrequently: true } canvas context option where needed (#1999, #2000, #2003).
  • Fix Path.* constructor properties handling when passing { insert: true }

Changed

  • Rename Raster#setImageData() to #putImageData().
  • Change Raster#setImageData() to also respect image size.
  • Add separate Numerical.ANGULAR_EPSILON for Path#arcTo()