fix in kvec
This commit is contained in:
parent
ff8dc882ba
commit
720629935c
@ -198,21 +198,29 @@ class KVEC (inkex.EffectExtension):
|
|||||||
newGroup = inkex.Group()
|
newGroup = inkex.Group()
|
||||||
parent.insert(idx + 1,newGroup)
|
parent.insert(idx + 1,newGroup)
|
||||||
for child in doc:
|
for child in doc:
|
||||||
newGroup.append(child)
|
if child.tag != etree.Comment and "desc" not in child.tag:
|
||||||
|
if child.text is not None:
|
||||||
|
child.text = child.text.strip()
|
||||||
|
if child.tail is not None:
|
||||||
|
child.tail = child.tail.strip()
|
||||||
|
newGroup.append(child)
|
||||||
|
|
||||||
#doc.get('height')
|
#doc.get('height')
|
||||||
#doc.get('width')
|
#doc.get('width')
|
||||||
#doc.get('viewBox')
|
#doc.get('viewBox')
|
||||||
if so.fittooriginal is True: #fitting does not work in all cases so we make it available as option
|
if so.fittooriginal is True: #fitting does not work in all cases so we make it available as option
|
||||||
bbox = newGroup.bounding_box()
|
bbox = newGroup.bounding_box()
|
||||||
newGroup.attrib['transform'] = "matrix({:0.6f}, 0, 0, {:0.6f}, {:0.6f}, {:0.6f})".format(
|
if bbox is not None:
|
||||||
#float(element.get('width')) / float(doc.get('width')),
|
newGroup.attrib['transform'] = "matrix({:0.6f}, 0, 0, {:0.6f}, {:0.6f}, {:0.6f})".format(
|
||||||
#float(element.get('height')) / float(doc.get('height')),
|
#float(element.get('width')) / float(doc.get('width')),
|
||||||
float(element.get('width')) / bbox.width,
|
#float(element.get('height')) / float(doc.get('height')),
|
||||||
float(element.get('height')) / bbox.height,
|
float(element.get('width')) / bbox.width,
|
||||||
float(element.get('x')) - (float(element.get('width')) / bbox.width) * bbox.left,
|
float(element.get('height')) / bbox.height,
|
||||||
float(element.get('y')) - (float(element.get('height')) / bbox.height) * bbox.top
|
float(element.get('x')) - (float(element.get('width')) / bbox.width) * bbox.left,
|
||||||
)
|
float(element.get('y')) - (float(element.get('height')) / bbox.height) * bbox.top
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
inkex.utils.debug("Fit to original dimensions failed. Please scale to size manually.")
|
||||||
|
|
||||||
# Delete the temporary svg file
|
# Delete the temporary svg file
|
||||||
if os.path.exists(exportfile + ".svg"):
|
if os.path.exists(exportfile + ".svg"):
|
||||||
|
Loading…
Reference in New Issue
Block a user