From 034f4f8a7792ab7f4777d3a13e2ab139b3d7be4a Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 18 Apr 2013 16:27:36 +0200 Subject: [PATCH] Refactor --- erdslangetjie/editor/editor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erdslangetjie/editor/editor.py b/erdslangetjie/editor/editor.py index 22fa0a4..ef08b81 100644 --- a/erdslangetjie/editor/editor.py +++ b/erdslangetjie/editor/editor.py @@ -76,6 +76,8 @@ class EditorWindow(FloatLayout): self.draw_save_button() def _draw_tile(self, tile_pos, tile): + if tile_pos in self.nodes: + self.remove_widget(self.nodes[tile_pos]) node = Widget(size=(TILE_SIZE, TILE_SIZE), pos=tile_pos) node.bind(on_touch_down=self.change_node) node.bind(on_touch_move=self.change_node) @@ -149,8 +151,6 @@ class EditorWindow(FloatLayout): self.level_obj.set_tile_type(tile_pos, action) for map_pos, new_tile in self.level_obj.get_changed_tiles(): node_pos = (map_pos[0] * TILE_SIZE, map_pos[1] * TILE_SIZE) - old_node = self.nodes[node_pos] - self.remove_widget(old_node) self._draw_tile(node_pos, new_tile) -- 2.34.1