Bogdan Chadkin
74c383153e
Cover mergePaths plugin with types ( #1539 )
...
- covered mergePaths plugin
- covered big path logic
2021-08-24 13:41:16 +03:00
Bogdan Chadkin
b359730219
Drop unused bézier utilities
2021-08-24 03:01:03 +03:00
Bogdan Chadkin
147d2dadd6
Refactor convertRelativeToAbsolute
2021-08-24 03:00:18 +03:00
Bogdan Chadkin
539237ce87
Normalize path data structure ( #1538 )
...
Use modern path data structure in all plugins.
Will be easier to cover with types.
2021-08-24 00:01:18 +03:00
Bogdan Chadkin
6f2f62c5ee
Access attributes directly ( #1433 )
...
Got rid from `.attrs`, `.attr()` and `.addAttr()` usages
2021-03-18 18:53:20 +03:00
Bogdan Chadkin
61657433e1
Refactor apply transforms
...
- handle each command separately
- handle both relative and absolute commands
- moved into _applyTransforms.js to convert eventually into plugin
- apply transforms before converting into relative
These changes makes code independent and easy to work with.
2021-03-15 21:24:23 +03:00
Bogdan Chadkin
92053c7ed8
Remove broken optimisation
2021-03-15 15:07:28 +03:00
Bogdan Chadkin
a04b27a1df
Refactor convertToRelative
...
Slight code simplification. Each command is processed exclusively
without assumtions. Removed moveto and closepath common coords
reference, handle in applyTransform instead. Rely on new path data
naming.
2021-03-15 13:41:12 +03:00
Bogdan Chadkin
d1d6e5efe8
Remove prefix/local support in elements and attributes ( #1413 )
...
These parts of element and attribute name are easy to extract.
Now we can easily replace attrs with xast attributes object.
2021-03-10 13:26:15 +03:00
Bogdan Chadkin
0e02fd9fde
Fix noSpaceAfterFlags support
2021-03-04 13:15:36 +03:00
Bogdan Chadkin
a896d5de13
Format plugins utilities with prettier ( #1394 )
...
Note: review with hidden whitespaces
2021-03-03 01:33:44 +03:00
Bogdan Chadkin
04b2ae9a37
Implement path stringify ( #1387 )
...
Ref https://github.com/svg/svgo/issues/32
Added `stringifyPathData` utility to produce small as possible path by
- matching leading moveto and line to commands (m -> l, M -> L)
- combining moveto and lineto commands
- avoiding space before decimal numbers if possible
2021-03-02 01:07:26 +03:00
Bogdan Chadkin
4086e31334
Implement new path parser ( #1378 )
...
Regexps are quite leaky for complex parsing. Regression tests caught
a few issues related to path parser.
In this diff I implemented the new spec-compliant parser which solves
2 regression cases and covers many edge cases hard to handle with
regexps.
2021-02-28 22:10:57 +03:00
Bogdan Chadkin
79dbb4bf6e
Prevent applyTransform when inline style present
...
Ref https://github.com/svg/svgo/issues/1385
With disabled convertStyleToAttrs applyTransform fails to transform
inline styles. They are considered as deoptimisation for now.
Future style manager should fix the problem.
2021-02-28 14:46:32 +03:00
XhmikosR
1310210d4e
Use https when possible and fix an inactive domain ( #1374 )
2021-02-25 13:48:18 +03:00
Bogdan Chadkin
dd37fcfebb
Apply scale to stroke-dasharray and stroke-dashoffset
2021-02-25 13:45:03 +03:00
Bogdan Chadkin
9263d9ab90
Fix svg spec urls in plugins
2021-02-24 11:18:48 +03:00
Bogdan Chadkin
a7cc20bb43
Setup recommended eslint preset ( #1345 )
...
This is usually enough to prevent silly mistakes.
Formatting will be done by prettier after merging pull requests.
2021-02-19 15:26:07 +03:00
Sebastian Kreft
c9a3aea858
Path intersection was not checking paths with circles. ( #1229 )
...
As an optimization the path intersection was checking the paths had three or more elements, caliming that otherwise there was nothing to fill. However a semi circle would actually contain 2 points.
Fixes #1048 .
This adds a simplified test case for the 2 offending files reported in the issue.
2021-02-17 23:50:08 +03:00
GreLI
258fecfa6b
Remove spaces after ‘arcto’ path command flags
2019-07-13 16:18:08 +03:00
GreLI
3c82fd7287
Correct parsing of arc flags without following comma/spaces
...
Fix #822
2018-09-15 16:38:34 +03:00
Alex Lockwood
50f4fed02b
dont transform stroke width for non-scaling-strokes ( #857 )
2018-09-15 14:39:36 +03:00
Alex Lockwood
b182569c5f
Fixes #218
2017-11-22 21:42:49 +03:00
Vasiliy Loginevskiy
4495a34f55
Remove unnecessary dependency
2017-03-22 09:03:51 +03:00
GreLI
a55dc255c2
Don't transform paths with id without stroke-width since it can be overrided.
...
Fixes #483
2016-03-08 19:14:24 +03:00
GreLI
a0616b0b82
Don't fail on empty transform. Fixes #394
2015-07-05 13:11:31 +03:00
Yoshiya Hinosawa
73c5a73900
Modify jshint rules
2015-06-13 18:32:19 +09:00
Yoshiya Hinosawa
3f8e6fd15c
Fix lint
2015-06-12 00:25:32 +09:00
GreLI
c1bf5baf97
Proper arcs transforming with SVD
2015-05-24 20:50:49 +03:00
GreLI
ff5e89d5bf
Reworked transform manipulation
2015-05-24 20:50:47 +03:00
Aidan Steele
dcab8e0c73
Small spelling typo in mergePaths
2015-05-18 11:59:54 +10:00
GreLI
d0c3355056
Separate property for transformations precision with the increased value by default. Resolves #334
2015-04-12 22:38:29 +03:00
GreLI
f651fd8de1
Fixed issues with multiple moveto coordinates on output. Fixes #338
2015-04-06 16:39:28 +03:00
GreLI
ae2981cdea
Fixed support point function
2015-04-02 16:48:49 +03:00
GreLI
f68b310c1e
Fix for transformations with arcs converted to curves
2015-03-30 20:32:24 +03:00
GreLI
e1060df7dc
Check path intersection while merging.
...
Fixes #253 , resolves #260 , fixes #298 .
2015-03-22 18:06:40 +03:00
GreLI
e220b6cad0
Path data processing improvements.
...
Improved path data saving.
Collapse repeated now works at writing path data and doesn't affect pathJS to make further processing easier.
Resolves #204 .
2015-03-17 22:03:17 +03:00
GreLI
d3e4f63ae5
removeUselessStrokeAndFill is back. Checks for inherited attrs and references.
2015-02-23 23:06:18 +03:00
GreLI
5e7caa49dc
Code styling
2015-02-08 19:31:55 +03:00
GreLI
66ca37c366
Typo fix and updated tests
2015-01-27 14:12:29 +03:00
GreLI
80398580ab
Corrected inherited stroke-width adjustment
2015-01-27 14:07:23 +03:00
GreLI
bada6b2a8c
Transformations now accounting inherited stroke attributes. Finally fixes #162
2015-01-25 23:27:30 +03:00
GreLI
290d610f27
Limited linking checks to referencing props
2015-01-25 20:00:40 +03:00
GreLI
35d351a15e
numeric regular expression fix
2015-01-25 19:49:32 +03:00
GreLI
592fdfe03f
Don't apply transformation to path with references to another objects which also transforms
...
Resolves #104 , fixes #143 and resolves #206 .
2014-11-04 17:36:22 +03:00
GreLI
bbeca0604a
Transformations now apply to paths with arcs
2014-11-04 17:34:31 +03:00
GreLI
f1535e25f5
Corrected stroke-width value update with unit identifier, fixes #181
2014-11-03 01:15:02 +03:00
GreLI
06028a69de
Path data optimization improvements.
...
Writes absolute coordinates if it's shorter.
Relative coordinates rounding now takes in account accumulating error. Points will be closer to original values.
Rounding is smarter like 2.49 to 2.5.
2014-07-31 20:13:57 +04:00
Nathan Muir
cd0793a9f2
Updated applyTransforms to optionally apply path transforms & convert the stroke-width when a line is scaled uniformly (ie, no skew).
2013-11-18 22:37:06 +02:00
deepsweet
d391a38b7c
plugins/transformsWithOnePath: fix last point calculation for C/S/Q/T
2013-05-06 15:07:54 +03:00