Perfection
This commit is contained in:
		
							parent
							
								
									160330a057
								
							
						
					
					
						commit
						8d73d6c184
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -58,12 +58,12 @@ class Dial(Gauge):
 | 
				
			||||||
    def draw_needle(self, cr: cairo.Context, min_radius: float, max_radius: float, value: float):
 | 
					    def draw_needle(self, cr: cairo.Context, min_radius: float, max_radius: float, value: float):
 | 
				
			||||||
        angle = self.min_angle + \
 | 
					        angle = self.min_angle + \
 | 
				
			||||||
            ((self.max_angle - self.min_angle) * (value / self.max_value)) \
 | 
					            ((self.max_angle - self.min_angle) * (value / self.max_value)) \
 | 
				
			||||||
            - self.ANGLE_OFFSET - 3 * (math.pi / 180.0)
 | 
					            - self.ANGLE_OFFSET - 2.2 * (math.pi / 180.0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        angle_start = angle - 3 * (math.pi / 180.0)
 | 
					        angle_start = angle - 3 * (math.pi / 180.0)
 | 
				
			||||||
        angle_end   = angle + 3 * (math.pi / 180.0)
 | 
					        angle_end   = angle + 3 * (math.pi / 180.0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cr.set_source_rgba(1, 1, 1, 0.75)
 | 
					        cr.set_source_rgba(1, 0.4, 1, 0.75)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cr.move_to(self.x + (min_radius * self.radius) * math.cos(angle_start),
 | 
					        cr.move_to(self.x + (min_radius * self.radius) * math.cos(angle_start),
 | 
				
			||||||
                   self.y + (min_radius * self.radius) * math.sin(angle_start))
 | 
					                   self.y + (min_radius * self.radius) * math.sin(angle_start))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue