Commit graph

809 commits

Author SHA1 Message Date
Samuel Asensi
5cd1ca13c5 Fix item global matrix error (#1562)
Bug happen when item is drawn after an empty symbol that should be drawn
in a separate canvas context (partial opacity or special blend mode).
As bounds are empty, symbol drawing process is interrupted but its
global matrix is not removed from the stack.
Closes #1561
2018-10-13 14:41:38 +02:00
Jürg Lehni
4c035ada36 Minor fixes in comments and tests. 2018-10-10 23:03:57 +02:00
Jürg Lehni
fd1a517e84 Improve hex Color parser
Addresses changes in #1469
2018-10-06 21:57:30 +02:00
PeterLazar
a8f78859cb Add hexadecimal with alpha color parsing
Closes #1468
2018-10-05 20:14:20 +02:00
Samuel Asensi
c235d6a917 Implement Curve#getTimesWithTangent()
and Path#getOffsetsWithTangent()
2018-10-05 09:44:42 +02:00
Jürg Lehni
47af603173 Support alpha channel in named CSS colors
Closes #1539
2018-10-04 17:26:48 +02:00
Jürg Lehni
28dec90a88 Wrap up Raster#smoothing feature 2018-10-03 19:01:02 +02:00
Jürg Lehni
144370169e
Merge pull request #1529 from sasensi/Fix_#1521_adding_raster.smoothing_property
Fix #1521 adding Raster.smoothing property
2018-10-03 18:38:01 +02:00
Jürg Lehni
6a278c040a Minor clean-ups for the past few PRs 2018-10-03 18:21:26 +02:00
Jürg Lehni
959ccc83c2
Merge pull request #1531 from sasensi/Fix_#1503_Item#position_caching_issue
Fix #1503 Item#position caching issue
2018-10-03 17:33:24 +02:00
Jürg Lehni
27b92a6007 Improve handling of push() with lots of items
Improves fix for #1493, should pass CI again
2018-10-03 16:45:38 +02:00
Jürg Lehni
da3a36230f Color: Improve CSS string parser and docs 2018-10-03 15:56:15 +02:00
Jürg Lehni
a148e61129
Merge pull request #1534 from sasensi/Fix_#1493_Path#add_crashes_whith_1000000_segments
Fix #1493 Path#add crashes whith 1000000 segments
2018-10-03 10:18:15 +02:00
sasensi
f673542640 Refactor code to fit style rules 2018-10-02 19:28:35 +02:00
sasensi
fc5bb4b10e Fix #1493 Path#add crashes whith 1000000 segments 2018-10-02 14:09:34 +02: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
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
1331554862 Fix:test replace gif to png because jsdom causes error 2018-09-29 08:55:41 +09:00
sasensi
9a8aae00bd Fix #1506 #1513 by checking winding quality in boolean subtraction 2018-09-26 14:05:29 +02: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
10f464edfc Boolean: Check that overlaps are on the right path
Closes #1321
2017-10-04 17:52:09 +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
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
2290ec0ff6 Improve unit test for new Path.Constructor({ insert: false }) 2017-04-10 09:30:52 +02:00
sapics
018cb6285a Add test for Path.Constructors initialization 2017-04-10 13:08:35 +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
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
89d0536783 Scene Graphs: Do not allow inserting same item as child multiple times. 2017-03-21 11:55:42 +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
ab45002003 Tests: Clean up Rectangle unit tests. 2017-03-19 19:26:07 +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
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
993afe3c83 Tests: Implement unit tests for #1277 2017-03-12 11:11:14 +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
083a09604d Hit-Tests: Fix issue with non-invertible matrices.
Closes #1271
2017-03-09 12:42:11 +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
cbc873cfd8 Merge pull request #1265 from iconexperience/new-unite-tests
Add some unit tests for boolean unite operations
2017-03-08 15:47:54 +01:00
Jürg Lehni
5ea09c2fa2 Tests: Implement unit test for #1270.
Closes #1270.
2017-03-07 20:57:47 +01:00
Jürg Lehni
fd797425e0 Tests: Fix unit test for #1239.
Adjust for increase of found intersections since ecc1edb6ea.
2017-03-07 20:15:59 +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
867d0874dc Tests: Implement unit test for #1269.
Closes #1269.
2017-03-07 17:41:37 +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
7448aedf67 Tests: Show SVG path data when boolean results are different. 2017-03-07 11:04:11 +01:00
iconexperience
5359bc428e Add some unit tests for boolean unite operations 2017-03-01 14:07:17 +01:00
Jürg Lehni
5c86330d6e Tests: Implement unit test for #1261. 2017-02-26 01:03:35 +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
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
f16b91e0fe Tests: Implement unit test for #1233 2017-02-21 22:10:08 +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
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
535607931c Unit tests for boolean operations without crossings.
Closes #1113
2017-02-04 20:15:23 +01:00
Jürg Lehni
6ad5bfafee Implement unit test for #1073
Closes #1073, closes #1074
2017-01-25 07:55:37 -05: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
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
2145efb29b Implement more unit tests for #1109
Closes #1109
2017-01-08 15:14:47 +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
46fce16bff Fix handling of overlapping paths for subtract and exclude operations.
Closes #1139
2017-01-03 00:50:22 +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
7d3d7351ab Implement more PathItem#compare() tests.
Two failing for now.
2016-12-31 01:07:50 +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
c12f7c4a64 Start implementing unit tests for PathItem#compare() 2016-12-29 10:56:06 +01:00
Jürg Lehni
97abd80bab Replace all occurences of Math.sqrt(2) with Math.SQRT2 2016-12-29 10:56:06 +01:00
Jürg Lehni
41f7e58ca9 Include issue number forgotten in previous commit. 2016-12-23 23:13:18 +01:00
Jürg Lehni
b59baeb9aa Fix stroke hit-testing for rounded shape items.
Closes #1207
2016-12-23 23:11:17 +01: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
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
80f6dbb5e3 Implement unit test for #1091
Closes #1091
2016-09-24 14:53:36 -04:00
Jürg Lehni
287f48a0db Implement unit test for #1165
Closes #1165
2016-09-24 14:34:46 -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
b4f6cde203 Tests: Handle null values when comparing items. 2016-09-20 18:43:02 -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
6e7fe67a8d Implement unit tests for #1109. 2016-08-09 10:01:35 +02:00
Jürg Lehni
7a63afc769 Clean up Layer unit tests a bit. 2016-08-07 15:58:54 +02:00
sapics
31690cb6b6 Fix to remove named layer 2016-08-06 11:00:29 +09:00
Jürg Lehni
bcd02129a3 Implement additional unit test for #1054. 2016-07-27 20:12:29 +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
Jürg Lehni
e643338422 Add options object to boolean operations and improve handling of open paths.
This closes #1036, closes #1072, closes #1089 and closes #1121
2016-07-27 17:09:52 +02:00
Jürg Lehni
3f76bd99ef Implement an efficient mechanism to prioritize key in Item#set()
Closes #1096
2016-07-25 23:17:45 +02:00
Jürg Lehni
4954f5d6ab Improve Style#equals() to correctly handle default values.
Closes #1084
2016-07-25 21:42:06 +02:00
Jürg Lehni
29768c8228 Take Color#alpha default into account in Color#equals()
Relates to #1084
2016-07-25 21:09:53 +02:00
Jürg Lehni
eab0b9db5e Correctly handle path.replaceWith(path) calls.
Closes #1118
2016-07-22 23:29:33 +02:00
Jürg Lehni
cbe41c536e Boolean: Return the full winding object from _getWinding() and use it to improve PathItem#contains() with even-odd full-rule.
Also store the full winding object on the processed segments, to have more information available in boolean operations.
2016-07-22 15:46:42 +02:00
Jürg Lehni
23f3097f84 Facilitate code minification in PathIterator. 2016-07-22 14:21:35 +02:00
Jürg Lehni
becac4c921 Use shorter zero checks for array indices and length.
Keeping === 0 for mathematical algorithms seems clearer.
2016-07-22 13:46:24 +02:00
Jürg Lehni
3d57216ffe Update test for #944 to work with new way of handling compound-paths.
But keep deactivated as it is currently failing, see #1116
2016-07-22 13:15:05 +02:00
Jürg Lehni
a0417040f8 Improve handling of sub-path orientation in CompoundPath.
Remove automatic orientation on insertion, as it caused more troubles than solved problems, in favor of the new PathItem#reorient() method, or the even-odd fill-rule.

Closes #590, #1029
2016-07-21 15:21:45 +02:00
Jürg Lehni
16e53cc1ad Minor reformatting and changes.
no need for paper namespace in unit test code
2016-07-20 17:58:47 +02:00
Jürg Lehni
58991a569e Merge pull request #1115 from iconexperience/addCurveIntersections-patch
Improve fat line clipping to fix #1088
2016-07-20 17:56:04 +02:00
Jan
381e92501a Add test for #1088 2016-07-20 16:33:13 +02:00
Jürg Lehni
a683486ff5 Some code cleanup for previous commits, and shorten boolean tests a bit. 2016-07-20 16:32:21 +02:00
Jürg Lehni
f988445dad Boolean: Implement optimization for operands without crossings.
Closes #1113
2016-07-20 16:15:10 +02:00