diff options
-rw-r--r-- | view.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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) |