Răsfoiți Sursa

Do not select shapes marked hidden

If not explicitly hidden, shapes can still be selected if hidden by the
hideBackground flag.
Michael Pitidis 13 ani în urmă
părinte
comite
2070489947
2 a modificat fișierele cu 3 adăugiri și 4 ștergeri
  1. 3 3
      canvas.py
  2. 0 1
      labelme.py

+ 3 - 3
canvas.py

@@ -105,10 +105,11 @@ class Canvas(QWidget):
                     self.current.addPoint(pos)
                     self.current.addPoint(pos)
                     self.line.points = [pos, pos]
                     self.line.points = [pos, pos]
                     self.setHiding()
                     self.setHiding()
+                    self.repaint()
             else:
             else:
                 self.selectShape(pos)
                 self.selectShape(pos)
+                self.repaint()
                 self.prevPoint = pos
                 self.prevPoint = pos
-            self.repaint()
         #elif ev.button() == Qt.RightButton and not self.editing():
         #elif ev.button() == Qt.RightButton and not self.editing():
         #    self.selectShape(pos)
         #    self.selectShape(pos)
         #    self.prevPoint = pos
         #    self.prevPoint = pos
@@ -139,12 +140,11 @@ class Canvas(QWidget):
         """Select the first shape created which contains this point."""
         """Select the first shape created which contains this point."""
         self.deSelectShape()
         self.deSelectShape()
         for shape in reversed(self.shapes):
         for shape in reversed(self.shapes):
-            if shape.containsPoint(point):
+            if self.isVisible(shape) and shape.containsPoint(point):
                 shape.selected = True
                 shape.selected = True
                 self.selectedShape = shape
                 self.selectedShape = shape
                 self.calculateOffsets(shape, point)
                 self.calculateOffsets(shape, point)
                 self.setHiding()
                 self.setHiding()
-                self.repaint()
                 return
                 return
 
 
     def calculateOffsets(self, shape, point):
     def calculateOffsets(self, shape, point):

+ 0 - 1
labelme.py

@@ -25,7 +25,6 @@ __appname__ = 'labelme'
 
 
 # FIXME
 # FIXME
 # - [low] Label validation/postprocessing breaks with TAB.
 # - [low] Label validation/postprocessing breaks with TAB.
-# - Don't select hidden labels.
 # - Update label list on shape deletion.
 # - Update label list on shape deletion.
 
 
 # TODO:
 # TODO: