1
0
Fork 0
Commit graph

184 commits

Author SHA1 Message Date
Jonathan Haas
55e776db2c add unit tests for circleSegment method 2024-07-12 07:29:11 +02:00
joostdecock
eded9e9d3a fix(core): Handle path splits on start or end points
In some edge cases, like when splitting a path on or very close to its
start or end point, `Path.split()` will return an array in which one of
the elements is not a Path object, but rather an empty array.

That is rather combersome to check for, so this changes that behaviour
and will return null for such cases.

I've also updated the documentation to clarify this behaviour.

Fixes #6816

This also fixes a bug when a path was being split on its end point.
2024-06-12 13:24:42 +02:00
Joost De Cock
f82ebd97d8
Merge pull request #6558 from HaasJona/add/path-angle
add(core): Add Path.angleAt(point) method
2024-04-18 19:02:26 +02:00
Joost De Cock
281a04c37f
Merge pull request #6527 from HaasJona/fix/path-offset
fix(core): Path.offset(...) improvements
2024-04-16 19:07:55 +02:00
Jonathan Haas
25059b818f Add test for path.angleAt 2024-04-15 18:28:49 +02:00
Jonathan Haas
080874dd88
fix(core): Path.offset(...) no longer fails on very short curves or zero length paths. Fixes #6519 2024-04-08 08:25:09 +02:00
Jonathan Haas
849563d1ec
add(core): Add Path.rotate(...) function analogue to Point.rotate(...) 2024-04-05 14:45:20 +02:00
joostdecock
2b36340cb8 chore(core): Remove unused var in tests 2024-03-16 12:19:42 +01:00
joostdecock
88cbd6a4f9 chore(core): Drop the chai-string dependency for tests
We're using chai-string as it provides the `equalIgnoreSpaces`
assertion which we use in our SVG tests.

However, that package does not seem to be maintained, and lists chai v4
as its peer dependency. We've moved on to chai v5 and this is causes
issues in one of our github workflows as dependencies cannot be
resolved.

So, I've extracted the assertion we need, and dropped the dependency.
2024-03-16 12:10:31 +01:00
joostdecock
a30b08371c feat(core): Added Path.combine and related changes, closes #5976
The discussion in #5976 is whether `Path.join()` should use a line
segment to close any gaps in the path caused by move operations, or by
differences in the end and start points of paths being joined.

The answer is yes, that is the intended behaviour, but people who read
_join_ might expect differently.

So I have made a few changes to clarify this:

- The new `Path.combine()` method combines multiple path instances into
  a single instance without making any changes to the drawing operations
- Since `Path.combine()` is variadic, I have also updated `Path.join()`
  to be variadic too, since that is more consistent.
- The old way of calling `Path.join(path, bool)` is deprecated and will
  log a warning. Calling `Path.join()` this way will be removed in v4.
- Related to this change is how `Path.length()` should behave when there
  are gaps in the path. Currently, it skips those. So I've added a
  parameter that when set to `true` will include them.
- Added documentation for `Path.combine()`
- Updated documentation for `Path.join()`
- Updated documentation for `Path.length()`
2024-02-10 15:40:41 +01:00
joostdecock
26e282f5b7 fix: Fix tests after major chai upgrade
Note that the tests for Lumina are failing, but that's not related to
the chai upgrade, rather it seems these tests fail because of issues in
the design that we'll tackle later (it's a brand new design yet to be
released).
2024-02-04 12:14:42 +01:00
Benjamin Fan
5828e53937 fix(core): Remove Svg.body property 2024-01-24 20:18:03 -08:00
woutervdub
3cef72975e Add test case for code coverage, and implement two Joost comments. 2023-12-16 22:09:22 +00:00
Joost De Cock
cb106578b3 feat(core): Better support for macro removal an node id tracking 2023-10-18 16:00:15 +02:00
Joost De Cock
b83ab5df74 feat(core): Allow plugins to provide their own packing implementation 2023-10-15 15:12:10 +02:00
Joost De Cock
f08335639b fix(core): snap upwards when snap config is a mere number. Fixes #4236 2023-10-14 15:30:40 +02:00
joostdecock
b263979ca0 feat(core): Load core plugins (plugin bundle) by default 2023-09-07 11:25:57 +02:00
joostdecock
2d53638779 fix(core): Update tests to snippet changes 2023-09-06 09:27:04 +02:00
joostdecock
5c00551bca chore(core): log.warning is now log.warn 2023-09-05 12:00:05 +02:00
joostdecock
714c4ae368 feat(core): Added snippet.scale() and snippet.rotate() methods 2023-06-21 11:46:35 +02:00
joostdecock
46f547eb14 feat(core): Log message formatting improvements 2023-06-11 09:36:16 +02:00
joostdecock
88f74a4e5e feat(core): better log message formatting 2023-06-11 09:30:53 +02:00
joostdecock
a2800dddda feat(core): Added Pattern.getLogs() and updated Pattern.getRenderProps()
The data returned by `Pattern.getRenderProps()` was not serializable as
we were returning `this` all over the place, thereby including marcors,
log methods, cyclic object references, and so on.

