Exemplo n.º 1
0
	def apply_midpoint_change(self, point, index, control=False, final=False):
		wpoint = self.canvas.point_win_to_doc(point)
		invtrafo = libgeom.invert_trafo(self.target.trafo)
		x, y = libgeom.apply_trafo_to_point(wpoint, invtrafo)
		radius = self.target.get_midpoint_radius()
		angle = self.target.get_midpoint_angle(index)
		coef2 = libgeom.get_point_radius([x, y]) / radius
		if control:
			props = [self.orig_angle1, self.orig_angle2,
					self.orig_coef1, coef2]
		else:
			angle2 = libgeom.get_point_angle([x, y]) - angle
			props = [self.orig_angle1, angle2,
					self.orig_coef1, coef2]
		if final:
			props_before = [self.orig_angle1, self.orig_angle2,
					self.orig_coef1, self.orig_coef2]
			self.api.set_polygon_properties_final(props, props_before,
												self.target)
		else:
			self.api.set_polygon_properties(props, self.target)
		self.update_points()
Exemplo n.º 2
0
 def apply_midpoint_change(self, point, index, control=False, final=False):
     wpoint = self.canvas.point_win_to_doc(point)
     invtrafo = libgeom.invert_trafo(self.target.trafo)
     x, y = libgeom.apply_trafo_to_point(wpoint, invtrafo)
     radius = self.target.get_midpoint_radius()
     angle = self.target.get_midpoint_angle(index)
     coef2 = libgeom.get_point_radius([x, y]) / radius
     if control:
         props = [self.orig_angle1, self.orig_angle2,
                  self.orig_coef1, coef2]
     else:
         angle2 = libgeom.get_point_angle([x, y]) - angle
         props = [self.orig_angle1, angle2,
                  self.orig_coef1, coef2]
     if final:
         props_before = [self.orig_angle1, self.orig_angle2,
                         self.orig_coef1, self.orig_coef2]
         self.api.set_polygon_properties_final(props, props_before,
                                               self.target)
     else:
         self.api.set_polygon_properties(props, self.target)
     self.update_points()