small fixes

This commit is contained in:
Mario Voigt 2021-10-17 23:35:43 +02:00
parent 0d91114305
commit 40ee4be1fe
3 changed files with 16 additions and 7 deletions

View File

@ -111,9 +111,12 @@ class ContourScannerAndTrimmer(inkex.EffectExtension):
csp = CubicSuperPath(subPath) csp = CubicSuperPath(subPath)
if len(subPath) > 1 and csp[0][0] != csp[0][1]: #avoids pointy paths like M "31.4794 57.6024 Z" if len(subPath) > 1 and csp[0][0] != csp[0][1]: #avoids pointy paths like M "31.4794 57.6024 Z"
replacedelement.path = subPath replacedelement.path = subPath
if len(subPaths) == 1:
replacedelement.set('id', oldId)
else:
replacedelement.set('id', oldId + str(idSuffix)) replacedelement.set('id', oldId + str(idSuffix))
parent.insert(idx, replacedelement)
idSuffix += 1 idSuffix += 1
parent.insert(idx, replacedelement)
breakelements.append(replacedelement) breakelements.append(replacedelement)
element.delete() element.delete()
for child in element.getchildren(): for child in element.getchildren():

View File

@ -83,9 +83,12 @@ class LinksCreator(inkex.EffectExtension):
csp = CubicSuperPath(subpath) csp = CubicSuperPath(subpath)
if len(subpath) > 1 and csp[0][0] != csp[0][1]: #avoids pointy paths like M "31.4794 57.6024 Z" if len(subpath) > 1 and csp[0][0] != csp[0][1]: #avoids pointy paths like M "31.4794 57.6024 Z"
replacedelement.set('d', csp) replacedelement.set('d', csp)
if len(subPaths) == 1:
replacedelement.set('id', oldId)
else:
replacedelement.set('id', oldId + str(idSuffix)) replacedelement.set('id', oldId + str(idSuffix))
parent.insert(idx, replacedelement)
idSuffix += 1 idSuffix += 1
parent.insert(idx, replacedelement)
breakelements.append(replacedelement) breakelements.append(replacedelement)
parent.remove(element) parent.remove(element)
for child in element.getchildren(): for child in element.getchildren():

View File

@ -73,9 +73,12 @@ class UnwindPaths(inkex.EffectExtension):
csp = CubicSuperPath(subpath) csp = CubicSuperPath(subpath)
if len(subpath) > 1 and csp[0][0] != csp[0][1]: #avoids pointy paths like M "31.4794 57.6024 Z" if len(subpath) > 1 and csp[0][0] != csp[0][1]: #avoids pointy paths like M "31.4794 57.6024 Z"
replacedelement.set('d', csp) replacedelement.set('d', csp)
if len(subPaths) == 1:
replacedelement.set('id', oldId)
else:
replacedelement.set('id', oldId + str(idSuffix)) replacedelement.set('id', oldId + str(idSuffix))
parent.insert(idx, replacedelement)
idSuffix += 1 idSuffix += 1
parent.insert(idx, replacedelement)
breakelements.append(replacedelement) breakelements.append(replacedelement)
parent.remove(element) parent.remove(element)
else: else: