paper.js v0.10.3 Release Notes
-
π Changed
- β Node.js: Support v7, and keep testing v4 up to v7 in Travis CI.
- Node.js: Loosely couple Node.js / Electron code to
Canvas
module, and treat its absence like a headless web worker context in the browser (#1103). - Clean up handling of
Item#_set()
,#set()
and#initialize()
:- Use
#_set()
for actually setting internal properties, e.g. onPoint
,Size
, so that derived classes can reuse other parts without having to override each individual function (e.g. inSegmentPoint
) - Define
#set()
as a shortcut to#initialize()
on all basic types, to offer the same amount of flexibility when setting values, accepting object literals as well as lists of value arguments.
- Use
- π SVG Export: Add support for shorter
h
/v
commands for horizontal / vertical lines in SVG output. - JSON Import / Export: Implement new and shorter segments array notation:
- Close paths by including
true
as the last entry - Allow nested segment arrays to be passed to
PathItem.create()
as well as theCompoundPath
constructor to create all sub-paths.
- Close paths by including
- Reflect
View#zoom
andView#center
through matrix decomposition, and implement additional decomposed properties such as#scaling
and#rotation
. - β¬οΈ Reduce various internal epsilon values for general improved precision while maintaining reliability.
- Split
PathItem#resolveCrossings()
into#resolveCrossings()
and#reorient()
(#973).
β Added
- Implement
Path#divideAt(location)
, in analogy toCurve#divideAt(location)
. - β Add
PathItem#compare()
as a way to compare the geometry of two paths to see if they describe the same shape, handling cases where paths start in different segments or use different amounts of curves to describe the same shape. - β‘οΈ Implement
Curve#hasLength()
as an optimized check for curve-length (#1109). - Implement
Curve#classify()
to determine the type of cubic BΓ©zier curve via discriminant classification, based on an approach described by Loop and Blinn, and use it to simplify curve self-intersection handling (#773, #1074, #1235). - β Add
Curve.getPeaks()
as a fast way to retrieve points that are often similar to the more costly curvature extrema for use in curve offsetting. - π¦ Expose
Curve. getCurveLineIntersections()
for use in curve offsetting. - β Add
Line.getDistance()
and use it inCurve.getOverlaps()
(#1253). - Implement
Segment#isSmooth()
and use it in handling of stroke-joins. - Bring back caching of
Item#rotation
and#scaling
, but only allow matrix decomposition-based properties on items with#applyMatrix = false
(#1004, #1177).
π Fixed
- Many improvements to boolean operations:
- Improve performance of boolean operations when there no actual crossings between the paths, but paths may be contained within each other.
- Improve path tracing approach by implementing a branching structure and sorting segments according to their reliability as starting points for traces (#1073).
- Improve calculation and reliability of winding contributions.
- Improve code that resolves crossings and reorients compound-paths based on how the sub-paths are nested.
- Fix issue where unite operation wrongly fills inner path (#1075).
- Better handle cases where one
Path
is open and the other closed (#1089). - Solve
null
exceptions during complex boolean operations (#1091). - Improve bidirectional curve-time rescaling in
divideLocations()
(#1191). - Improve handling of intersections between touching curves (#1165).
- Improve reliability of
Curve#getIntersections()
(#1174). - Fix
getOverlaps()
to always return overlaps in correct sequence (#1223). - Improve handling of multiple crossings on the same curve.
- π Improve tangent direction handling in
CurveLocation#isCrossing()
, by finding unambiguous vectors, taking the curve's loop, cusp, inflection, and "peak" points into account (#1073, #1074). - Prevent
Path#getStrokeBounds(matrix)
from accidentally modifying segments (#1102). - π Improve compatibility with JSPM (#1104).
- π SVG Import: Correctly handle multiple sequential move commands (#1134).
- SVG Export: Properly handle generated IDs (#1138).
- π SVG Export: Support multiple gradient offsets at 0 (#1241).
- π Fix imprecision in
Numerical.findRoot()
(#1149). - PaperScript: Prevent invalid JavaScript in assignment operators (#1151).
- β Hit Tests: Improve handling of SymbolItem in#hitTestAll() (#1199).
- β Hit Tests: Fix stroke hit-testing for rounded shape items (#1207).
- π Fix matrix cloning for groups with
#applyMatrix = false
( #1225). - Correctly handle offset in
Curve#divideAt(offset)
(#1230). - π Fix issue with
Curve#isStraight()
where handles were checked incorrectly for collinearity (#1269). - π Fix
Line#getSide()
imprecisions when points are on the line. - π Docs: Fix documentation of
Project#hitTestAll()
(#536). - π Docs: Improve description of
option.class
value inProject#hitTest()
(#632).
β Removed
- β Remove
Numerical.TOLERANCE = 1e-6
as there is no internal use for it anymore.