コード例 #1
0
    def button_press_callback(self, event):
        'whenever a mouse button is pressed'
        if not self.showverts: return
        if event.inaxes==None: return
        if event.button != 1: return
        ind = self.get_ind_under_point(event)

        self.clickxy = (event.xdata,event.ydata)
        self.last_displacement = np.array([0.0,0.0])
        
        if (ind==None):
            #check to see if clicked on poly
            #drag = self.pathpatch.contains_point(point=(event.xdata,event.ydata))
            from matplotlib._path import point_in_path
            drag = point_in_path(event.xdata,
                                 event.ydata,
                                 0,
                                 self.pathpatch.get_path(),
                                 None)                
            if drag:
                ind = 'drag_patch'
        self._ind = ind
        print self._ind

        if (self._ind is not None):
            self.pathpatch.set_animated(True)
        return (self._ind is not None) #handled event or no?
コード例 #2
0
 def contains_point(self, point, transform=None):
     """
     Returns *True* if the path contains the given point.
     If *transform* is not *None*, the path will be transformed
     before performing the test.
     """
     if transform is not None:
         transform = transform.frozen()
     return point_in_path(point[0], point[1], self, transform)
コード例 #3
0
    def contains_point(self, point, transform=None):
        """
        Returns *True* if the path contains the given point.

        If *transform* is not *None*, the path will be transformed
        before performing the test.
        """
        if transform is not None:
            transform = transform.frozen()
        return point_in_path(point[0], point[1], self, transform)
コード例 #4
0
ファイル: path.py プロジェクト: Aharobot/matplotlib
    def contains_point(self, point, transform=None, radius=0.0):
        """
        Returns *True* if the path contains the given point.

        If *transform* is not *None*, the path will be transformed
        before performing the test.

        *radius* allows the path to be made slightly larger or
        smaller.
        """
        if transform is not None:
            transform = transform.frozen()
        result = _path.point_in_path(point[0], point[1], radius, self, transform)
        return result
コード例 #5
0
    def contains_point(self, point, transform=None, radius=0.0):
        """
        Returns *True* if the path contains the given point.

        If *transform* is not *None*, the path will be transformed
        before performing the test.

        *radius* allows the path to be made slightly larger or
        smaller.
        """
        if transform is not None:
            transform = transform.frozen()
        result = _path.point_in_path(point[0], point[1], radius, self, transform)
        return result