From d6d8a291f59b2497b0f0add73ece233840f35717 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Wed, 14 Mar 2007 06:20:47 +0000 Subject: [PATCH] view_center fixed to account for the y-coordinate flip --- share/extensions/inkex.py | 5 +++-- 1 file 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: -- 2.30.2