- fixed Measuring Tool in legacy graphic engine

- fixed Gerber plotting
- fixed Geometry plotting
This commit is contained in:
Marius Stanciu
2019-09-21 13:07:30 +03:00
committed by Marius
parent 01e2755676
commit 9aef293a26
5 changed files with 130 additions and 43 deletions

View File

@@ -6777,6 +6777,10 @@ class App(QtCore.QObject):
"""
self.report_usage("on_jump_to()")
if self.is_legacy is True:
self.inform.emit(_("Not available with the current Graphic Engine Legacy(2D)."))
return
if not custom_location:
dia_box = Dialog_box(title=_("Jump to ..."),
label=_("Enter the coordinates in format X,Y:"),
@@ -6796,14 +6800,27 @@ class App(QtCore.QObject):
location = custom_location
if fit_center:
self.plotcanvas.fit_center(loc=location)
if self.is_legacy is False:
self.plotcanvas.fit_center(loc=location)
else:
pass
# self.plotcanvas.fit_view()
cursor = QtGui.QCursor()
canvas_origin = self.plotcanvas.native.mapToGlobal(QtCore.QPoint(0, 0))
jump_loc = self.plotcanvas.translate_coords_2((location[0], location[1]))
if self.is_legacy is False:
canvas_origin = self.plotcanvas.native.mapToGlobal(QtCore.QPoint(0, 0))
jump_loc = self.plotcanvas.translate_coords_2((location[0], location[1]))
cursor.setPos(canvas_origin.x() + jump_loc[0], (canvas_origin.y() + jump_loc[1]))
else:
# the origin finding works but not mapping the location to pixels
canvas_origin = self.plotcanvas.native.mapToGlobal(QtCore.QPoint(0, 0))
x0, y0 = canvas_origin.x(), canvas_origin.y() + self.ui.right_layout.geometry().height()
x0, y0 = x0 + self.plotcanvas.axes.transData.transform((0, 0))[0], y0 - \
self.plotcanvas.axes.transData.transform((0, 0))[1]
loc = self.plotcanvas.axes.transData.transform(location)
cursor.setPos(x0 + loc[0]/50, y0 - loc[1]/50)
cursor.setPos(canvas_origin.x() + jump_loc[0], (canvas_origin.y() + jump_loc[1]))
self.inform.emit('[success] %s' %
_("Done."))
return location