scatter: respect scatter.do_scale property and don't scale if it's set to False

This commit is contained in:
Christopher Denter 2011-04-14 12:03:06 +02:00
parent 57ba12de69
commit 6857740482
1 changed files with 7 additions and 6 deletions

View File

@ -348,13 +348,14 @@ class Scatter(Widget):
new_line = Vector(*touch.pos) - anchor new_line = Vector(*touch.pos) - anchor
angle = radians(new_line.angle(old_line)) * self.do_rotation angle = radians(new_line.angle(old_line)) * self.do_rotation
scale = new_line.length() / old_line.length()
new_scale = scale * self.scale
if new_scale < self.scale_min or new_scale > self.scale_max:
scale = 1.0
self.apply_transform(Matrix().rotate(angle, 0, 0, 1), anchor=anchor) self.apply_transform(Matrix().rotate(angle, 0, 0, 1), anchor=anchor)
self.apply_transform(Matrix().scale(scale, scale, scale), anchor=anchor)
if self.do_scale:
scale = new_line.length() / old_line.length()
new_scale = scale * self.scale
if new_scale < self.scale_min or new_scale > self.scale_max:
scale = 1.0
self.apply_transform(Matrix().scale(scale, scale, scale), anchor=anchor)
def on_touch_down(self, touch): def on_touch_down(self, touch):
x, y = touch.x, touch.y x, y = touch.x, touch.y