Ignore:
Timestamp:
02/15/13 20:09:01 (14 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Extend the anchor shape/boundingRect for a wider mouse hit area.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/canvas/items/nodeitem.py

    r11293 r11331  
    281281        self.__fullStroke = None 
    282282        self.__dottedStroke = None 
     283        self.__shape = None 
    283284 
    284285    def parentNodeItem(self): 
     
    296297        stroke_path = QPainterPathStroker() 
    297298        stroke_path.setCapStyle(Qt.RoundCap) 
     299 
     300        # Shape is wider (bigger mouse hit area - should be settable) 
     301        stroke_path.setWidth(9) 
     302        self.__shape = stroke_path.createStroke(path) 
     303 
     304        # The full stroke 
    298305        stroke_path.setWidth(3) 
    299         # The full stroke 
    300306        self.__fullStroke = stroke_path.createStroke(path) 
    301307 
     
    430436 
    431437    def shape(self): 
    432         # Use stroke without the doted line (poor mouse cursor collision) 
    433         if self.__fullStroke is not None: 
    434             return self.__fullStroke 
     438        if self.__shape is not None: 
     439            return self.__shape 
    435440        else: 
    436441            return GraphicsPathObject.shape(self) 
     442 
     443    def boundingRect(self): 
     444        if self.__shape is not None: 
     445            return self.__shape.controlPointRect() 
     446        else: 
     447            return GraphicsPathObject.boundingRect(self) 
    437448 
    438449    def hoverEnterEvent(self, event): 
Note: See TracChangeset for help on using the changeset viewer.