Commit graph

5609 commits

Author SHA1 Message Date
sasensi
fc5bb4b10e Fix #1493 Path#add crashes whith 1000000 segments 2018-10-02 14:09:34 +02:00
sasensi
54e1a0c1ef Fix: calling event.preventDefault() on not cancelable events produces errors 2018-10-02 10:31:49 +02:00
sasensi
cb9fbd7789 Fix #1501 document touchstart/touchmove events are passive by default in chrome and event.preventDefault() calls are ignored 2018-10-02 10:29:39 +02:00
sapics
cce5b24e9a Fix:SvgImport apply attributes to item #1416 2018-10-02 16:35:32 +09:00
sasensi
704d37be2f Fix #1503 Item#position caching issue 2018-10-01 19:25:04 +02:00
sasensi
07ae09a76a Fix #1521 adding raster.smoothing property 2018-09-30 18:46:02 +02:00
Jürg Lehni
53897d7498 Simplify code from #1528 2018-09-29 16:26:47 +02:00
DD
bf63bf223c Add rotate case as well 2018-09-29 16:19:32 +02:00
DD
8d0fecbb1b For SVG import, If second argument is missing in translate, assume that it's zero. Currently it assumes that y matches x if y is missing. 2018-09-29 16:19:09 +02:00
Jürg Lehni
8792d142b3 Some code cleanup for #1515 2018-09-29 15:09:02 +02:00
Jürg Lehni
ef2c56b164
Merge pull request #1515 from sasensi/Fix_#1506_#1513_by_checking_winding_quality_in_boolean_subtraction
Fix #1506 #1513 by checking winding quality in boolean subtraction
2018-09-29 14:51:18 +02:00
sapics
e057f20f37
Merge pull request #1511 from sapics/free-memory2
Release memory on Color
2018-09-29 13:31:38 +09:00
sapics
eb740c2452 Minor fix 2018-09-29 12:29:12 +09:00
Bojan Hribernik
6925888024 Fix Cannot read property 'parent' of undefined in node
This happens in webpack bundle in node server rendering react application:
```js
TypeError: Cannot read property 'parent' of undefined
    at Object.eval (webpack:///./node_modules/paper/dist/node/self.js?:20:28)
    at eval (webpack:///./node_modules/paper/dist/node/self.js?:62:30)
    at Object../node_modules/paper/dist/node/self.js (/home/bojan/www/climbuddy/client/server/map.bundle.js:34531:1)
    at __webpack_require__ (/home/bojan/www/climbuddy/client/server/map.bundle.js:26:30)
    at Object.eval (webpack:///./node_modules/paper/dist/paper-core.js?:35:16)
    at eval (webpack:///./node_modules/paper/dist/paper-core.js?:14798:3)
    at Object../node_modules/paper/dist/paper-core.js (/home/bojan/www/climbuddy/client/server/map.bundle.js:34553:1)
    at __webpack_require__ (/home/bojan/www/climbuddy/client/server/map.bundle.js:26:30)
    at eval (webpack:///./node_modules/react-paper-bindings/lib/View.js?:15:18)
    at Object../node_modules/react-paper-bindings/lib/View.js (/home/bojan/www/climbuddy/client/server/map.bundle.js:37188:1)
```
2018-09-29 12:14:32 +09:00
sapics
e9c4e8cf3b Release memory on Color 2018-09-27 18:39:39 +09:00
sapics
f8d8b5cc03
Code style fix: replace tabs to spaces 2018-09-27 16:47:17 +09:00
sasensi
9a8aae00bd Fix #1506 #1513 by checking winding quality in boolean subtraction 2018-09-26 14:05:29 +02:00
sasensi
6ca654d6d3 fix Path.splitAt() documentation example 2018-09-20 12:24:35 +02:00
DD Liu
c7042d79e1 Turn off image smoothing on rasterize and allow user-set bounds 2018-08-03 16:01:07 -04:00
DD Liu
3b68397a5e Fix uses of const 2018-08-02 16:07:26 -04:00
DD Liu
9f9f210537
Merge pull request #16 from fsih/safariDrawImage
Fix Safari when selection exceeds canvas bounds
2018-08-01 15:38:38 -04:00
DD Liu
e0b6759add Make raster's getSubRaster function allow rectangles that exceed the bounds of the canvas. This fixes Safari, which returns a blank canvas in that case. 2018-07-26 15:08:48 -04:00
Paul Kaplan
7519590321 Fix gradients applied to text.
Two things:
1. Apply a gradientTransform for text items that reverse the text transform. This is required because we do not use x/y for text, and gradients are impacted by the transforms.
2. Always apply the style to text elements instead of allowing them to be applied to the parent group if the text element is alone. This is so the fill property is always on the text element so the gradient transforms work.
2018-07-17 10:09:41 -04:00
DD Liu
51a1b93df6
Merge pull request #14 from fsih/bearEars
Fix SVG import of translate with one argument
2018-06-27 16:55:54 -04:00
DD
011a353c08 Add rotate case as well 2018-06-27 16:47:19 -04:00
DD
4c72f3f89e For SVG import, If second argument is missing in translate, assume that it's zero. Currently it assumes that y matches x if y is missing. 2018-06-27 16:29:46 -04:00
Paul Kaplan
9065cad302
Use childNodes instead of children 2018-06-14 11:40:56 -04:00
DD Liu
df08aa10c1
Remove || '' 2018-05-23 15:27:07 -04:00
DD
26868e4cab Add support for text before edge baseline 2018-05-22 12:40:59 -04:00
DD
15470a90b7 Be able to import leading 2018-05-17 17:33:36 -04:00
DD
e29749a266 Allow hitting unfilled text and compound paths when hitUnfilledPaths option is on 2018-04-03 18:09:24 -04:00
Paul Kaplan
dd276b92f7 Export and import SVGs with multiline text 2018-03-29 13:23:52 -04:00
Jürg Lehni
a61e83edf2 Simplify fix for #1452 2018-03-06 12:57:05 +01:00
Jonathan Park
74bb49d8c0 fix issue with svg import of raster images
When importing rasters after load if the image has a matrix with any translation/skew value
the image will calculate the wrong matrix after loading.

