Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--view.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/view.py b/view.py
index 66e29c7..8ba64ea 100644
--- a/view.py
+++ b/view.py
@@ -53,8 +53,13 @@ class MindMapView(Canvas):
thought = kwargs['element']
logging.debug('__dragging_finished_cb %r %r' % (x, y))
thought.dragging = False
- thought.model.x = x
- thought.model.y = y
+
+ rect = self.get_allocation()
+ thought_rect = thought.get_rect()
+ if (x >= 0 and x + thought_rect.width <= rect.width) and \
+ (y >= 0 and y + thought_rect.height <= rect.height):
+ thought.model.x = x
+ thought.model.y = y
def set_model(self, new_model):
logging.debug('set_model %r' % new_model)