Commit graph

6793 commits

Author SHA1 Message Date
Jürg Lehni
a29ada8f23 Rename PathIterator back to PathFlattener. 2016-07-27 14:18:01 +02:00
Jürg Lehni
753b27afe0 Minor code and comments cleanup. 2016-07-27 14:11:58 +02:00
Jürg Lehni
9a49c2141c Two minor fixes in Base. 2016-07-26 10:25:32 +02:00
Jürg Lehni
34c57a47fa Use faster loop to handle prioritize in Base.filter() 2016-07-26 10:20:30 +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
e2e024f8a5 Winding: Don't mix up onPath and onCurve. 2016-07-23 18:50:58 +02:00
Jürg Lehni
31732917c0 Winding: Improve handling of on-curve tangent checks. 2016-07-23 13:30:40 +02:00
Jürg Lehni
27af304414 Improve new getWinding() direction flipping code. 2016-07-22 23:30:36 +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
0b11f9e2dc Allow getWinding() to flip direction when on the path.
Flipping will only occur when the encountered tangent is parallel to the ray. Relates to #1116
2016-07-22 16:50:39 +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
a5d04ef97c Address minor omission in previous commit. 2016-07-22 00:05:21 +02:00
Jürg Lehni
a5a0e90bee Implement PathItem#compare() to support compound-paths.
Still needs testing.
2016-07-21 23:07:01 +02:00
Jürg Lehni
ccac7ec7c5 Implement Path#compare() to compare for geometric equality of shapes.
Use it in boolean operations when handling fully overlapping paths.

Relates to #1109
2016-07-21 20:57:39 +02:00
Jürg Lehni
baf58fb021 Improve documentation of PathItem#getArea() and PathItem#isClockwise() 2016-07-21 15:30:31 +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
fc72c05e69 Add sort parameter to PathItem#reorient()
And improve documentation. Relates to #590, WIP
2016-07-21 13:50:55 +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
Jan
4c61153bd4 Improve fat line clipping to fix #1088
Only alternate curves in addCurveIntersections() if interval on other curve is not tight enough yet.
2016-07-20 16:32:20 +02:00
Jürg Lehni
f988445dad Boolean: Implement optimization for operands without crossings.
Closes #1113
2016-07-20 16:15:10 +02:00
Jürg Lehni
88db4473a4 Merge pull request #1114 from iconexperience/W3C-PathItem-tests
Add tests from W3C SVG Test Suite
2016-07-20 15:42:04 +02:00
Jan
46d0bf2d7d Add tests from W3C SVG Test Suite 2016-07-20 15:29:19 +02:00
Jürg Lehni
c338e9a6ec Tests: Add another SVG path data test. 2016-07-20 15:10:23 +02:00
Jürg Lehni
cb6eab7b0e Merge pull request #1112 from iconexperience/getWinding-patch
Change winding calculation if point on path
2016-07-20 10:50:33 +02:00
Jan
3f893c9fb7 Change winding calculation for points on path
Add a winding if the point is on the path and windings canceled each other. See discussion at #1109
2016-07-20 10:47:01 +02:00
Jürg Lehni
1264c2764c Shorten code statement from #1111 2016-07-20 10:29:27 +02:00
Jürg Lehni
d1c8ed9203 Merge pull request #1111 from iconexperience/resolveCrossings-patch
Patch for resolveCrossings() to fix #1110
2016-07-20 10:27:24 +02:00
Jan
08f633e7e6 Transfer handle when removing segment 2016-07-20 10:05:03 +02:00
Jürg Lehni
f874b927bf Reflect View#zoom through matrix decomposition, and implement additional decomposed properties.
Closes #1107
2016-07-20 00:04:24 +02:00
Jürg Lehni
4d9c0c9f05 Implement CompoundPath#getLength() 2016-07-19 19:09:23 +02:00
Jürg Lehni
08a23e3318 Boolean: Further improve segment sorting approach. 2016-07-19 16:14:46 +02:00
Jürg Lehni
2c8f4f9453 Boolean: Fix sort function to produce correct resutls on all browsers. 2016-07-19 14:55:57 +02:00
Jürg Lehni
0b672cfb62 Merge branch 'new-winding' into develop 2016-07-19 14:27:45 +02:00
Jürg Lehni
59d598f08e Some documentation improvements for previous commit. 2016-07-19 13:14:26 +02:00
Jürg Lehni
e539633852 Implement new and shorter segments array notation.
Supporting:

- Closing paths by including `true` as the last entry
- Nested segment arrays that can be passed to PathItem.create() and the CompoundPath constructor to create all sub-paths
2016-07-19 13:08:21 +02:00
Jürg Lehni
13a68cec46 Fix failing unit test, and some code cleanup. 2016-07-19 10:24:37 +02:00
Jürg Lehni
288c3d4012 Fix issue in setPathData(), horizontal or vertical lineto and relative moveto commands.
Relates to #1101
2016-07-19 10:09:55 +02:00
Jürg Lehni
ad48e93ee9 SVG: Output 'h' and 'v' commands in #getPathData() 2016-07-18 21:07:30 +02:00
Jürg Lehni
32d8c969fb Clean up handling of #_set(), #set() and #initialize()
Convention:

- #_set() is for actually setting properties, e.g. on Point, Size, so that derived classes can reuse other parts (e.g. SegmentPoint)
- #set() is a shortcut to #initialize() on all basic types, to offer the same amount of flexibility when setting values.
2016-07-18 20:11:01 +02:00
Jürg Lehni
2e054ecf47 Deactivate unit test for #944 edge case for now… 2016-07-18 16:13:33 +02:00
Jürg Lehni
e7c53b904c Implement unit test for #973. 2016-07-18 14:11:34 +02:00
Jürg Lehni
3f058e6471 Split #resolveCrossings() into #resolveCrossings() and #reorient()
Closes #973
2016-07-18 14:04:51 +02:00