Browse Source

Do not select shapes marked hidden

If not explicitly hidden, shapes can still be selected if hidden by the
hideBackground flag.
Michael Pitidis 13 years ago
parent
commit
2070489947
2 changed files with 3 additions and 4 deletions
  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.line.points = [pos, pos]
                     self.setHiding()
+                    self.repaint()
             else:
                 self.selectShape(pos)
+                self.repaint()
                 self.prevPoint = pos
-            self.repaint()
         #elif ev.button() == Qt.RightButton and not self.editing():
         #    self.selectShape(pos)
         #    self.prevPoint = pos
@@ -139,12 +140,11 @@ class Canvas(QWidget):
         """Select the first shape created which contains this point."""
         self.deSelectShape()
         for shape in reversed(self.shapes):
-            if shape.containsPoint(point):
+            if self.isVisible(shape) and shape.containsPoint(point):
                 shape.selected = True
                 self.selectedShape = shape
                 self.calculateOffsets(shape, point)
                 self.setHiding()
-                self.repaint()
                 return
 
     def calculateOffsets(self, shape, point):

+ 0 - 1
labelme.py

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