def is_path_clicked(self, win_point): hit_surface = self.canvas.hit_surface for path in self.paths: pth = libgeom.apply_trafo_to_path(path.get_path(), self.target.trafo) if hit_surface.is_point_on_path(win_point, pth): return path return None
def __init__(self, canvas, path=None, trafo=[]): self.canvas = canvas if path and trafo: path = libgeom.apply_trafo_to_path(path, trafo) self.trafo = trafo self.start_point = BezierPoint(self.canvas, self, path[0]) self.points = [] for item in path[1]: self.points.append(BezierPoint(self.canvas, self, item)) self.closed = path[2] if self.is_closed(): sp = self.start_point.point lp = self.points[-1].point if self.points[-1].is_curve(): lp = lp[2] if not sp == lp: self.points.append(self.start_point.get_copy())