In order to correct this we append the translation rather than prepend so
that it happens in the correct order relative to the transformation.
2018-03-02 00:19:43 +00:00
Jürg Lehni
5f6c70d316 Use proper new statement in deserialization 2018-02-03 22:39:57 +01:00
Jürg Lehni
ec1e3262b6
Merge pull request #1374 from alexjlockwood/patch-2
Fix documentation for Shape#toPath()
2018-01-16 11:03:55 +01:00
DD
2af28e6c0e Merge branch 'develop' of github.com:LLK/paper.js into develop 2017-12-18 12:02:00 -05:00
DD
f2ae9bc6db Don't show handles when fully selected, it is too crowded 2017-12-18 12:01:45 -05:00
DD Liu
241d0749c8
Merge pull request #5 from fsih/hitTransparent
Add an option to hit closed paths with transparent or alpha 0 fill
2017-12-14 15:37:03 -05:00
DD
bf2a405ede Fix size 0 handle rendering 2017-12-12 15:05:00 -05:00
DD
4abc415002 Add an option to hit closed paths with transparent or alpha 0 fill 2017-12-12 12:14:59 -05:00
DD
fd1435d94d Fix tests and make Travis deploy scratch paperjs 2017-12-04 18:34:59 -05:00
DD
2d790a3f34 Copy changes in selection mode to src files 2017-12-04 18:23:42 -05:00
Jürg Lehni
193592b88b Release version 0.11.5 2017-10-08 17:48:07 +02:00
Jürg Lehni
0deddebb2c Merge pull request #1382 from sapics/patch-1
Fix path.isSelected
2017-10-05 16:16:29 +02:00
Jürg Lehni
702ab748a2 JSHint: Fix error 2017-10-05 12:09:07 +02:00
Jürg Lehni
6c5f1dc671 Node.js: Clean up image stream handling 2017-10-04 22:39:19 +02:00
therewasaguy
6939c1674b Node.js: Add JPEG support to exportFrames()
Closes #1166
2017-10-04 22:25:30 +02:00
Jürg Lehni
7412939096 Boolean: Add better filtering for invalid segments
Fixes #1385
2017-10-04 21:43:56 +02:00
Jürg Lehni
10f464edfc Boolean: Check that overlaps are on the right path
Closes #1321
2017-10-04 17:52:09 +02:00
Carl Saldanha
6a96a11549 Events: Fix auto-filling issue on Chrome
Closes #1358, closes #1365
2017-10-04 17:08:10 +02:00
sapics
1c5887433b Fix path.isSelected
This fixes #1378
2017-09-21 13:42:55 +09:00
Alex Lockwood
d51bb3fa31 Fix documentation for Shape#toPath() 2017-09-04 11:13:15 -04:00
Jürg Lehni
c403c86a23 Release version 0.11.4 2017-06-10 14:32:21 +02:00
Jürg Lehni
5d00c30ece Some internal refactoring. 2017-06-07 16:56:44 +02:00
Jürg Lehni
a6174d45a0 Fix documentation error.
Closes #1332
2017-05-28 11:04:11 +02:00
Jürg Lehni
bbb7bfeba7 Release version 0.11.3 2017-04-23 17:15:03 +02:00
Jürg Lehni
fbd5eeb7ef Mouse Events: Fix item-based doubleclick events.
Closes #1316
2017-04-22 20:01:08 +02:00
Jürg Lehni
188c006197 Update to straps.js v3.0.1 and make all functions and accessors enumerable. 2017-04-22 18:50:53 +02:00
Jürg Lehni
b26b056522 Prevent consumed properties in object literal constructors from being set on the instance.
We need to make sure arguments.__filtered survives constructor calls.
2017-04-22 13:52:03 +02:00
Jürg Lehni
e46c8ec340 Overhaul the caching of bounds and matrix decomposition.
Improves reliability of Item#rotation and #scaling and fixes situations caused by wrongly cached #position and #bounds values.
2017-04-22 12:55:42 +02:00
Jürg Lehni
90f816f959 Release version 0.11.2 2017-04-20 19:34:40 +02:00
Jürg Lehni
9320a720c2 PaperScript: Fix parsing error in math operations without white-space.
Closes #1314
2017-04-20 19:14:30 +02:00
Jürg Lehni
5046d6968b Release version 0.11.1 2017-04-20 18:43:16 +02:00
Jürg Lehni
d0a4532d94 Release version 0.11.0 2017-04-19 22:07:46 +02:00
Jürg Lehni
6ff6e1a05d Improve documentation about new NPM modules.
Relates to #1252
2017-04-19 20:27:14 +02:00
Jürg Lehni
a7d259bfc0 Release version 0.10.4 2017-04-19 19:55:21 +02:00
Jürg Lehni
7dea96c6f2 Docs: Fix wrong @link references to bean properties. 2017-04-13 12:24:56 +02:00
Jürg Lehni
2290ec0ff6 Improve unit test for new Path.Constructor({ insert: false }) 2017-04-10 09:30:52 +02:00
sapics
08b9dcecb8 Fix Path.Constructors.js initialization 2017-04-10 12:17:56 +09:00
Jürg Lehni
d436d07fee Intersections: Correctly handle item#applyMatrix = false
Closes #1289
2017-03-23 13:13:32 +01:00
Jürg Lehni
261fc02c1d SVG Import: Improve handling of sizes in percent.
Closes #1242
2017-03-23 00:14:03 +01:00
Jürg Lehni
a43db8427a Boolean: update documentation and optimize #divide()
#divide() with options.trace = false can call splitBoolean() just once without removing any split sub-paths.

