summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlvin Penner <penner@vaxxine.com>2015-03-08 15:40:10 +0000
committerapenner <penner@vaxxine.com>2015-03-08 15:40:10 +0000
commit1e68c9e56e204ed642d0177e7f7570f2b4ad7218 (patch)
tree914f40a7e5c8530552fcb69d9dd57a4e79df2d57
parentUpdate simplify and bspline to auto size some helper paths based on current zoom (diff)
downloadinkscape-1e68c9e56e204ed642d0177e7f7570f2b4ad7218.tar.gz
inkscape-1e68c9e56e204ed642d0177e7f7570f2b4ad7218.zip
extensions. convert2dashes. support offset parameter. (Bug 1426889)
Fixed bugs: - https://launchpad.net/bugs/1426889 (bzr r13975)
-rwxr-xr-xshare/extensions/convert2dashes.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/share/extensions/convert2dashes.py b/share/extensions/convert2dashes.py
index 9e7f6d439..1228b247c 100755
--- a/share/extensions/convert2dashes.py
+++ b/share/extensions/convert2dashes.py
@@ -54,17 +54,24 @@ class SplitIt(inkex.Effect):
for id, node in self.selected.iteritems():
if node.tag == inkex.addNS('path','svg'):
dashes = []
+ offset = 0
style = simplestyle.parseStyle(node.get('style'))
if style.has_key('stroke-dasharray'):
if style['stroke-dasharray'].find(',') > 0:
dashes = [float (dash) for dash in style['stroke-dasharray'].split(',')]
+ if style.has_key('stroke-dashoffset'):
+ offset = style['stroke-dashoffset']
if dashes:
p = cubicsuperpath.parsePath(node.get('d'))
new = []
for sub in p:
idash = 0
dash = dashes[0]
- length = 0
+ length = float (offset)
+ while dash < length:
+ length = length - dash
+ idash = (idash + 1) % len(dashes)
+ dash = dashes[idash]
new.append([sub[0][:]])
i = 1
while i < len(sub):