From 19bb8a5a6dbe4244a590147187949d0555eb9fbc Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Thu, 16 Aug 2018 22:50:34 -0400 Subject: new extension to add layer commands --- lib/svg/path.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/svg/path.py') diff --git a/lib/svg/path.py b/lib/svg/path.py index 52144332..0a8dcb74 100644 --- a/lib/svg/path.py +++ b/lib/svg/path.py @@ -26,16 +26,19 @@ def get_node_transform(node): return transform -def get_correction_transform(node): - """Get a transform to apply to new siblings of this SVG node""" +def get_correction_transform(node, child=False): + """Get a transform to apply to new siblings or children of this SVG node""" # if we want to place our new nodes in the same group/layer as this node, # then we'll need to factor in the effects of any transforms set on # the parents of this node. - # we can ignore the transform on the node itself since it won't apply - # to the objects we add - transform = get_node_transform(node.getparent()) + if child: + transform = get_node_transform(node) + else: + # we can ignore the transform on the node itself since it won't apply + # to the objects we add + transform = get_node_transform(node.getparent()) # now invert it, so that we can position our objects in absolute # coordinates -- cgit v1.2.3