diff options
| author | JF Barraud <jf.barraud@gmail.com> | 2008-02-23 23:11:19 +0000 |
|---|---|---|
| committer | jfbarraud <jfbarraud@users.sourceforge.net> | 2008-02-23 23:11:19 +0000 |
| commit | 18d1a3a836cd92ae9d8d0c10f3805ef29be9aeaf (patch) | |
| tree | c5de7b076940f5aaba98e273b5b5f8c84cccc36e /share/extensions/simpletransform.py | |
| parent | * on-canvas clip and mask editing :) in the object menu you can find how to ... (diff) | |
| download | inkscape-18d1a3a836cd92ae9d8d0c10f3805ef29be9aeaf.tar.gz inkscape-18d1a3a836cd92ae9d8d0c10f3805ef29be9aeaf.zip | |
Added pathscatter effect + slight modif of simpletransform... to compute bbox of rects!!
(bzr r4835)
Diffstat (limited to 'share/extensions/simpletransform.py')
| -rw-r--r-- | share/extensions/simpletransform.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/share/extensions/simpletransform.py b/share/extensions/simpletransform.py index cf0751ca8..f434d80ed 100644 --- a/share/extensions/simpletransform.py +++ b/share/extensions/simpletransform.py @@ -152,10 +152,23 @@ def computeBBox(aList,mat=[[1,0,0],[0,1,0]]): applyTransformToPath(m,p)
bbox=boxunion(roughBBox(p),bbox)
- if node.tag == inkex.addNS('use','svg') or node.tag=='use':
+ elif node.tag == inkex.addNS('rect','svg') or node.tag=='rect':
+ w = float(node.get('width'))/2.
+ h = float(node.get('height'))/2.
+ x = float(node.get('x'))
+ y = float(node.get('y'))
+ C = [x + w , y + h ]
+ applyTransformToPoint(mat,C)
+ xmin = C[0] - abs(m[0][0]) * w - abs(m[0][1]) * h
+ xmax = C[0] + abs(m[0][0]) * w + abs(m[0][1]) * h
+ ymin = C[1] - abs(m[1][0]) * w - abs(m[1][1]) * h
+ ymax = C[1] + abs(m[1][0]) * w + abs(m[1][1]) * h
+ bbox = xmin,xmax,ymin,ymax
+
+ elif node.tag == inkex.addNS('use','svg') or node.tag=='use':
refid=node.get(inkex.addNS('href','xlink'))
path = '//*[@id="%s"]' % refid[1:]
- refnode = node.getroottree().xpath(path, namespaces=inkex.NSS)
+ refnode = node.xpath(path)
bbox=boxunion(computeBBox(refnode,m),bbox)
bbox=boxunion(computeBBox(node,m),bbox)
|
