Exemple #1
0
 def boundingRect(self):
     br = UIGraphicsItem.boundingRect(self)
     rng = self.getRegion()
     if self.orientation == LinearRegionItem.Vertical:
         br.setLeft(rng[0])
         br.setRight(rng[1])
     else:
         br.setTop(rng[0])
         br.setBottom(rng[1])
     return br.normalized()
Exemple #2
0
 def boundingRect(self):
     br = UIGraphicsItem.boundingRect(self)
     rng = self.getRegion()
     if self.orientation == LinearRegionItem.Vertical:
         br.setLeft(rng[0])
         br.setRight(rng[1])
     else:
         br.setTop(rng[0])
         br.setBottom(rng[1])
     return br.normalized()
Exemple #3
0
 def boundingRect(self):
     br = UIGraphicsItem.boundingRect(self)
     
     ## add a 4-pixel radius around the line for mouse interaction.
     
     #print "line bounds:", self, br
     dt = self.deviceTransform()
     if dt is None:
         return QtCore.QRectF()
     lineDir = Point(dt.map(Point(1, 0)) - dt.map(Point(0,0)))  ## direction of line in pixel-space
     orthoDir = Point(lineDir[1], -lineDir[0])  ## orthogonal to line in pixel-space
     try:
         norm = orthoDir.norm()  ## direction of one pixel orthogonal to line
     except ZeroDivisionError:
         return br
     
     dti = dt.inverted()[0]
     px = Point(dti.map(norm)-dti.map(Point(0,0)))  ## orthogonal pixel mapped back to item coords
     px = px[1]  ## project to y-direction
     
     br.setBottom(-px*4)
     br.setTop(px*4)
     return br.normalized()
Exemple #4
0
 def boundingRect(self):
     br = UIGraphicsItem.boundingRect(self)
     
     ## add a 4-pixel radius around the line for mouse interaction.
     
     #print "line bounds:", self, br
     dt = self.deviceTransform()
     if dt is None:
         return QtCore.QRectF()
     lineDir = Point(dt.map(Point(1, 0)) - dt.map(Point(0,0)))  ## direction of line in pixel-space
     orthoDir = Point(lineDir[1], -lineDir[0])  ## orthogonal to line in pixel-space
     try:
         norm = orthoDir.norm()  ## direction of one pixel orthogonal to line
     except ZeroDivisionError:
         return br
     
     dti = dt.inverted()[0]
     px = Point(dti.map(norm)-dti.map(Point(0,0)))  ## orthogonal pixel mapped back to item coords
     px = px[1]  ## project to y-direction
     
     br.setBottom(-px*4)
     br.setTop(px*4)
     return br.normalized()