Relates to #1221
2017-03-22 23:45:11 +01:00
Jürg Lehni
15471c76ab Boolean: Always return CompoundPath items.
Relates to #1221
2017-03-22 23:26:26 +01:00
Jürg Lehni
3c9d2eea1d Boolean: Implement options.trace, and add unit tests for options.trace = false
Relates to #1221
2017-03-22 15:03:11 +01:00
Jürg Lehni
ffa7e16f48 Use == false instead of === false for all options that default to true.
These expression are true:
- false == false
- false == 0
While these are false:
- false == null
- false == undefined
2017-03-22 14:42:11 +01:00
Jürg Lehni
dd56f86679 Boolean: Pass on options in PathItem#subtract(path, options)
Relates to #1221
2017-03-22 14:24:40 +01:00
Jürg Lehni
7e8e04351f Boolean: small optimization in computeStrokeBoolean() 2017-03-22 14:24:11 +01:00
Jürg Lehni
89d0536783 Scene Graphs: Do not allow inserting same item as child multiple times. 2017-03-21 11:55:42 +01:00
Jürg Lehni
29de03dc30 Node.js: Add code to handle separate shim modules.
Planend are the modules paper-jsdom and paper-jsdom-canvas, as shim modules that require and handle the dependencies as peer dependencies.

Relates to #1252
2017-03-20 12:38:52 +01:00
Jürg Lehni
48e9ef62a6 Boolean: Bring back on-path winding handling.
Relates to #1281
2017-03-20 01:02:12 +01:00
Jürg Lehni
49fca5510e Improve handling of Rectangle dimension properties.
Better deal with left / top / right / bottom / center values, and implement more unit tests for their behavior.

Closes #1147
2017-03-19 22:51:34 +01:00
Jürg Lehni
5c3e3ec34c Mouse Events: Improve mousedrag handling.
Relates to #1247, closes #1286
2017-03-19 16:15:34 +01:00
Jürg Lehni
7a2ccc6d44 More work on supporting hybrid contexts.
Relates to #1252
2017-03-19 16:03:29 +01:00
Jürg Lehni
89a953dde0 Docs: Add documentation for options.bound and options.matrix in #exportSVG()
Closes #1254
2017-03-19 14:50:59 +01:00
Jürg Lehni
e354bccf69 Include note about compiling for Electron.
And some smaller forgotten changes.

Closes #1276
2017-03-19 14:38:24 +01:00
Jürg Lehni
26993b2c36 Various minor improvements to getWinding() 2017-03-19 14:18:55 +01:00
Jürg Lehni
374107c439 Minor cleanup for previous commit. 2017-03-18 16:46:55 +01:00
Jürg Lehni
fdd42076f9 Intersections: Bring back special handling of curve end-points.
Revert commit 89e31dd393, and add further improvements:

- Implement unit tests for #1284
- Remove Rectangle#touches(rect) in favor of #intersects(rect, epsilon)

Closes #1284
2017-03-18 16:42:55 +01:00
Jürg Lehni
0ec06e7353 PaperScript: Give global.acorn the preference over the bundled one.
So people can load their own preferred version in sketch.paperjs.org

Relates to #1183
2017-03-11 20:53:35 +01:00
Jürg Lehni
29e7aba587 Prevent cleaning pre-existing styles when setting item.style to an object.
Until v0.10.2, doing so would merge in the new styles. We should keep this behavior for reasons of compatibility.

