Hi, in my extension, I used following code to get coordinates of selected area:
def select_area(self):
opt = self.options x0 = y0 = y1 = x0 = None scale = self.svg.unittouu('1px') # convert objects to path to not wrongly count the selection.bounding.box() self.objects_to_paths(self.svg.selected, True) bbox = self.svg.selection.bounding_box() x0 = math.ceil(bbox.left/scale) x1 = math.ceil(bbox.right/scale) y0 = math.ceil(bbox.top/scale) y1 = math.ceil(bbox.bottom/scale) points = [x0, y0, x1, y1] return points
This worked well in inkscape version 1.0 but stopped to work in version 1.1. The returned coordinates are wrong in version 1.1.
Can anybody help me and write me what is the right code to get right coordinates of selected area in version 1.1?
Thank you, Jan
Hi, in my extension, I used following code to get coordinates of selected area:
def select_area(self):
opt = self.options
x0 = y0 = y1 = x0 = None
scale = self.svg.unittouu('1px')
# convert objects to path to not wrongly count the selection.bounding.box()
self.objects_to_paths(self.svg.selected, True)
bbox = self.svg.selection.bounding_box()
x0 = math.ceil(bbox.left/scale)
x1 = math.ceil(bbox.right/scale)
y0 = math.ceil(bbox.top/scale)
y1 = math.ceil(bbox.bottom/scale)
points = [x0, y0, x1, y1]
return points
This worked well in inkscape version 1.0 but stopped to work in version 1.1. The returned coordinates are wrong in version 1.1.
Can anybody help me and write me what is the right code to get right coordinates of selected area in version 1.1?
Thank you, Jan