Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2010-10-13 15:25:07 (GMT)
committer Walter Bender <walter@sugarlabs.org>2010-10-13 15:25:07 (GMT)
commit749637716f3450650861e54fa7b8cefab3c532c7 (patch)
treeb0a1ec6a7d0829a485c9701314125ae77108584c
parent63e6e6d912f2c57cbb556afd26d7a5aaa33499b1 (diff)
prevent blocks from being moved off the top of the screen
-rw-r--r--TurtleArt/tawindow.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index b3d14cf..f620958 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -1214,18 +1214,14 @@ class TurtleArtWindow():
self.drag_group = find_group(blk)
- # Prevent blocks from ending up with a negative x...
+ # Prevent blocks from ending up with a negative x or y
for blk in self.drag_group:
(bx, by) = blk.spr.get_xy()
if bx + dx < 0:
dx = -bx
+ if by + dy < 0:
+ dy = -by
- # Move the stack
- """
- for blk in self.drag_group:
- (bx, by) = blk.spr.get_xy()
- blk.spr.move((bx + dx, by + dy), not blk.status=='collapsed')
- """
# Calculate a bounding box and only invalidate once.
minx = blk.spr.rect.x
miny = blk.spr.rect.y
@@ -2014,6 +2010,8 @@ class TurtleArtWindow():
(sx, sy) = blk.spr.get_xy()
if sx + dx < 0:
dx += -(sx + dx)
+ if sy + dy < 0:
+ dy += -(sy + dy)
for blk in self.drag_group:
(sx, sy) = blk.spr.get_xy()