Closes #1277
2017-03-11 16:26:18 +01:00
Jürg Lehni
9a2f138f1d PaperScript: Fix positive unary operator. 2017-03-11 00:27:03 +01:00
Jürg Lehni
6ee59cd46e Prevent leakage of bundled Acorn into window.acorn
And fix Acorn loading under load.js
2017-03-10 23:56:06 +01:00
Jürg Lehni
62a0c9c36b Revert accidental condition sequence change.
`typeof module` needs to come before 2nd condition.
2017-03-10 23:21:21 +01:00
Jürg Lehni
69fb23d2ed Docs: Fix parameter sequence in Matrix constructor.
Closes #1273
2017-03-10 15:52:19 +01:00
Jürg Lehni
5dafc67278 Support newer, external versions of Acorn.js for PaperScript parsing, opening the doors to ES 2015.
Closes #1183, closes #1275
2017-03-10 15:41:35 +01:00
Jürg Lehni
f2e9fab264 Split Item#copyTo() into #addTo() and #copyTo() 2017-03-10 11:43:55 +01:00
Jürg Lehni
5291043a5f Fix how gradient matrices are handled when Item#applyMatrix = false
Closes #1238
2017-03-09 14:31:41 +01:00
Jürg Lehni
920cbaca99 Remove unused palettes array. 2017-03-09 12:50:43 +01:00
Jürg Lehni
083a09604d Hit-Tests: Fix issue with non-invertible matrices.
Closes #1271
2017-03-09 12:42:11 +01:00
Jürg Lehni
e145b1d4c2 Mouse Events: Only handle dragItem if the hitItem responds to mousedrag events.
Closes #1247
2017-03-08 23:42:03 +01:00
Jürg Lehni
f9d06d8ae4 Hit Tests: Implement options.position.
Closes #1249
2017-03-08 23:01:12 +01:00
Jürg Lehni
db4deb244f Fix calculation of internal bounds with children and applyMatrix = false
Closes #1250
2017-03-08 17:14:42 +01:00
Jürg Lehni
65da4fe3ed Clear parent's bounds cache when item's visibility changes.
Closes #1248
2017-03-08 16:21:34 +01:00
Jürg Lehni
26bf4f4749 Change getWinding() to include recommendation by @iconexperience
See https://github.com/paperjs/paper.js/issues/1261#issuecomment-283325168

Closes #1261
2017-03-08 15:55:51 +01:00
Jürg Lehni
677c073c84 Use GEOMETRIC_EPSILON instead of EPSILON in Path#arcTo() 2017-03-08 14:13:19 +01:00
Jürg Lehni
7a3e903b4d Add Line#getSignedDistance() 2017-03-08 14:12:49 +01:00
Jürg Lehni
155d5b879c Improve Path._addSquareCap() for use in path offsetting code. 2017-03-08 13:41:23 +01:00
Jürg Lehni
b587e0b5b8 Release version 0.10.3 2017-03-08 10:44:43 +01:00
Jürg Lehni
22bda0972d Intersections: Remove now unnecessary code.
Thanks to Curve#classify(), self-intersections are always in sequence.
2017-03-07 20:13:32 +01:00
Jürg Lehni
89e31dd393 Intersections: No more need for the special handling of curve end-points. 2017-03-07 20:11:04 +01:00
Jürg Lehni
ecc1edb6ea Revert d204175d39
Revert fat-line clipping optimization that checked for straight curves, as unfortunately it wasn't reliable in many edge cases.

Relates to #1263
2017-03-07 20:01:05 +01:00
Jürg Lehni
8461d8d9f4 Curve Intersection: Improve algorithm to work with correct version of isStraight()
Relates to #1269
2017-03-07 17:41:16 +01:00
Jürg Lehni
bad4d02766 Fix Curve#isStraight() to correctly consider handles.
Also include code that prevents Curve.getIntersections() from failing now. Work in progress. Relates to #1269
2017-03-07 14:13:39 +01:00
Jürg Lehni
1fad295600 Facilitate minification. 2017-03-07 12:34:59 +01:00
Jürg Lehni
d6c1ce2458 Make sure calls are always counted in addCurveIntersections()
recursions only need to be increased if we're not aborting.

See https://github.com/paperjs/paper.js/issues/1239#issuecomment-284265520
2017-03-06 11:32:18 +01:00
Jürg Lehni
b680ec05b9 Fix calls counting in addCurveIntersections() when dealing with straight curves.
See https://github.com/paperjs/paper.js/issues/1239#issuecomment-284340550
2017-03-06 10:13:14 +01:00
Jürg Lehni
b85fc988de Minor comment cleanup. 2017-03-01 12:37:08 +01:00
iconexperience
9f5f3192b7 Set curve time to 1 for curves completely right or left of point for better performance. Note that we cannot set the time to 0, because this would invoke special handling for crossing at the curve's start point. 2017-03-01 09:39:44 +01:00
iconexperience
86d05624c0 Fix addWinding() for special cases 2017-03-01 09:04:46 +01:00
Jürg Lehni
32db1eb005 Boolean: Some code and comment cleanup. 2017-02-26 01:11:33 +01:00
Jürg Lehni
4d3ca746ab Reduce windingEpsilon to 1e-9.
this address the issue outlined in https://github.com/paperjs/paper.js/issues/1261#issuecomment-282520748
2017-02-26 00:45:22 +01:00
Jürg Lehni
7b73ec238d Remove onPath winding hack again.
See #1073
2017-02-26 00:22:49 +01:00
Jürg Lehni
86478b6873 Boolean: Improve handling of branching at crossings. 2017-02-25 18:55:11 +01:00
Jürg Lehni
919c42af27 Implement Segment#isSmooth() and use it in handling of stroke-joins. 2017-02-25 15:45:58 +01:00
Jürg Lehni
f19a50093b Simplify handling of strokeJoin / strokeCap geometries. 2017-02-22 22:22:23 +01:00
Jürg Lehni
b40efbf6db Fix Line#getSide() imprecisions when points are on the line. 2017-02-22 17:41:51 +01:00
Jürg Lehni
6a4347e75b Optimize Curve#hasLength()
Only check the handles that are actually part of the curve.

