summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2007-03-14 06:20:47 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2007-03-14 06:20:47 +0000
commitad3428d807e68fe6418d6dac00b03279a4412baa (patch)
tree15323441641a89da29c7265fa81ecca666a513fe
parentsave window geometry before running effect so that effects get correct view_c... (diff)
downloadinkscape-ad3428d807e68fe6418d6dac00b03279a4412baa.tar.gz
inkscape-ad3428d807e68fe6418d6dac00b03279a4412baa.zip
view_center fixed to account for the y-coordinate flip
(bzr r2643)
-rwxr-xr-xshare/extensions/inkex.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py
index 2c49f32f8..8be7b5282 100755
--- a/share/extensions/inkex.py
+++ b/share/extensions/inkex.py
@@ -35,7 +35,7 @@ u'xlink' :u'http://www.w3.org/1999/xlink'
#a dictionary of unit to user unit conversion factors
uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'pc':15.0}
def unittouu(string):
- '''Returns returns userunits given a string representation of units in another system'''
+ '''Returns userunits given a string representation of units in another system'''
unit = re.compile('(%s)$' % '|'.join(uuconv.keys()))
param = re.compile(r'(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)')
@@ -129,11 +129,12 @@ class Effect:
xattr = xml.xpath.Evaluate('//sodipodi:namedview/@inkscape:cx',self.document,context=ctx)
yattr = xml.xpath.Evaluate('//sodipodi:namedview/@inkscape:cy',self.document,context=ctx)
+ doc_height = unittouu(self.document.documentElement.getAttribute('height'))
if xattr and yattr:
x = xattr[0].value
y = yattr[0].value
if x and y:
- self.view_center = (float(x),float(y))
+ self.view_center = (float(x), doc_height - float(y)) # FIXME: y-coordinate flip, eliminate it when it's gone in Inkscape
def getselected(self):
"""Collect selected nodes"""
for id in self.options.ids: