[gcompris/gcomprixogoo] Fixed moving flipped items towards the top left or right.
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gcompris/gcomprixogoo] Fixed moving flipped items towards the top left or right.
- Date: Wed, 11 Nov 2009 19:00:37 +0000 (UTC)
commit d60371b01e9973a3c6ca6dba4ce92344abed401d
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Wed Nov 11 19:59:52 2009 +0100
Fixed moving flipped items towards the top left or right.
src/anim-activity/AnimItem.py | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/src/anim-activity/AnimItem.py b/src/anim-activity/AnimItem.py
index 98ab509..fc38573 100644
--- a/src/anim-activity/AnimItem.py
+++ b/src/anim-activity/AnimItem.py
@@ -217,6 +217,10 @@ class AnimItem:
if(y > self.drawing_area[3]):
y = self.drawing_area[3]
+ if self.item:
+ return AnimItem.anim.gcomprisBoard.canvas.\
+ convert_to_item_space(self.item, x, y)
+
result = []
tmp = round(((x+(self.step)) -
self.drawing_area[0])/self.step) - 1
@@ -226,10 +230,6 @@ class AnimItem:
self.drawing_area[1])/self.step) - 1
result.append(float(self.drawing_area[1] + tmp*self.step))
- if self.item:
- return AnimItem.anim.gcomprisBoard.canvas.\
- convert_to_item_space(self.item, x, y)
-
return result
# Given two points p1 and p2, return the
@@ -373,18 +373,27 @@ class AnimItem:
self.old_y = 0
self.save_at_time(AnimItem.anim.doc.timeline.get_time())
elif event.type == gtk.gdk.BUTTON_PRESS:
+ #(event.x, event.y) = AnimItem.anim.gcomprisBoard.canvas.\
+ # convert_from_item_space(item, event.x, event.y)
+ #print event.x, " ", event.y
self.old_x = event.x
self.old_y = event.y
elif event.type == gtk.gdk.MOTION_NOTIFY:
+ #(event.x, event.y) = AnimItem.anim.gcomprisBoard.canvas.\
+ # convert_from_item_space(item, event.x, event.y)
dx = event.x - self.old_x
dy = event.y - self.old_y
+ flip_x = 1
+ if item.get_transform() and item.get_transform()[0] < 0:
+ flip_x = -1
+
bounds = self.item.get_bounds()
# Check drawing boundaries
- if(bounds.x1 + dx < self.drawing_area[0]):
- dx = self.drawing_area[0] - bounds.x1
- if(bounds.x2 + dx > self.drawing_area[2]):
- dx = self.drawing_area[2] - bounds.x2
+ if(bounds.x1 + dx * flip_x < self.drawing_area[0]):
+ dx = (self.drawing_area[0] - bounds.x1) * flip_x
+ if(bounds.x2 + dx * flip_x > self.drawing_area[2]):
+ dx = (self.drawing_area[2] - bounds.x2) *flip_x
if(bounds.y1 + dy < self.drawing_area[1]):
dy = self.drawing_area[1]- bounds.y1
if(bounds.y2 + dy > self.drawing_area[3]):
@@ -577,7 +586,7 @@ class Anchor:
self.fixed_y = 0
self.offset_x = 0
self.offset_y = 0
- self.animitem.save_at_time(self.animitem.anim.timeline.get_time())
+ self.animitem.save_at_time(self.animitem.anim.doc.timeline.get_time())
elif (event.type == gtk.gdk.MOTION_NOTIFY
and event.state & gtk.gdk.BUTTON1_MASK):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]