Oops, I Did It Again! 0 ▲ ronjeffries.com 3 hours ago · Tech · hide · 0 comments Hello, loves! I did a little refactoring on the zoom-scrolling1 code. I think it was the right thing to do. Tout le monde déteste l’IA. While I do not question that I spent more time on the zoom-scrolling code than was appropriate, I do think it is always worthwhile to take a look at newly committed code after a little while, to let our relieved at last it’s working eyes turn into fresh what have we here eyes that can see possible improvements. Anyway, I did take a look and the results, I think, are worth noting. As “finished” yesterday morning: def scroll_dungeon_cam(self, cell): px, py = self.clamped_position(cell) self.dungeon_cam.position = (px, py) def clamped_position(self, cell): effective_zoom = self.dungeon_cam.zoom / cell_size # 1 - 4 px, py = cell.position cells_across_screen = self.max_x/effective_zoom margin_x = self.cells_each_side(cells_across_screen) px = min(max(px, margin_x), self.max_x - margin_x - 1) cells_up_screen = self.max_y/effective_zoom margin_y =… No comments yet. Log in to reply on the Fediverse. Comments will appear here.