Explorar el Código

Fixed missing first segment in path bug. Delete last point in sequence while drawing object with backspace.

Juan Pablo Caram hace 10 años
padre
commit
83eb535479
Se han modificado 1 ficheros con 11 adiciones y 1 borrados
  1. 11 1
      FlatCAMDraw.py

+ 11 - 1
FlatCAMDraw.py

@@ -457,6 +457,11 @@ class FCPolygon(FCShapeTool):
         self.geometry = DrawToolShape(Polygon(self.points))
         self.complete = True
 
+    def on_key(self, key):
+        if key == 'backspace':
+            if len(self.points) > 0:
+                self.points = self.points[0:-1]
+
 
 class FCPath(FCPolygon):
     """
@@ -468,13 +473,18 @@ class FCPath(FCPolygon):
         self.complete = True
 
     def utility_geometry(self, data=None):
-        if len(self.points) > 1:
+        if len(self.points) > 0:
             temp_points = [x for x in self.points]
             temp_points.append(data)
             return DrawToolUtilityShape(LineString(temp_points))
 
         return None
 
+    def on_key(self, key):
+        if key == 'backspace':
+            if len(self.points) > 0:
+                self.points = self.points[0:-1]
+
 
 class FCSelect(DrawTool):
     def __init__(self, draw_app):