From e6b839f2025d7c15047bacf8c7e2fcfdad199a95 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 1 Sep 2006 18:38:23 +0200 Subject: [PATCH] Fix logic --- shell/home/IconLayout.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/shell/home/IconLayout.py b/shell/home/IconLayout.py index 523f1051..1b52ca6d 100644 --- a/shell/home/IconLayout.py +++ b/shell/home/IconLayout.py @@ -20,13 +20,18 @@ class IconLayout: self._icons.remove(icon) def _is_valid_position(self, icon, x, y): - h_border = icon.props.size + 4 - v_border = icon.props.size + 4 - if x < self._x1 - h_border or x > self._x2 + h_border: - return True - if y < self._y1 - v_border or y > self._y2 + v_border: - return True - return False + icon_size = icon.props.size + border = 20 + + if not (border < x < self._width - icon_size - border and \ + border < y < self._height - icon_size - border): + return False + + if self._x1 - icon_size - border < x < self._x2 + border and \ + self._y1 - icon_size - border < y < self._y2 + border: + return False + + return True def _layout_icon(self, icon): while True: