コード例 #1
0
ファイル: spline_by_hand.py プロジェクト: almarklein/pirt
    def on_doubleclick_line(self, event):  # On axes

        # Get closest point
        dists = Point(event.x2d, event.y2d).distance(self._pp)
        I, = np.where(dists == dists.min())
        if not len(I):
            return False

        # Remove from pointset
        self._pp.Pop(I[0])
        self._line1.SetPoints(self._pp)

        # Apply
        self._a1.Draw()
        self.apply()
コード例 #2
0
ファイル: spline_by_hand.py プロジェクト: almarklein/pirt
    def on_down_line(self, event):  # On line instance

        if event.button != 1:
            return False

        # Get closest point
        dists = Point(event.x2d, event.y2d).distance(self._pp)
        I, = np.where(dists == dists.min())
        if not len(I):
            return False

        # Store
        self._active = I[0]

        # Prevent dragging by indicating the event needs no further handling
        return True