Closes #1260
2017-02-22 17:29:23 +01:00
Jürg Lehni
919615f168 Remove CurveLocation#getOffsetTo() again. 2017-02-22 17:05:23 +01:00
Jürg Lehni
e3828d810b When aborting fat-line clipping, attempt an approximation with line intersections. 2017-02-22 13:58:27 +01:00
Jürg Lehni
ba2b18c7dc Small improvement in Path#arcTo() to reduce segment account in edge cases. 2017-02-22 13:57:51 +01:00
Jürg Lehni
d204175d39 Improve and optimize fat-line clipping algorithm.
By checking if subdivided curves are straight and falling back on line-line / line-curve approach if they are.
2017-02-21 23:09:30 +01:00
Jürg Lehni
caac1c18e3 Implement CurveLocation#getOffsetTo(location) 2017-02-21 22:19:38 +01:00
Jürg Lehni
ee48e6cd03 Implement caching for CurveLocation#curveOffset. 2017-02-21 22:19:17 +01:00
Jürg Lehni
f089c3c620 Improve handling of new segments in CurveLocation#divide() and #split() 2017-02-21 22:16:55 +01:00
Jürg Lehni
ed57b82b19 Boolean: Improve handling of multiple crossings on the same curve. 2017-02-21 22:05:38 +01:00
Jürg Lehni
357ff0dd43 Reduce epsilon in fat-line clipping to 1e-12 and adjust unit tests.
These results make much more sense and the algorithm finds less false positives while still behaving reliably in all edge cases.
2017-02-16 14:05:05 +01:00
Jürg Lehni
2343ed5ca9 Remove checks for begin- and end-points in getCurveIntersections()
See #1239
2017-02-16 14:00:18 +01:00
Jürg Lehni
4f9d23da81 Use consistent boundary policy when dealing with curve-time. 2017-02-16 13:41:53 +01:00
Jürg Lehni
e3c6245979 Docs: Improve description of option.class value in #hitTest()
See #632
2017-02-15 16:11:33 +01:00
Jürg Lehni
1ff4bc9665 More cleanup in curve intersection code. 2017-02-12 15:52:56 +01:00
Jürg Lehni
2ead16ca89 Rename Curve.getCurvesIntersections() to Curve. getIntersections() 2017-02-12 15:47:01 +01:00
Jürg Lehni
bd98e067c3 Docs: Some cleanup in Curve. 2017-02-12 15:42:12 +01:00
Jürg Lehni
df7323da32 Improve handling of excludeStart / excludeEnd in curve intersections. 2017-02-12 15:27:59 +01:00
Jürg Lehni
45f5bf84e8 Enforce creation of Curve#values getter despite hidden parameter. 2017-02-12 12:15:59 +01:00
Jürg Lehni
286765f4b0 Further optimizations in getOverlaps() 2017-02-11 21:32:11 +01:00
Jürg Lehni
23202d0c80 Some code optimizations and cleanup. 2017-02-11 21:25:42 +01:00
Jürg Lehni
1b50355585 Improve getCurveIntersections() for use with neighboring curves.
As needed by bezier offsetting code.
2017-02-11 21:19:47 +01:00
iconexperience
af7b22a708 Add Line.getDistance() and use it in Curve.getOverlaps() 2017-02-07 16:15:41 +01:00
Jürg Lehni
13f4773985 Fix documentation of Project#hitTestAll()
Relates to #536
2017-02-06 18:36:00 +01:00
Jürg Lehni
b23c272d69 Minor code cleanup. 2017-02-06 16:46:22 +01:00
Jürg Lehni
4588a90952 Expose Curve.getCurvesIntersections()
To be used in offsetting code to check for self-intersections.
2017-02-06 16:37:05 +01:00
Jürg Lehni
fafbd9ad36 Expose Curve. getCurveLineIntersections() for curve offsetting. 2017-02-05 21:59:56 +01:00
Jürg Lehni
8c3c771891 Streamline handling of abscissa and ordinate flipping. 2017-02-05 21:59:29 +01:00
Jürg Lehni
1f768c69d2 Move private getPeaks() to Curve.getPeaks()
It will be of use in the offsetting code as well.
2017-02-05 14:20:43 +01:00
Jürg Lehni
7fc029d98b More quality related tweaks in getWinding() 2017-02-04 21:55:44 +01:00
Jürg Lehni
fb4a0b1fe0 No need to change the winding values here.
But onPath is crucial. Relates to #1073
2017-02-04 21:38:56 +01:00
Jürg Lehni
4d6ebe2f3f Switch to absolute winding values in getWinding()
That’s what the previous code was already doing, but cryptically so. Relates to #1073
2017-02-04 21:38:17 +01:00
Jürg Lehni
0e8b304715 Improve handling of quality value in getWinding()
Relates to #1073
2017-02-04 21:37:05 +01:00
Jürg Lehni
bbcfa644d9 Bring back accidentally removed winding object fallback. 2017-02-04 20:50:22 +01:00
Jürg Lehni
69c124c36c Merge remote-tracking branch 'origin/improved-reorient' into develop
; Conflicts:
;	src/path/PathItem.Boolean.js
2017-02-04 20:20:21 +01:00
Jürg Lehni
9af936514e Minor code cleanups. 2017-02-04 20:14:35 +01:00
Jürg Lehni
d18fa8bb03 Support multiple gradient offsets at 0
Closes #1241
2017-01-24 18:14:56 -05:00
Jürg Lehni
4833c588e5 Improve comments. 2017-01-24 08:22:03 -05:00
Jürg Lehni
1806b5959e Improve tangent direction handling in isCrossing()
Find unambiguous vectors by taking inception points and “peaks” into account.

