Selaa lähdekoodia

Fix behavior of self.double_click="close" (no need 4 points)

Kentaro Wada 2 vuotta sitten
vanhempi
commit
e65a7989b7
1 muutettua tiedostoa jossa 4 lisäystä ja 8 poistoa
  1. 4 8
      labelme/widgets/canvas.py

+ 4 - 8
labelme/widgets/canvas.py

@@ -544,14 +544,10 @@ class Canvas(QtWidgets.QWidget):
         return self.drawing() and self.current and len(self.current) > 2
 
     def mouseDoubleClickEvent(self, ev):
-        # We need at least 4 points here, since the mousePress handler
-        # adds an extra one before this handler is called.
-        if (
-            self.double_click == "close"
-            and self.canCloseShape()
-            and len(self.current) > 3
-        ):
-            self.current.popPoint()
+        if self.double_click != "close":
+            return
+
+        if self.createMode == "polygon" and self.canCloseShape():
             self.finalise()
 
     def selectShapes(self, shapes):