|
@@ -38,7 +38,7 @@ class Rectangle(mt.RectangularArea):
|
|
|
class Polygon(BoundingBoxArea):
|
|
class Polygon(BoundingBoxArea):
|
|
|
def __init__(self, x, y, points, margin=0, color=BLUE, border_color=RED):
|
|
def __init__(self, x, y, points, margin=0, color=BLUE, border_color=RED):
|
|
|
super(Polygon, self).__init__(x, y, points)
|
|
super(Polygon, self).__init__(x, y, points)
|
|
|
- self.fill_color = color
|
|
|
|
|
|
|
+ self.color = color
|
|
|
self.border_color = border_color
|
|
self.border_color = border_color
|
|
|
self.margin = margin
|
|
self.margin = margin
|
|
|
|
|
|
|
@@ -46,6 +46,10 @@ class Polygon(BoundingBoxArea):
|
|
|
self.on_pinch(self.handle_pinch)
|
|
self.on_pinch(self.handle_pinch)
|
|
|
self.on_rotate(self.handle_rotate)
|
|
self.on_rotate(self.handle_rotate)
|
|
|
self.on_flick(self.handle_flick)
|
|
self.on_flick(self.handle_flick)
|
|
|
|
|
+ self.on_double_tap(self.circulate_color)
|
|
|
|
|
+
|
|
|
|
|
+ def circulate_color(self, g):
|
|
|
|
|
+ self.color = self.color[2:] + self.color[:2]
|
|
|
|
|
|
|
|
def flick_drag(self, amt):
|
|
def flick_drag(self, amt):
|
|
|
tx, ty = self.flick_direction
|
|
tx, ty = self.flick_direction
|
|
@@ -105,7 +109,7 @@ class Polygon(BoundingBoxArea):
|
|
|
for x, y in zip(*self.points):
|
|
for x, y in zip(*self.points):
|
|
|
cr.line_to(x, y)
|
|
cr.line_to(x, y)
|
|
|
|
|
|
|
|
- cr.set_source_rgb(*self.fill_color)
|
|
|
|
|
|
|
+ cr.set_source_rgb(*self.color)
|
|
|
cr.fill()
|
|
cr.fill()
|
|
|
|
|
|
|
|
|
|
|