This commit changes that by implementing a `.asRenderProp()` method on
all of the various objects (stack, part, path, point, snippet,
attributes, svg) and only including data that can be serialized.

In addition, we no longer include the logs in the renderProps because
they are not related to rendering the pattern.
Instead, the new method `Pattern.getLogs()` gives you the logs.
2023-06-01 16:45:13 +02:00
Enoch Riese
cc143153b2 fix (core) resolve after depenndencies before from dependencies 2023-05-22 16:16:05 -05:00
joostdecock
92e8c6fdca chore(core): Code QA fixes 2023-05-19 10:34:51 +02:00
Joost De Cock
f5f4acaad2
Merge pull request #3863 from freesewing/snippets
Allow `defs` in the `svg` to be overwritten.
2023-05-02 20:03:33 +02:00
Joost De Cock
7aed296564
Merge pull request #3931 from freesewing/beamIntersectsCurve
utils.beamIntersectsCurve()
2023-04-29 20:10:14 +02:00
Enoch Riese
c65c08432a don't rely on browsers to compute transforms in layouting 2023-04-28 15:46:33 -04:00
Wouter van Wageningen
68c0fca124 Code and tests 2023-04-28 16:42:35 +00:00
Wouter van Wageningen
e9ab680c53
Merge pull request #3919 from freesewing/develop
Get up to date with develop
2023-04-26 23:24:53 -07:00
Wouter van Wageningen
e7ce509762 Added test for clone() 2023-04-21 13:48:18 +00:00
Wouter van Wageningen
8887a97dd2 @eriese recommendations 2023-04-21 03:48:37 +00:00
Wouter van Wageningen
9ed72e9f45 Now with tests! 2023-04-20 18:30:40 +00:00
Enoch Riese
c6d4fc3aea fix (core) fix rounding in count sampling. add tests 2023-04-19 11:30:32 -04:00
Enoch Riese
8ccab0df21 chore (core) cleanup 2023-04-18 18:47:49 -04:00
Enoch Riese
13ec5e43e5 refactor (core) reorganize method groupings in Pattern 2023-04-18 17:12:55 -04:00
Enoch Riese
8fea9a4beb refactor (core) move draft handling into its own class 2023-04-18 17:12:55 -04:00
Enoch Riese
9e8db66c94 refactor (core) move packing and rendering to its own class 2023-04-18 17:12:55 -04:00
Enoch Riese
c5baaab234 refactor (core) move plugin and hook handling to its own class 2023-04-18 17:12:55 -04:00
Enoch Riese
eef6c84c9c [vercel skip] chore (core) maintain coverage threshold 2023-04-15 11:59:31 -04:00
Enoch Riese
042d4e71a9 [vercel skip] chore (core) document and test Stack.home 2023-04-14 23:49:45 -04:00
Enoch Riese
98a90344f5 remove stale test 2023-03-12 13:04:00 -05:00
Enoch Riese
a4a64bdb21 document and cleanup 2023-03-08 14:37:09 -06:00
Enoch Riese
7551f09b8d use presets for common hide configurations 2023-03-08 14:37:09 -06:00
Enoch Riese
ca80dfbfa3 implement and test final proposal 2023-03-08 14:37:09 -06:00
Enoch Riese
b750562acc a bit more testing and cleanup 2023-03-01 08:44:55 -06:00
Enoch Riese
e0f5d533ae refactor and test part hiding 2023-02-28 13:33:39 -06:00
Enoch Riese
d1f4d875c5 add sinon for better testing 2023-02-28 13:33:39 -06:00
Enoch Riese
ade6ad97f1 start of draft queue class 2023-02-28 13:33:39 -06:00
Enoch Riese
4a924536f9 lint fixes and rename 2023-02-28 13:33:39 -06:00