diff --git a/svgpathtools/path.py b/svgpathtools/path.py index e5102bb..97a0036 100644 --- a/svgpathtools/path.py +++ b/svgpathtools/path.py @@ -2941,6 +2941,7 @@ class Path(MutableSequence): if command is None: raise ValueError("Unallowed implicit command in %s, position %s" % ( pathdef, len(pathdef.split()) - len(elements))) + last_command = command # Used by S and T if command == 'M': # Moveto command. diff --git a/test/test_parsing.py b/test/test_parsing.py index 7897faa..1c93064 100644 --- a/test/test_parsing.py +++ b/test/test_parsing.py @@ -277,3 +277,11 @@ class TestParser(unittest.TestCase): path1 = parse_path("m 100 100 L 300 100 L 200 300 z", 50 + 50j) path2 = Path("m 100 100 L 300 100 L 200 300 z", 50 + 50j) self.assertEqual(path1, path2) + + def test_issue_99(self): + p = Path("M 100 250 S 200 200 200 250 300 300 300 250") + self.assertEqual(p.d(useSandT=True), 'M 100.0,250.0 S 200.0,200.0 200.0,250.0 S 300.0,300.0 300.0,250.0') + self.assertEqual(p.d(), + 'M 100.0,250.0 C 100.0,250.0 200.0,200.0 200.0,250.0 C 200.0,300.0 300.0,300.0 300.0,250.0') + self.assertNotEqual(p.d(), + 'M 100.0,250.0 C 100.0,250.0 200.0,200.0 200.0,250.0 C 200.0,250.0 300.0,300.0 300.0,250.0')