- updated the workspace functions to work in Legacy(@D) graphic mode

This commit is contained in:
Marius Stanciu
2019-11-27 21:40:39 +02:00
committed by Marius
parent 1f63a16a24
commit 599cfb8d51
5 changed files with 129 additions and 31 deletions

View File

@@ -4241,7 +4241,10 @@ class FlatCAMGeoEditor(QtCore.QObject):
# # ## Grid snap
if self.options["grid_snap"]:
if self.options["global_gridx"] != 0:
snap_x_ = round(x / float(self.options["global_gridx"])) * float(self.options['global_gridx'])
try:
snap_x_ = round(x / float(self.options["global_gridx"])) * float(self.options['global_gridx'])
except TypeError:
snap_x_ = x
else:
snap_x_ = x
@@ -4249,12 +4252,18 @@ class FlatCAMGeoEditor(QtCore.QObject):
# and it will use the snap distance from GridX entry
if self.app.ui.grid_gap_link_cb.isChecked():
if self.options["global_gridx"] != 0:
snap_y_ = round(y / float(self.options["global_gridx"])) * float(self.options['global_gridx'])
try:
snap_y_ = round(y / float(self.options["global_gridx"])) * float(self.options['global_gridx'])
except TypeError:
snap_y_ = y
else:
snap_y_ = y
else:
if self.options["global_gridy"] != 0:
snap_y_ = round(y / float(self.options["global_gridy"])) * float(self.options['global_gridy'])
try:
snap_y_ = round(y / float(self.options["global_gridy"])) * float(self.options['global_gridy'])
except TypeError:
snap_y_ = y
else:
snap_y_ = y
nearest_grid_distance = distance((x, y), (snap_x_, snap_y_))