Relates to #1073, #1074
2017-01-24 07:50:40 -05:00
Jürg Lehni
a410aafaf2 Remove unused property. 2017-01-24 06:52:27 -05:00
Jürg Lehni
8bbbe149ea More simplifications related to reorientPaths() 2017-01-22 12:08:54 -05:00
Jürg Lehni
f77621f67d Various improvements to new reorient() code
- Merge insideWindings object with operators lookup
- Optimize handling of excluded paths
- Improve contour handling in unite operations
2017-01-22 11:44:40 -05:00
Jürg Lehni
4e215b0eab Unify naming of bezier coordinates in internal calculations. 2017-01-17 12:05:32 +01:00
Jürg Lehni
6e96fd6be5 Replace accidental substitution of Numerical.CURVETIME_EPSILON. 2017-01-17 11:24:33 +01:00
Jürg Lehni
da52f1f685 Remove Numerical.TOLERANCE 2017-01-16 17:48:26 +01:00
Jürg Lehni
13accee9fd Some code optimizations in PathFitter. 2017-01-16 17:47:28 +01:00
Jürg Lehni
12f12da21b Minor code cleanup. 2017-01-15 18:53:23 +01:00
Jürg Lehni
77cb04154a Reduce CURVETIME_EPSILON to 1e-8. 2017-01-15 18:44:02 +01:00
Jürg Lehni
2ca34cddac Prevent rare case where we get excluded intersections without valid curves at the start. 2017-01-15 18:43:47 +01:00
Jürg Lehni
3d4430f8af Improve CurveLocation#equals() to only compare path offsets.
Relying solely on GEOMETRIC_EPSILON when comparing intersections instead of CURVETIME_EPSILON improves reliability.
2017-01-15 18:43:14 +01:00
Jürg Lehni
f996f035ca Rename local epsilon in addCurveIntersections() to fatLineEpsilon. 2017-01-15 18:41:40 +01:00
Jürg Lehni
a101183fba Remove EPSILON constants that are only used in one place in the code.
CLIPPING_EPSILON and WINDING_EPSILON are too specific to be in Numerical.
2017-01-15 11:47:23 +01:00
Jürg Lehni
cf2ebbaaf8 Partly revert 09785a504b
To make the edge-case in #1239 work again. Also add unit tests for edge-case.
2017-01-15 11:34:02 +01:00
Jürg Lehni
fa43e28b7a Slightly improve documentation for #1235 2017-01-11 15:16:22 +01:00
Jürg Lehni
e7b53c8a22 Implement Curve#classify() based on Loop and Blinn.
And use it to simplify curve self-intersection handling.

Relates to #773, #1074, Closes #1235
2017-01-11 15:01:10 +01:00
Jürg Lehni
36f5b314d9 Update JSDoc and a minor documentation fix. 2017-01-11 14:45:52 +01:00
Jürg Lehni
9cb45157b9 Use the correct term for renormalization of curve-time after splitting. 2017-01-10 16:51:53 +01:00
Jürg Lehni
acd6b143db Sample winding at t = 0.5 before trying 0.25 at 0.75
This partly reverts commit 50c910b03a.
2017-01-10 13:34:50 +01:00
Jürg Lehni
673d157f31 Implement unit tests for #1116
Closes #1116
2017-01-08 15:07:40 +01:00
Jürg Lehni
0ae2ded9cc Fix handling of hit-test tolerance on scaled items with #applyMatrix = false
Closes #1195
2017-01-08 14:34:58 +01:00
Jürg Lehni
50c910b03a Switch back to sampling winding at t = 1/4, 2/4, 3/4
Due to curve-time clamping, this should now be OK.

