Commits

Westley Martínez committed e73d172

Fix palette loading for large tile sizes.

  • Participants
  • Parent commits c1d2565
  • Branches stable

Comments (0)

Files changed (3)

+2013-11-19 0.1.3
+----------------
+
+Fixes for loading tile sheets have been applied.  Scrolling with the
+map and placing tiles now works correctly.
+
 2013-11-19 0.1.2
 ----------------
 
-Map Editor 0.1.2 README
+Map Editor 0.1.3 README
 =======================
 
 Copyright (c) 2013 Westley Martínez.  All rights reserved.
 Various fixes for the palette have been applied.  These are mostly
 cosmetic, but the palette's scrollbar now works correctly.
 
+Fixes for loading tile sheets have been applied.  Scrolling with the
+map and placing tiles now works correctly.
+
 Documentation
 -------------
 

File mapeditor.pyw

 
 from animap import Map
 
-VERSION = '0.1.2'
+VERSION = '0.1.3'
 
 class DummyMouseEvent:
 
         self.palette_frame = tk.Frame(self.frame3, bd=1, relief=SUNKEN)
         self.palette_frame.grid(row=0, column=0)
         self.palette = tk.Canvas(self.palette_frame, width=128,
-                                 height=vheight - 160)
+                                 height=vheight - 160,
+                                 scrollregion=(0, 0, tile_size, vheight - 160))
         self.palette.pack()
         self.palette.bind('<Button-1>', self.palette_choose)
         self.palette.bind('<Button-3>', self.palette_choose_alt)
         obj = self.palette.create_rectangle(x, y, x + self.tile_size,
                                             y + self.tile_size, fill='blue')
         x += 1
+        if x * self.tile_size >= 128:
+            y += 1
+            x = 0
         for file in sorted(os.listdir(tile_dir)):
             filename = os.path.join(tile_dir, file)
             if os.path.isdir(filename):
                     if x * self.tile_size >= 128:
                         y += 1
                         x = 0
-        self.palette.config(scrollregion=(0, 0, x * self.tile_size,
+        self.palette.config(scrollregion=(0, 0, max(128, self.tile_size),
                                           y * self.tile_size))
 
     def new(self):