Relates to #1073
2017-01-06 14:23:27 +01:00
Jürg Lehni
8ba6e19a2c Bring back handling of onPath edge cases in getWinding()
Relates to #1073
2017-01-06 14:22:20 +01:00
Jürg Lehni
1c7d19bba0 Improve getWinding() reliability by clamping curve-time to tMin <= t <= tMax 2017-01-06 14:17:38 +01:00
Jürg Lehni
31aa68b2d1 Some further code cleanup for 3c2588fdec 2017-01-06 14:15:32 +01:00
Jürg Lehni
7583e6ed5f Merge branch 'improved-winding-2' into develop and clean up formatting. 2017-01-06 12:12:43 +01:00
Jürg Lehni
ed38634a80 Improve comments. 2017-01-03 13:41:26 +01:00
Jürg Lehni
4d81a292a2 Return correct values for #rotation and #scaling on items with #applyMatrix = true
While preserving caching for #applyMatrix = false

Relates to #1004, #1177
2017-01-03 13:39:35 +01:00
Jürg Lehni
aa75374406 Bring back caching of Item#rotation and #scaling
But only allow matrix decomposition based properties on items with #applyMatrix = false

Closes #1177, relates to #1004
2017-01-03 13:23:44 +01:00
Jürg Lehni
ede9ef2623 Revert 7dd0b852c8
Relates to https://github.com/paperjs/paper.js/issues/1233#issuecomment-269972157
2017-01-03 00:53:54 +01:00
Jürg Lehni
46fce16bff Fix handling of overlapping paths for subtract and exclude operations.
Closes #1139
2017-01-03 00:50:22 +01:00
Jürg Lehni
0018b69e4d Improve handling of locations with invalid curves in divideLocations() 2017-01-03 00:20:10 +01:00
Jürg Lehni
b743f456b3 Improve handling of changing curves in CurveLocation.
Relates to #1233
2017-01-03 00:08:28 +01:00
Jürg Lehni
468bb04919 Imrpove bi-directional curve-time rescaling in divideLocations()
Closes #1191
2017-01-02 00:32:21 +01:00
Jürg Lehni
e24402542a Improve handling of SymbolItem in#hitTestAll()
Closes #1199
2017-01-01 18:32:45 +01:00
Jürg Lehni
eceb99ea59 Clean up comments. 2016-12-31 13:32:59 +01:00
Jürg Lehni
7651f41c14 Some code cleanup. 2016-12-31 11:33:18 +01:00
Jürg Lehni
f995216f39 Fix handling of self-intersection in PathItem#getIntersections
Closes #1194
2016-12-31 11:30:38 +01:00
Jürg Lehni
928a58b79a Fix accidental global leackage. 2016-12-31 06:52:56 +01:00
Jürg Lehni
87fe0dd7cd Fix typo. 2016-12-31 06:50:08 +01:00
Jürg Lehni
c21e19b303 Fix overlap sequence handling in Path#compare()
Closes #1223
2016-12-31 06:49:57 +01:00
Jürg Lehni
88453914e5 Make sure overlaps are always returned in correct sequence.
Relates to #1223
2016-12-31 01:09:28 +01:00
Jürg Lehni
aa2e1d753b Implement Path#divideAt(), similar to Curve#divideAt() 2016-12-31 01:07:14 +01:00
Jürg Lehni
d405f45d38 Correctly handle offset in Curve#divideAt(offset)
Closes #1230
2016-12-31 00:34:37 +01:00
Jürg Lehni
771bb61038 Fix matrix cloning for groups with #applyMatrix = false
Closes #1225
2016-12-30 13:25:08 +01:00
Jürg Lehni
27a2757542 Merge pull request #1209 from iconexperience/patch-3
Fix length comparison in Path.compare()
2016-12-29 10:55:31 +01:00
Jürg Lehni
767a438286 Merge pull request #1210 from sapics/mini-patch
Replace nodejs version 5 to 6 in Travis
2016-12-29 09:34:05 +01:00
Jürg Lehni
b59baeb9aa Fix stroke hit-testing for rounded shape items.
Closes #1207
2016-12-23 23:11:17 +01:00
iconexperience
61df327bc2 Implement improved reorientation of paths, that can also be used by non-crossing boolean operations. 2016-12-17 18:43:48 +01:00
sapics
3f909da253 Fix example in jsdoc 2016-12-10 12:58:56 +09:00
sapics
523251a288 Use Math.SQRT2 instead of Math.sqrt(2) 2016-12-03 17:32:50 +09:00
sapics
8e5b804d6e Fix typo in comment 2016-12-03 17:31:27 +09:00
Jan
1700a326b1 Fix length comparison in compare()
Path.compare() returned a wrong result if one of the paths were empty. This little change fixes the behaviour.
2016-12-02 16:06:18 +01:00
Jürg Lehni
4281800585 Added missing apostrophe.
Closes https://github.com/paperjs/paperjs.org/pull/25
2016-12-01 21:45:38 -05:00
Jürg Lehni
1f822b1faa Merge pull request #1155 from iconexperience/propagateWinding-pythagoras-fix
Use correct value for y 45 degree tangent
2016-11-28 18:50:11 -05:00
Jürg Lehni
63cb7bd536 Merge pull request #1193 from iconexperience/patch-1
Fix two issues in PathItem.compare()
2016-11-22 19:05:06 -05:00
Jürg Lehni
d779789b6f PaperScript: Prevent invalid JavaScript in assignment operators.
Closes #1151
2016-11-20 21:12:02 -05:00
Jürg Lehni
3c43a78c53 Properly handle generated IDs in SVG export.
Closes #1138
2016-11-20 20:53:41 -05:00
Jürg Lehni
8946f44ed9 Fix curve-bounds check in getIntersections()
Closes #1197
2016-11-20 20:19:38 -05:00
Jan
eef2297935 Fix two issues in compare()
Variable `count` was never initialized, so incrementing resulted in a NaN.
Creating `paths2` failed if `path._children` was `undefined`.
2016-11-04 15:09:28 +01:00
Jürg Lehni
6dd7cc5b6a Fix imprecision in Numerical.findRoot()
Results can be slightly outside of the range.
Close #1149
2016-09-24 15:39:09 -04:00
Jürg Lehni
7dd0b852c8 Remove further unneeded GEOMETRIC_EPSILON curve-end checks. 2016-09-24 14:48:42 -04:00
Jürg Lehni
b37b8cc495 Improve reliability of Curve.getIntersection()
Reduce epsilon when checking against curve end points from GEOMETRIC_EPSILON to EPSILON.

Coses #1174
2016-09-24 14:28:43 -04:00
Jürg Lehni
3eafd5256a Fix omission in recent renaming. 2016-09-24 14:17:20 -04:00
Jürg Lehni
fbb0c59598 Always use un-scaled curve-time in divideLocations()
Fixes #1169
2016-09-23 06:55:12 -04:00
Jürg Lehni
d3ac1b4c94 Prevent CurveLocation#toString() calls in bitwise xor comparison.
See https://twitter.com/juerglehni/status/778962612197453824
2016-09-22 10:44:23 -04:00
Jürg Lehni
dbe3aa42ec Fix typo in error message. 2016-09-22 10:42:47 -04:00
Jürg Lehni
3a49ac4015 Handle paths with only one segment in #resolveCrossings()
Closes #1167
2016-09-20 18:13:47 -04:00
Jürg Lehni
0af4c5c0f1 Introduce Curve#hasLength() as an optimized check for curve-length.
And use it where it make sense.

Relates to https://github.com/paperjs/paper.js/issues/1109#issuecomment-234352266
2016-09-20 17:59:56 -04:00
Jan
3b8d3cc47d Use Math..SQRT1_2 instead of 0.7071
Makes code easier to understand.
2016-08-31 23:29:35 +02:00
Jan
f160e74936 Use correct value for y 45 degree tangent
I got the pythagoras wrong when I wrote this. The length of the tangent vector is 1, therefore the y component is sqrt(0.5) for 45°. This will not make any difference, but still we should use the correct value.
2016-08-31 10:05:47 +02:00
Jürg Lehni
cecd95e039 SVG: Correctly handle multiple sequential move commands.
Closes #1134
2016-08-07 21:36:03 +02:00
Jürg Lehni
0396446c4c Boolean: Clean up previous fix. 2016-08-07 15:55:27 +02:00
sapics
31690cb6b6 Fix to remove named layer 2016-08-06 11:00:29 +09:00
Jürg Lehni
75a10fb246 Boolean: Clear branch so we start with a new one on the next contour. 2016-08-04 12:21:58 +02:00
Jürg Lehni
79661c35e6 Some code cleanup in View#setViewSize() 2016-08-03 13:33:58 +02:00
Jürg Lehni
91371c1b47 Keep view.bounds in sync during 'resize' events.
Closes #1127
2016-08-03 13:08:08 +02:00
Jürg Lehni
fa3456341c Fix view flickering during window resizes.
Closes #1126
2016-08-01 17:10:00 +02:00
Jürg Lehni
78c5c27bb3 Boolean: More work on new branching code.
It now checks all intersections when there are multiple options first.
2016-07-28 12:14:02 +02:00
Jürg Lehni
f4f4b3472f Minor code optimization. 2016-07-27 22:58:57 +02:00
Jürg Lehni
17cca2984b Boolean: Make sure we're actually comparing multiple intersections. 2016-07-27 22:57:08 +02:00
Jürg Lehni
4c12f1505c Clean up previous commit. 2016-07-27 21:48:55 +02:00
Jürg Lehni
445d8ae22f Boolean: Implement branch structure to be able to go back on traces and try different crossings.
Relates to #1073
2016-07-27 21:40:53 +02:00
Jürg Lehni
c80c13eb9e Remove _closed parameter from PathItem#isClockwise() again. 2016-07-27 19:41:23 +02:00
Jürg Lehni
14b2d76450 Boolean: Improve handling of visited segments in intersect() operations.
Closes #1123
2016-07-27 19:35:19 +02:00